- Timestamp:
- 01/31/13 13:14:27 (12 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/external-alma/asdm2ASAP/ASDMFiller.cc
r2710 r2754 26 26 antennaId_( -1 ), 27 27 antennaName_( "" ), 28 className_("ASDMFiller") 28 className_("ASDMFiller"), 29 freqToLsr_(False) 29 30 { 30 31 reader_ = new ASDMReader() ; … … 52 53 antennaId_ = reader_->getAntennaId() ; 53 54 antennaName_ = reader_->getAntennaName() ; 55 56 if (rec.isDefined("asdm")) { 57 Record asdmrec = rec.asRecord("asdm") ; 58 if (asdmrec.isDefined("freq_tolsr")) { 59 freqToLsr_ = asdmrec.asBool("freq_tolsr"); 60 } 61 } 62 logsink_->postLocally(LogMessage("freqToLsr_ = "+String(freqToLsr_?"True":"False"), LogOrigin(className_, funcName, WHERE))); 54 63 55 64 //logsink_->postLocally( LogMessage("antennaId_ = "+String::toString(antennaId_),LogOrigin(className_,funcName,WHERE)) ) ; … … 72 81 MFrequency::Types freqFrame = MFrequency::LSRK ; 73 82 table_->frequencies().setFrame( freqFrame, false ) ; 74 table_->frequencies().setFrame( freqFrame, true ) ; 83 if ( freqToLsr_ ) { 84 table_->frequencies().setFrame( freqFrame, true ) ; 85 } 86 else { 87 string baseFrame = reader_->getFrame() ; 88 table_->frequencies().setFrame( baseFrame, true ) ; 89 } 75 90 //logsink_->postLocally( LogMessage("sFreqFrame = "+sFreqFrame,LogOrigin(className_,funcName,WHERE)) ) ; 76 91 … … 615 630 //logsink_->postLocally( LogMessage("freqref = "+freqref,LogOrigin(className_,funcName,WHERE)) ) ; 616 631 casa::Double newf = freq ; 617 if ( freq ref != "LSRK" ) {632 if ( freqToLsr_ && freqref != "LSRK" ) { 618 633 MEpoch me( Quantum<casa::Double>( utc, Unit("d") ), MEpoch::UTC ) ; 619 634 Vector< Quantum<casa::Double> > antposQ( 3 ) ; -
trunk/external-alma/asdm2ASAP/ASDMFiller.h
r2225 r2754 102 102 103 103 casa::String className_ ; 104 casa::Bool freqToLsr_ ; 104 105 105 106 } ; -
trunk/external-alma/asdm2ASAP/asdm2ASAP.cc
r2273 r2754 49 49 inp.create( "srt", "all", "spectral resolution mode: all|fr(full resolution)|ca(channel average)|bw(baseband wide)|fr+ca|fr+bw|ca+bw", "String" ) ; 50 50 inp.create( "logfile", "", "logger output", "String" ) ; 51 inp.create( "freq-tolsr", "False", "Convert frequency frame to LSRK or not: True|False", "Bool" ) ; 51 52 inp.readArguments( argc, argv ) ; 52 53 … … 60 61 string resolutionType = inp.getString( "srt" ) ; 61 62 string logfile = inp.getString( "logfile" ) ; 63 Bool freqToLsr = inp.getBool( "freq-tolsr" ) ; 62 64 63 65 int numApc = 1 ; … … 112 114 asdmRec.define( "sampling", timeSampling ) ; 113 115 asdmRec.define( "srt", resolutionType ) ; 116 asdmRec.define( "freq_tolsr", freqToLsr ) ; 114 117 if ( reg.match( antenna.c_str(), antenna.size() ) != String::npos ) { 115 118 // antenna is specifiec as id -
trunk/python/asapmath.py
r2646 r2754 949 949 950 950 @asaplog_post_dec 951 def splitant(filename, outprefix='',overwrite=False ):951 def splitant(filename, outprefix='',overwrite=False, getpt=True, freq_tolsr=False): 952 952 """ 953 953 Split Measurement set by antenna name, save data as a scantables, … … 963 963 The default False is to return with warning 964 964 without writing the output. USE WITH CARE. 965 getpt Whether to import direction from MS/POINTING 966 table or not. Default is True (import direction). 967 freq_tolsr Whether to convert frequency frame information 968 to LSRK or not. Default is False (import as is). 965 969 966 970 """ … … 1008 1012 tb.open(tablename=filename,nomodify=True) 1009 1013 tbsel=tb.query('ANTENNA1 == %s && ANTENNA2 == %s'%(antid,antid),tmpname) 1010 scan=scantable(tmpname,average=False, getpt=True,antenna=int(antid))1014 scan=scantable(tmpname,average=False,antenna=int(antid),getpt=getpt,freq_tolsr=freq_tolsr,) 1011 1015 outname=prefix+antnames[antid]+'.asap' 1012 1016 scan.save(outname,format='ASAP',overwrite=overwrite) -
trunk/python/scantable.py
r2753 r2754 209 209 Default (false) is taken from rc file. 210 210 211 getpt: Whether to import direction from MS/POINTING 212 table properly or not. 213 This is effective only when filename is MS. 214 The default (True) is to import direction 215 from MS/POINTING. 216 217 freq_tolsr: Whether to convert frequency frame information 218 to LSRK or not. 219 This is effective only when filename is MS. 220 The default (False) is to import frequency 221 as is. 222 211 223 """ 212 224 if average is None: -
trunk/src/MSFiller.cpp
r2746 r2754 257 257 MSFillerVisitor(const Table &from, Scantable &to) 258 258 : BaseMSFillerVisitor(from), 259 scantable( to ) 259 scantable(to), 260 freqToLsr_(False) 260 261 { 261 262 antennaId = 0 ; … … 712 713 sysCalTsysCol.attach( sctab, tsysCol ) ; 713 714 } 715 void setFreqToLsr(Bool b) { freqToLsr_ = b; } 714 716 STHeader getHeader() { return header ; } 715 717 uInt getNumBeam() { return nbeam ; } … … 816 818 MFrequency::Types freqRef = MFrequency::castType( measFreqRef ) ; 817 819 //freqref = MFrequency::showType( freqRef ) ; 818 freqref = "LSRK" ; 820 //freqref = "LSRK" ; 821 freqref = "TOPO"; 819 822 Quantum<Double> q ; 820 823 getScalarQuant( "TOTAL_BANDWIDTH", spwId, spwtab, q ) ; … … 842 845 if ( even ) 843 846 refval = 0.5 * ( refval + qa[refchan+1].getValue( "Hz" ) ) ; 844 if ( freqRef != MFrequency::LSRK ) { 847 if ( freqToLsr_ && freqRef != MFrequency::LSRK ) { 848 //cout << "do conversion to LSRK" << endl; 845 849 MeasFrame mframe( me, mp, md ) ; 846 850 MFrequency::Convert tolsr( freqRef, MFrequency::Ref( MFrequency::LSRK, mframe ) ) ; … … 1314 1318 //String tsysCol; 1315 1319 //String tcalCol; 1320 Bool freqToLsr_; 1316 1321 1317 1322 // MS subtables … … 1585 1590 antennaStr_(""), 1586 1591 getPt_( True ), 1592 freqToLsr_( False ), 1587 1593 isFloatData_( False ), 1588 1594 isData_( False ), … … 1631 1637 antenna_ = 0 ; 1632 1638 } 1639 if ( msrec.isDefined( "freq_tolsr" ) ) { 1640 freqToLsr_ = msrec.asBool( "freq_tolsr" ) ; 1641 } 1633 1642 } 1634 1643 … … 1649 1658 1650 1659 os_ << "Parsing MS options" << endl ; 1651 os_ << " getPt = " << getPt_<< endl ;1660 os_ << " getPt = " << (getPt_ ? "True" : "False") << endl ; 1652 1661 os_ << " antenna = " << antenna_ << endl ; 1653 os_ << " antennaStr = " << antennaStr_ << LogIO::POST ; 1662 os_ << " antennaStr = " << antennaStr_ << endl ; 1663 os_ << " freqToLsr = " << (freqToLsr_ ? "True" : "False") << LogIO::POST; 1654 1664 1655 1665 mstable_ = MeasurementSet( (*tmpMS)( tmpMS->col("ANTENNA1") == antenna_ … … 1745 1755 string freqFrame = "LSRK" ; 1746 1756 table_->frequencies().setFrame( freqFrame ) ; 1747 table_->frequencies().setFrame( freqFrame, True ) ; 1757 if ( freqToLsr_ ) { 1758 table_->frequencies().setFrame( freqFrame, True ) ; 1759 } 1760 else { 1761 string baseFrame = frameFromSpwTable() ; 1762 table_->frequencies().setFrame( baseFrame, True ) ; 1763 } 1748 1764 1749 1765 // SUBTABLES: WEATHER … … 1791 1807 if ( isSysCal_ ) 1792 1808 myVisitor.setSysCalRecord( tcalrec_ ) ; 1809 myVisitor.setFreqToLsr( freqToLsr_ ) ; 1793 1810 1794 1811 //double t2 = mathutil::gettimeofday_sec() ; … … 2159 2176 } 2160 2177 2178 string MSFiller::frameFromSpwTable() 2179 { 2180 string frameString; 2181 Table tab = mstable_.spectralWindow(); 2182 ROScalarColumn<Int> mfrCol(tab, "MEAS_FREQ_REF"); 2183 Vector<Int> mfr = mfrCol.getColumn(); 2184 if (allEQ(mfr,mfr[0])) { 2185 frameString = MFrequency::showType(mfr[0]); 2186 //cout << "all rows have same frame: " << frameString << endl; 2187 } 2188 else { 2189 mfrCol.attach(tab, "NUM_CHAN"); 2190 for (uInt i = 0; i < tab.nrow(); i++) { 2191 if (mfrCol(i) != 4) { 2192 frameString = MFrequency::showType(mfr[i]); 2193 break; 2194 } 2195 } 2196 if (frameString.size() == 0) { 2197 frameString = "TOPO"; 2198 } 2199 } 2200 2201 //cout << "frameString = " << frameString << endl; 2202 2203 return frameString; 2204 } 2205 2161 2206 }; -
trunk/src/MSFiller.h
r2744 r2754 156 156 void initHeader( STHeader &header ) ; 157 157 158 // get base frame from SPECTRAL_WINDOW table 159 std::string frameFromSpwTable(); 160 158 161 CountedPtr<Scantable> table_ ; 159 162 MeasurementSet mstable_ ; … … 162 165 String antennaStr_ ; 163 166 Bool getPt_ ; 167 Bool freqToLsr_ ; 164 168 165 169 Bool isFloatData_ ;
Note:
See TracChangeset
for help on using the changeset viewer.