- Timestamp:
- 03/13/09 11:55:57 (16 years ago)
- Location:
- tags/asap2.3.0
- Files:
-
- 4 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
tags/asap2.3.0/apps/test.cpp
r1407 r1525 10 10 11 11 int main() { 12 const string fname = "/Users/mar637/data/test.asap"; 13 //const string fname = "test/data/tid-t002.rpf"; 14 //STFillerWrapper stf(fname); 15 //cout << "reading ..." << endl; 16 //stf.read(); 17 18 casa::CountedPtr<Scantable> st(new Scantable(fname, casa::Table::Plain)); 12 const string fname0 = "/tmp/ASAP_problem/c082812231.rpf"; 13 ScantableWrapper stw0(0); 14 STFillerWrapper stf0(stw0); 15 cout << "reading ..." << endl; 16 stf0.open(fname0); 17 stf0.read(); 18 stf0.close(); 19 19 20 STMath stm; 21 vector<bool> msk; 22 vector<casa::CountedPtr<Scantable> > l0; 23 l0.push_back(stw0.getCP()); 24 casa::CountedPtr<Scantable> av0 = stm.average(l0,msk, "NONE", "SCAN"); 25 26 const string fname1 = "/tmp/ASAP_problem/c082880100.rpf"; 27 ScantableWrapper stw1(0); 28 STFillerWrapper stf1(stw1); 29 cout << "reading ..." << endl; 30 stf1.open(fname1); 31 stf1.read(); 32 stf1.close(); 33 vector<casa::CountedPtr<Scantable> > l1; 34 l1.push_back(stw1.getCP()); 35 casa::CountedPtr<Scantable> av1 = stm.average(l1,msk, "NONE", "SCAN"); 36 20 37 vector<casa::CountedPtr<Scantable> > on; 21 on.push_back(st); 22 cout << "averaging..." << endl; 23 casa::CountedPtr<Scantable> avst = stm.average(on); 24 /* 25 cout << "quotient" << endl; 26 casa::CountedPtr<Scantable> quot = stm.autoQuotient(avst); 27 cout << quot->summary() << endl; 28 */ 38 on.push_back(av0); 39 on.push_back(av1); 40 41 casa::CountedPtr<Scantable> avst = stm.merge(on); 42 //avst->makePersistent("t.asap"); 29 43 return 0; 30 44 -
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; -
tags/asap2.3.0/src/ScantableWrapper.h
r1430 r1525 120 120 { return table_->getParAngle(whichrow); } 121 121 122 std::vector<double> getAntennaPosition() const 123 { 124 std::vector<double> stlout; 125 casa::Vector<casa::Double> vec = 126 table_->getAntennaPosition().getAngle().getValue(); 127 vec.tovector(stlout); 128 return stlout; 129 } 122 130 123 131 void setSpectrum(std::vector<float> spectrum, int whichrow=0) -
tags/asap2.3.0/src/python_Scantable.cpp
r1440 r1525 124 124 .def("_setsourcetype", &ScantableWrapper::setSourceType) 125 125 .def("_getdirectionvec", &ScantableWrapper::getDirectionVector) 126 .def("_getantennapos", &ScantableWrapper::getAntennaPosition) 126 127 ; 127 128 };
Note:
See TracChangeset
for help on using the changeset viewer.