Changeset 2761
- Timestamp:
- 02/06/13 13:13:20 (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/external-alma/atnf/PKSIO/NROReader.cc
r2643 r2761 46 46 #include <measures/Measures/MeasConvert.h> 47 47 48 #include <casa/Logging/LogIO.h> 48 49 #include <casa/IO/RegularFileIO.h> 49 50 #include <casa/OS/File.h> … … 185 186 : dataset_( NULL ), 186 187 srcdir_( 0 ), 187 msrcdir_( 0 ) 188 msrcdir_( 0 ), 189 freqRefFromVREF_( false ) // import frequency as REST 188 190 { 189 191 // initialization … … 199 201 dataset_ = NULL ; 200 202 } 203 } 204 205 // set frequency reference frame 206 void NROReader::setFreqRefFromVREF( bool fromVREF ) 207 { 208 os_.origin( LogOrigin( "NROReader", "setFreqRefFromVREF", WHERE ) ) ; 209 os_ << ((fromVREF) ? "Take frequency reference frame from VREF" : 210 "Use frequency reference frame REST") << LogIO::POST ; 211 212 freqRefFromVREF_ = fromVREF ; 201 213 } 202 214 … … 387 399 for ( int ip = 0 ; ip < 3 ; ip++ ) 388 400 qantpos[ip] = Quantity( antpos[ip], "m" ) ; 389 MPosition mp( MVPosition( qantpos ), MPosition::ITRF ) ;390 mf_->set( mp ) ;401 mp_ = MPosition( MVPosition( qantpos ), MPosition::ITRF ) ; 402 mf_->set( mp_ ) ; 391 403 } 392 404 converter_ = new MDirection::Convert( MDirection::AZEL, … … 397 409 398 410 if ( coord_ == 2 ) { 399 MEpoch me( Quantity( t, "d" ), MEpoch::UTC ) ;400 mf_->set( me ) ;411 me_ = MEpoch( Quantity( t, "d" ), MEpoch::UTC ) ; 412 mf_->set( me_ ) ; 401 413 } 402 414 } … … 458 470 } 459 471 } 472 else if ( vref.compare( 0, 3, "GAL" ) == 0 ) { 473 vref = "GALACTO" ; 474 } 475 else if (vref.compare( 0, 3, "HEL" ) == 0 ) { 476 os_.origin( LogOrigin( "NROReader", "getHeaderInfo", WHERE ) ) ; 477 os_ << LogIO::WARN << "Heliocentric frame is not supported. Use Barycentric frame instead." << LogIO::POST ; 478 vref = "BARY" ; 479 } 460 480 //freqref = vref ; 461 481 //freqref = "LSRK" ; 462 freqref = "REST" ; 482 //freqref = "REST" ; 483 freqref = freqRefFromVREF_ ? vref : "REST" ; 463 484 //cout << "freqref = " << freqref << endl ; 464 485 NRODataRecord *record = dataset_->getRecord( 0 ) ; 465 reffreq = record->FREQ0 ; 486 reffreq = record->FREQ0 ; // rest frequency 487 466 488 //cout << "reffreq = " << reffreq << endl ; 467 489 bw = dataset_->getBEBW()[0] ; … … 538 560 Float &winddir, 539 561 Double &srcvel, 540 Vector<Double> & propermotion,562 Vector<Double> &/*propermotion*/, 541 563 Vector<Double> &srcdir, 542 Vector<Double> & scanrate)564 Vector<Double> &/*scanrate*/ ) 543 565 { 544 566 static const IPosition oneByOne( 1, 1 ); … … 580 602 //cout << "freqs = [" << freqs[0] << ", " << freqs[1] << ", " << freqs[2] << "]" << endl ; 581 603 604 if ( freqRefFromVREF_ ) { 605 freqs = shiftFrequency( freqs, 606 dataset_->getURVEL(), 607 dataset_->getVDEF() ) ; 608 } 609 582 610 // restfreq (for MOLECULE_ID) 583 611 restfreq.resize( oneByOne ) ; … … 609 637 vector<double> spec = dataset_->getSpectrum( irow ) ; 610 638 spectra.resize( spec.size() ) ; 611 int index = 0 ;639 //int index = 0 ; 612 640 Bool b ; 613 641 Float *fp = spectra.getStorage( b ) ; … … 708 736 return dataset_->getRowNum() ; 709 737 } 738 739 vector<double> NROReader::shiftFrequency( const vector<double> &f, 740 const double &v, 741 const string &vdef ) 742 { 743 vector<double> r( f ) ; 744 double factor = v / 2.99792458e8 ; 745 if ( vdef.compare( 0, 3, "RAD" ) == 0 ) { 746 factor = 1.0 / ( 1.0 + factor ) ; 747 r[1] *= factor ; 748 r[2] *= factor ; 749 } 750 else if ( vdef.compare( 0, 3, "OPT" ) == 0 ) { 751 factor += 1.0 ; 752 r[1] *= factor ; 753 r[2] *= factor ; 754 } 755 else { 756 cout << "vdef=" << vdef << " is not supported." << endl; 757 } 758 return r ; 759 } -
trunk/external-alma/atnf/PKSIO/NROReader.h
r2643 r2761 42 42 #include <casa/BasicSL/String.h> 43 43 #include <measures/Measures/MPosition.h> 44 #include <measures/Measures/MEpoch.h> 44 45 #include <measures/Measures/MCPosition.h> 45 46 #include <measures/Measures/MDirection.h> … … 56 57 #include <atnf/PKSIO/NRODataset.h> 57 58 #include <atnf/PKSIO/NRODataRecord.h> 58 59 using namespace std ;60 59 61 60 // <summary> … … 103 102 // Destructor. 104 103 virtual ~NROReader() ; 104 105 // determine whether to import frequency as REST (frequency is same as 106 // NEWSTAR/NOSTAR) or as is (velocity is same as NEWSTAR/NOSTAR) 107 void setFreqRefFromVREF( bool fromVREF ) ; 105 108 106 109 // Read data header … … 133 136 uInt &beamno, 134 137 uInt &polno, 135 vector<double> &freqs,138 std::vector<double> &freqs, 136 139 Vector<Double> &restfreq, 137 140 uInt &refbeamno, … … 171 174 172 175 // Get IF settings 173 virtual vector<Bool> getIFs() ;176 virtual std::vector<Bool> getIFs() ; 174 177 175 178 // Get Number of IFs … … 177 180 178 181 // Get Beam settings 179 virtual vector<Bool> getBeams() ;182 virtual std::vector<Bool> getBeams() ; 180 183 181 184 // Get Number of Beams … … 188 191 189 192 // Get spectrum 190 virtual vector<vector<double> > getSpectrum() ;193 virtual std::vector< std::vector<double> > getSpectrum() ; 191 194 192 195 // Get number of polarization … … 196 199 virtual double getStartTime() ; 197 200 virtual double getEndTime() ; 198 virtual vector<double> getStartIntTime() ;201 virtual std::vector<double> getStartIntTime() ; 199 202 //virtual double getStartIntTime( int i ) ; 200 203 201 204 // Get Antenna Position in ITRF coordinate 202 virtual vector<double> getAntennaPosition() = 0 ;205 virtual std::vector<double> getAntennaPosition() = 0 ; 203 206 204 207 // Get SRCDIRECTION in RADEC(J2000) … … 209 212 virtual void initConvert( int icoord, double t, char *epoch ) ; 210 213 214 // Shift frequency by given velocity with respect to specified 215 // velocity reference 216 std::vector<double> shiftFrequency( const std::vector<double> &f, const double &v, const string &vref ) ; 217 211 218 // filename 212 219 string filename_ ; … … 222 229 CountedPtr<MDirection::Convert> converter_ ; 223 230 CountedPtr<MeasFrame> mf_ ; 231 MEpoch me_ ; 232 MPosition mp_ ; 224 233 int coord_ ; 225 234 235 bool freqRefFromVREF_ ; 236 226 237 // Logger 227 //LogIO os;238 LogIO os_ ; 228 239 }; 229 240 -
trunk/python/scantable.py
r2754 r2761 255 255 self._fill([filename], unit, average, opts) 256 256 elif os.path.isfile(filename): 257 self._fill([filename], unit, average) 257 opts={'nro': {}} 258 nrokeys=['freqref'] 259 for key in nrokeys: 260 if key in args.keys(): 261 opts['nro'][key] = args[key] 262 self._fill([filename], unit, average, opts) 258 263 # only apply to new data not "copy constructor" 259 264 self.parallactify(parallactify) -
trunk/src/NROFiller.cpp
r2289 r2761 23 23 #include <casa/Quanta/MVTime.h> 24 24 #include <atnf/PKSIO/SrcType.h> 25 #include <casa/Logging/LogIO.h> 25 26 26 27 using namespace casa; … … 38 39 } 39 40 40 41 bool NROFiller::open(const std::string& filename, const Record& rec) 41 42 { 42 43 bool status = true ; 44 45 // Parse options 46 String freqref = "DEFAULT (REST)" ; 47 if ( rec.isDefined( "nro" ) ) { 48 Record nrorec = rec.asRecord( "nro" ) ; 49 if ( nrorec.isDefined( "freqref" ) ) { 50 freqref = nrorec.asString( "freqref" ) ; 51 freqref.upcase() ; 52 } 53 LogIO os( LogOrigin( "NROFiller", "open", WHERE ) ) ; 54 os << "Parsing NRO options" << endl ; 55 os << " freqref = " << freqref << LogIO::POST ; 56 } 43 57 44 58 // get appropriate reader object … … 49 63 return status ; 50 64 } 65 66 // Apply options 67 if ( freqref == "REST" ) { 68 reader_->setFreqRefFromVREF( false ) ; 69 } 70 else if ( freqref == "VREF" ) { 71 reader_->setFreqRefFromVREF( true ) ; 72 } 51 73 52 74 // get header information
Note:
See TracChangeset
for help on using the changeset viewer.