Changeset 1525 for tags/asap2.3.0/src/Scantable.cpp
- Timestamp:
- 03/13/09 11:55:57 (15 years ago)
- Location:
- tags/asap2.3.0
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
tags/asap2.3.0/src/Scantable.cpp
r1507 r1525 49 49 #include <measures/Measures/MCDirection.h> 50 50 // 51 #include <measures/Measures/MCRadialVelocity.h> 52 #include <measures/Measures/MCDoppler.h> 51 53 #include <measures/Measures/MDirection.h> 52 54 #include <measures/Measures/MFrequency.h> … … 912 914 if ( Unit(us) == Unit("Hz") ) { 913 915 for ( int i=0; i < nchan; ++i) { 914 Double world ;915 spc.toWorld(world , pixel[i]);916 stlout.push_back(double(world ));916 Double worldi; 917 spc.toWorld(worldi, pixel[i]); 918 stlout.push_back(double(worldi)); 917 919 } 918 920 } else if ( Unit(us) == Unit("km/s") ) { 919 Vector<Double> world; 920 spc.pixelToVelocity(world, pixel); 921 world.tovector(stlout); 921 922 MeasFrame frame(mp,md,me); 923 MRadialVelocity::Types refin, refout; 924 MFrequency::Types refinfreq = freqTable_.getFrame(true); 925 MRadialVelocity::getType(refin, freqTable_.getFrameString(true)); 926 MRadialVelocity::getType(refout, freqTable_.getFrameString(false)); 927 SpectralCoordinate spc1 = 928 freqTable_.getSpectralCoordinate(mfreqidCol_(whichrow)); 929 930 MRadialVelocity::Ref rin(refin, frame); 931 MRadialVelocity::Ref rout(refout, frame); 932 MRadialVelocity::Convert cnv(rin, rout); 933 Vector<Double> worlds(2); 934 Double deltav; 935 for ( int i=0; i < nchan; ++i) { 936 937 Double worldi; 938 if (i == 0) { 939 for (uInt k = 0; k<2;++k) { 940 spc1.toWorld(worlds[i+k], pixel[i+k]); 941 MDoppler mdop = \ 942 MFrequency(Quantity(worlds[i+k], "Hz"), 943 refinfreq).toDoppler(Quantity(rf, "Hz")); 944 MRadialVelocity mrv = MRadialVelocity::fromDoppler(mdop, refin); 945 MRadialVelocity mrvo = cnv(mrv); 946 //worlds[i+k] = cnv(mrv).get(us).getValue(); 947 948 MDoppler mdopo = MDoppler::Convert(mrvo.toDoppler(), 949 MDoppler::RADIO)(); 950 MFrequency mf = MFrequency::fromDoppler(mdopo, 951 MVFrequency(Quantity(rf, "Hz"))); 952 worlds[i+k] = mf.get("GHz").getValue(); 953 954 } 955 } 956 deltav = worlds[1]-worlds[0]; 957 worldi = worlds[0] + Double(i)*deltav; 958 stlout.push_back(double(worldi)); 959 } 960 cout << worlds[0] << " + " << deltav << "+" << spc1.increment() << endl; 922 961 } 923 962 return stlout;
Note: See TracChangeset
for help on using the changeset viewer.