Changeset 2748
- Timestamp:
- 01/23/13 19:48:24 (12 years ago)
- Location:
- trunk/external-alma/atnf/PKSIO
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/external-alma/atnf/PKSIO/NRODataset.cc
r2643 r2748 33 33 #include <atnf/PKSIO/NRODataset.h> 34 34 #include <casa/OS/Time.h> 35 #include <casa/Utilities/Regex.h> 35 36 #include <scimath/Mathematics/InterpolateArray1D.h> 36 37 … … 377 378 LogIO os( LogOrigin("NRODataset","getSpectrum",WHERE) ) ; 378 379 os << LogIO::WARN << "zero spectrum for row " << i << LogIO::POST ; 379 if ( spec.size() != nchan )380 if ( spec.size() != (unsigned int)nchan ) 380 381 spec.resize( nchan ) ; 381 382 for ( vector<double>::iterator i = spec.begin() ; … … 418 419 LogIO os( LogOrigin( "NRODataset", "getSpectrum", WHERE ) ) ; 419 420 os << LogIO::SEVERE << "ivalue for row " << i << " is out of range" << LogIO::EXCEPTION ; 420 if ( spec.size() != nchan )421 if ( spec.size() != (unsigned int)nchan ) 421 422 spec.resize( nchan ) ; 422 423 for ( vector<double>::iterator i = spec.begin() ; … … 840 841 // cout << "HORN[" << idx << "]=" << HORN[idx] 841 842 // << ", RX[" << idx << "]=" << RX[idx] << endl ; 842 return polNoFromRX( RX[idx] .c_str()) ;843 } 844 845 uInt NRODataset::polNoFromRX( const char *rx )843 return polNoFromRX( RX[idx] ) ; 844 } 845 846 uInt NRODataset::polNoFromRX( const string &rx ) 846 847 { 847 848 uInt polno = 0 ; 848 // 201 2/03/15TN849 // T100H/V is multi-polarization receiver which is installed850 // on NRO 45m telescope. Here, POLNO is assigned as follows:849 // 2013/01/23 TN 850 // In NRO 45m telescope, naming convension for dual-polarization 851 // receiver is as follows: 851 852 // 852 // POLNO=0: T100H853 // 1: T100V853 // xxxH for horizontal component, 854 // xxxV for vertical component. 854 855 // 855 // For other receivers, POLNO is always 0. 856 if ( strncmp( rx, "T100V", 5 ) == 0 ) 857 polno = 1 ; 856 // Exception is H20ch1/ch2. 857 // Here, POLNO is assigned as follows: 858 // 859 // POLNO=0: xxxH or H20ch1 860 // 1: xxxV or H20ch2 861 // 862 // For others, POLNO is always 0. 863 String rxString(rx); 864 rxString.trim(); 865 //cout << "rx='" << rxString << "' (size " << rxString.size() << ")" << endl; 866 Regex reRx("(.*V|H20ch2)$"); 867 if (reRx.match(rxString.c_str(), rxString.size()) != String::npos) { 868 //cout << "match!" << endl; 869 polno = 1; 870 } 858 871 return polno ; 859 872 } -
trunk/external-alma/atnf/PKSIO/NRODataset.h
r2436 r2748 48 48 #define SCAN_HEADER_SIZE 424 49 49 50 51 using namespace std ;52 53 50 // <summary> 54 51 // Base class for NRO accessor classes. … … 85 82 public: 86 83 // Constructor 87 NRODataset( st ring name ) ;84 NRODataset( std::string name ) ; 88 85 89 86 // Destructor … … 106 103 107 104 // simple getter 108 st ring getLOFIL() { return LOFIL ; } ;109 st ring getVER() { return VER ; } ;110 st ring getGROUP() { return GROUP ; } ;111 st ring getPROJ() { return PROJ ; } ;112 st ring getSCHED() { return SCHED ; } ;113 st ring getOBSVR() { return OBSVR ; } ;114 st ring getLOSTM() { return LOSTM ; } ;115 st ring getLOETM() { return LOETM ; } ;105 std::string getLOFIL() { return LOFIL ; } ; 106 std::string getVER() { return VER ; } ; 107 std::string getGROUP() { return GROUP ; } ; 108 std::string getPROJ() { return PROJ ; } ; 109 std::string getSCHED() { return SCHED ; } ; 110 std::string getOBSVR() { return OBSVR ; } ; 111 std::string getLOSTM() { return LOSTM ; } ; 112 std::string getLOETM() { return LOETM ; } ; 116 113 int getARYNM() { return ARYNM ; } ; 117 114 int getNSCAN() { return NSCAN ; } ; 118 st ring getTITLE() { return TITLE ; } ;119 st ring getOBJ() { return OBJ ; } ;120 st ring getEPOCH() { return EPOCH ; } ;115 std::string getTITLE() { return TITLE ; } ; 116 std::string getOBJ() { return OBJ ; } ; 117 std::string getEPOCH() { return EPOCH ; } ; 121 118 double getRA0() { return RA0 ; } ; 122 119 double getDEC0() { return DEC0 ; } ; … … 125 122 int getNCALB() { return NCALB ; } ; 126 123 int getSCNCD() { return SCNCD ; } ; 127 st ring getSCMOD() { return SCMOD ; } ;124 std::string getSCMOD() { return SCMOD ; } ; 128 125 double getURVEL() { return URVEL ; } ; 129 st ring getVREF() { return VREF ; } ;130 st ring getVDEF() { return VDEF ; } ;131 st ring getSWMOD() { return SWMOD ; } ;126 std::string getVREF() { return VREF ; } ; 127 std::string getVDEF() { return VDEF ; } ; 128 std::string getSWMOD() { return SWMOD ; } ; 132 129 double getFRQSW() { return FRQSW ; } ; 133 130 double getDBEAM() { return DBEAM ; } ; … … 138 135 double getCMTNODE() { return CMTNODE ; } ; 139 136 double getCMTI() { return CMTI ; } ; 140 st ring getCMTTM() { return CMTTM ; } ;137 std::string getCMTTM() { return CMTTM ; } ; 141 138 double getSBDX() { return SBDX ; } ; 142 139 double getSBDY() { return SBDY ; } ; … … 155 152 int getSBIND() { return SBIND ; } ; 156 153 int getIBIT() { return IBIT ; } ; 157 st ring getSITE() { return SITE ; } ;158 vector<string> getRX() { return RX ; } ;159 vector<double> getHPBW() { return HPBW ; } ;160 vector<double> getEFFA() { return EFFA ; } ;161 vector<double> getEFFB() { return EFFB ; } ;162 vector<double> getEFFL() { return EFFL ; } ;163 vector<double> getEFSS() { return EFSS ; } ;164 vector<double> getGAIN() { return GAIN ; } ;165 vector<string> getHORN() { return HORN ; } ;166 vector<string> getPOLTP() { return POLTP ; } ;167 vector<double> getPOLDR() { return POLDR ; } ;168 vector<double> getPOLAN() { return POLAN ; } ;169 vector<double> getDFRQ() { return DFRQ ; } ;170 vector<string> getSIDBD() { return SIDBD ; } ;171 vector<int> getREFN() { return REFN ; } ;172 vector<int> getIPINT() { return IPINT ; } ;173 vector<int> getMULTN() { return MULTN ; } ;174 vector<double> getMLTSCF() { return MLTSCF ; } ;175 vector<string> getLAGWIND() { return LAGWIND ; } ;176 vector<double> getBEBW() { return BEBW ; } ;177 vector<double> getBERES() { return BERES ; } ;178 vector<double> getCHWID() { return CHWID ; } ;179 vector<int> getARRY() { return ARRY ; } ;180 vector<int> getNFCAL() { return NFCAL ; } ;181 vector<double> getF0CAL() { return F0CAL ; } ;182 vector<vector<double> > getFQCAL() { return FQCAL ; } ;183 vector<vector<double> > getCHCAL() { return CHCAL ; } ;184 vector<vector<double> > getCWCAL() { return CWCAL ; } ;185 st ring getCDMY1() { return CDMY1 ; } ;186 vector<double> getDSBFC() { return DSBFC ;} ;154 std::string getSITE() { return SITE ; } ; 155 std::vector<std::string> getRX() { return RX ; } ; 156 std::vector<double> getHPBW() { return HPBW ; } ; 157 std::vector<double> getEFFA() { return EFFA ; } ; 158 std::vector<double> getEFFB() { return EFFB ; } ; 159 std::vector<double> getEFFL() { return EFFL ; } ; 160 std::vector<double> getEFSS() { return EFSS ; } ; 161 std::vector<double> getGAIN() { return GAIN ; } ; 162 std::vector<std::string> getHORN() { return HORN ; } ; 163 std::vector<std::string> getPOLTP() { return POLTP ; } ; 164 std::vector<double> getPOLDR() { return POLDR ; } ; 165 std::vector<double> getPOLAN() { return POLAN ; } ; 166 std::vector<double> getDFRQ() { return DFRQ ; } ; 167 std::vector<std::string> getSIDBD() { return SIDBD ; } ; 168 std::vector<int> getREFN() { return REFN ; } ; 169 std::vector<int> getIPINT() { return IPINT ; } ; 170 std::vector<int> getMULTN() { return MULTN ; } ; 171 std::vector<double> getMLTSCF() { return MLTSCF ; } ; 172 std::vector<std::string> getLAGWIND() { return LAGWIND ; } ; 173 std::vector<double> getBEBW() { return BEBW ; } ; 174 std::vector<double> getBERES() { return BERES ; } ; 175 std::vector<double> getCHWID() { return CHWID ; } ; 176 std::vector<int> getARRY() { return ARRY ; } ; 177 std::vector<int> getNFCAL() { return NFCAL ; } ; 178 std::vector<double> getF0CAL() { return F0CAL ; } ; 179 std::vector< std::vector<double> > getFQCAL() { return FQCAL ; } ; 180 std::vector< std::vector<double> > getCHCAL() { return CHCAL ; } ; 181 std::vector< std::vector<double> > getCWCAL() { return CWCAL ; } ; 182 std::string getCDMY1() { return CDMY1 ; } ; 183 std::vector<double> getDSBFC() { return DSBFC ;} ; 187 184 int getDataSize() { return datasize_ ; } ; 188 185 int getRowNum() { return rowNum_ ; } ; … … 190 187 // get various parameters 191 188 NRODataRecord *getRecord( int i ) ; 192 virtual vector<vector<double> > getSpectrum() ;193 virtual vector<double> getSpectrum( int i ) ;189 virtual std::vector< std::vector<double> > getSpectrum() ; 190 virtual std::vector<double> getSpectrum( int i ) ; 194 191 virtual int getIndex( int irow ) ; 195 192 virtual int getPolarizationNum() ; 196 virtual vector<double> getStartIntTime() ;193 virtual std::vector<double> getStartIntTime() ; 197 194 virtual double getStartIntTime( int i ) ; 198 195 virtual double getScanTime( int i ) ; 199 196 virtual double getMJD( char *time ) ; 200 virtual vector<bool> getIFs() ;201 virtual vector<double> getFrequencies( int i ) ;202 virtual uInt getArrayId( st ring type ) ;197 virtual std::vector<bool> getIFs() ; 198 virtual std::vector<double> getFrequencies( int i ) ; 199 virtual uInt getArrayId( std::string type ) ; 203 200 virtual uInt getPolNo( int irow ) ; 204 201 … … 241 238 242 239 // POLNO from RX 243 uInt polNoFromRX( const char *rx ) ; 240 //uInt polNoFromRX( const char *rx ) ; 241 uInt polNoFromRX( const std::string &rx ) ; 244 242 245 243 // Type of file record 246 st ring LOFIL ;244 std::string LOFIL ; 247 245 248 246 // Version 249 st ring VER ;247 std::string VER ; 250 248 251 249 // Group name 252 st ring GROUP ;250 std::string GROUP ; 253 251 254 252 // Project name 255 st ring PROJ ;253 std::string PROJ ; 256 254 257 255 // Name of observation scheduling file 258 st ring SCHED ;256 std::string SCHED ; 259 257 260 258 // Name of observer 261 st ring OBSVR ;259 std::string OBSVR ; 262 260 263 261 // Observation start time with format of "YYYYMMDDHHMMSS" (UTC) 264 st ring LOSTM ;262 std::string LOSTM ; 265 263 266 264 // observation end time with format of "YYYYMMDDHHMMSS" (UTC) 267 st ring LOETM ;265 std::string LOETM ; 268 266 269 267 // Number of arrays (beams and IFs) … … 274 272 275 273 // Title of observation 276 st ring TITLE ;274 std::string TITLE ; 277 275 278 276 // Name of target object 279 st ring OBJ ;277 std::string OBJ ; 280 278 281 279 // Equinox (B1950 or J2000) 282 st ring EPOCH ;280 std::string EPOCH ; 283 281 284 282 // Right ascension [rad] … … 301 299 302 300 // Scan sequence pattern 303 st ring SCMOD ;301 std::string SCMOD ; 304 302 305 303 // User-defined recessional velocity [m/s] … … 307 305 308 306 // Reference frame for recessional velocity (LSR or HEL or GAL) 309 st ring VREF ;307 std::string VREF ; 310 308 311 309 // Definition of recessional velocity (RAD or OPT) 312 st ring VDEF ;310 std::string VDEF ; 313 311 314 312 // Switching mode (POS or BEAM or FREQ) 315 st ring SWMOD ;313 std::string SWMOD ; 316 314 317 315 // Switching frequency [Hz] … … 340 338 341 339 // Comet: Time of the perihelion passage 342 st ring CMTTM ;340 std::string CMTTM ; 343 341 344 342 // Correction for position of subreflector DX [mm] … … 391 389 392 390 // Site (antenna) name (45m or ASTE) 393 st ring SITE ;391 std::string SITE ; 394 392 395 393 // Dummy data 396 st ring CDMY1 ;394 std::string CDMY1 ; 397 395 398 396 // Type of detector frontend 399 vector<string> RX ;397 std::vector<std::string> RX ; 400 398 401 399 // HPBW [rad] 402 vector<double> HPBW ;400 std::vector<double> HPBW ; 403 401 404 402 // Aperture efficiencies 405 vector<double> EFFA ;403 std::vector<double> EFFA ; 406 404 407 405 // Beam efficiencies 408 vector<double> EFFB ;406 std::vector<double> EFFB ; 409 407 410 408 // Antenna efficiencies 411 vector<double> EFFL ;409 std::vector<double> EFFL ; 412 410 413 411 // FSS efficiencies 414 vector<double> EFSS ;412 std::vector<double> EFSS ; 415 413 416 414 // Antenna gain 417 vector<double> GAIN ;415 std::vector<double> GAIN ; 418 416 419 417 // Type of polarization at feed horn (R or L or H or V) 420 vector<string> HORN ;418 std::vector<std::string> HORN ; 421 419 422 420 // Type of polarization (CIRC or LINR) 423 vector<string> POLTP ;421 std::vector<std::string> POLTP ; 424 422 425 423 // Rotation direction of circular polarization 426 vector<double> POLDR ;424 std::vector<double> POLDR ; 427 425 428 426 // Polarization angle of linear polarization 429 vector<double> POLAN ;427 std::vector<double> POLAN ; 430 428 431 429 // Switching frequency of frequcency switching [Hz] 432 vector<double> DFRQ ;430 std::vector<double> DFRQ ; 433 431 434 432 // Type of sideband (LSB or USB or DSB) 435 vector<string> SIDBD ;433 std::vector<std::string> SIDBD ; 436 434 437 435 // Identifier of reference synthesizer 438 vector<int> REFN ;436 std::vector<int> REFN ; 439 437 440 438 // Temperature of calibrator 441 vector<int> IPINT ;439 std::vector<int> IPINT ; 442 440 443 441 // Beam id of the multi-beam detector 444 vector<int> MULTN ;442 std::vector<int> MULTN ; 445 443 446 444 // Scaling factor of the multi-beam detector 447 vector<double> MLTSCF ;445 std::vector<double> MLTSCF ; 448 446 449 447 // Type of LAG window (NONE or HANN or HAMM or BLCK) 450 vector<string> LAGWIND ;448 std::vector<std::string> LAGWIND ; 451 449 452 450 // Bandwidth at backend 453 vector<double> BEBW ;451 std::vector<double> BEBW ; 454 452 455 453 // Spectral resolution at backend 456 vector<double> BERES ;454 std::vector<double> BERES ; 457 455 458 456 // Channel width at backend 459 vector<double> CHWID ;457 std::vector<double> CHWID ; 460 458 461 459 // Array usage (1: used 0: not used) 462 vector<int> ARRY ;460 std::vector<int> ARRY ; 463 461 464 462 // Frequency calibration: Number of measurement (max 10) 465 vector<int> NFCAL ;463 std::vector<int> NFCAL ; 466 464 467 465 // Frequency calibration: Central frequency [Hz] 468 vector<double> F0CAL ;466 std::vector<double> F0CAL ; 469 467 470 468 // Frequency calibration: Measured central frequency [Hz] 471 vector<vector<double> > FQCAL ;469 std::vector< std::vector<double> > FQCAL ; 472 470 473 471 // Frequency calibration: Measured channel number 474 vector<vector<double> > CHCAL ;472 std::vector< std::vector<double> > CHCAL ; 475 473 476 474 // Frequency calibration: Measured channel width [Hz] 477 vector<vector<double> > CWCAL ;475 std::vector< std::vector<double> > CWCAL ; 478 476 479 477 // DSB scaling factor 480 vector<double> DSBFC ;478 std::vector<double> DSBFC ; 481 479 482 480 // number of scan … … 505 503 506 504 // input filename 507 st ring filename_ ;505 std::string filename_ ; 508 506 509 507 // file pointer … … 517 515 518 516 // reference frequency for each array 519 vector<double> refFreq_ ;517 std::vector<double> refFreq_ ; 520 518 521 519 // record to store REFPIX, REFVAL, INCREMENT pair for each array … … 524 522 525 523 // debug message output 526 template<class T> inline void nro_debug_output( char *name, int len, vector<T> &val )524 template<class T> inline void nro_debug_output( char *name, int len, std::vector<T> &val ) 527 525 { 528 526 for ( int i = 0 ; i < len ; i++ ) { … … 538 536 } 539 537 540 template<class T> inline void nro_debug_output( char *name, int len1, int len2, vector<vector<T> > &val )538 template<class T> inline void nro_debug_output( char *name, int len1, int len2, std::vector< std::vector<T> > &val ) 541 539 { 542 540 for ( int i = 0 ; i < len1 ; i++ ) {
Note:
See TracChangeset
for help on using the changeset viewer.