Changeset 2748 for trunk


Ignore:
Timestamp:
01/23/13 19:48:24 (12 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

POLNO is properly set according to RX name. When RX name ends with 'V'
or is 'H20ch2', POLNO will be set to 1. Otherwise, POLNO is 0.


Location:
trunk/external-alma/atnf/PKSIO
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/external-alma/atnf/PKSIO/NRODataset.cc

    r2643 r2748  
    3333#include <atnf/PKSIO/NRODataset.h>
    3434#include <casa/OS/Time.h>
     35#include <casa/Utilities/Regex.h>
    3536#include <scimath/Mathematics/InterpolateArray1D.h>
    3637
     
    377378    LogIO os( LogOrigin("NRODataset","getSpectrum",WHERE) ) ;
    378379    os << LogIO::WARN << "zero spectrum for row " << i << LogIO::POST ;
    379     if ( spec.size() != nchan )
     380    if ( spec.size() != (unsigned int)nchan )
    380381      spec.resize( nchan ) ;
    381382    for ( vector<double>::iterator i = spec.begin() ;
     
    418419      LogIO os( LogOrigin( "NRODataset", "getSpectrum", WHERE ) ) ;
    419420      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 )
    421422        spec.resize( nchan ) ;
    422423      for ( vector<double>::iterator i = spec.begin() ;
     
    840841//   cout << "HORN[" << idx << "]=" << HORN[idx]
    841842//        << ", 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
     846uInt NRODataset::polNoFromRX( const string &rx )
    846847{
    847848  uInt polno = 0 ;
    848   // 2012/03/15 TN
    849   // T100H/V is multi-polarization receiver which is installed
    850   // 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:
    851852  //
    852   //    POLNO=0: T100H
    853   //          1: T100V
     853  //    xxxH for horizontal component,
     854  //    xxxV for vertical component.
    854855  //
    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  }
    858871  return polno ;
    859872}
  • trunk/external-alma/atnf/PKSIO/NRODataset.h

    r2436 r2748  
    4848#define SCAN_HEADER_SIZE 424
    4949
    50 
    51 using namespace std ;
    52 
    5350// <summary>
    5451// Base class for NRO accessor classes.
     
    8582 public:
    8683  // Constructor
    87   NRODataset( string name ) ;
     84  NRODataset( std::string name ) ;
    8885
    8986  // Destructor
     
    106103
    107104  // simple getter
    108   string getLOFIL() { return LOFIL ; } ;
    109   string getVER() { return VER ; } ;
    110   string getGROUP() { return GROUP ; } ;
    111   string getPROJ() { return PROJ ; } ;
    112   string getSCHED() { return SCHED ; } ;
    113   string getOBSVR() { return OBSVR ; } ;
    114   string getLOSTM() { return LOSTM ; } ;
    115   string 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 ; } ;
    116113  int getARYNM() { return ARYNM ; } ;
    117114  int getNSCAN() { return NSCAN ; } ;
    118   string getTITLE() { return TITLE ; } ;
    119   string getOBJ() { return OBJ ; } ;
    120   string getEPOCH() { return EPOCH ; } ;
     115  std::string getTITLE() { return TITLE ; } ;
     116  std::string getOBJ() { return OBJ ; } ;
     117  std::string getEPOCH() { return EPOCH ; } ;
    121118  double getRA0() { return RA0 ; } ;
    122119  double getDEC0() { return DEC0 ; } ;
     
    125122  int getNCALB() { return NCALB ; } ;
    126123  int getSCNCD() { return SCNCD ; } ;
    127   string getSCMOD() { return SCMOD ; } ;
     124  std::string getSCMOD() { return SCMOD ; } ;
    128125  double getURVEL() { return URVEL ; } ;
    129   string getVREF() { return VREF ; } ;
    130   string getVDEF() { return VDEF ; } ;
    131   string getSWMOD() { return SWMOD ; } ;
     126  std::string getVREF() { return VREF ; } ;
     127  std::string getVDEF() { return VDEF ; } ;
     128  std::string getSWMOD() { return SWMOD ; } ;
    132129  double getFRQSW() { return FRQSW ; } ;   
    133130  double getDBEAM() { return DBEAM ; } ;   
     
    138135  double getCMTNODE() { return CMTNODE ; } ;
    139136  double getCMTI() { return CMTI ; } ;
    140   string getCMTTM() { return CMTTM ; } ;
     137  std::string getCMTTM() { return CMTTM ; } ;
    141138  double getSBDX() { return SBDX ; } ;
    142139  double getSBDY() { return SBDY ; } ;
     
    155152  int getSBIND() { return SBIND ; } ;
    156153  int getIBIT() { return IBIT ; } ;
    157   string 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   string 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 ;} ;
    187184  int getDataSize() { return datasize_ ; } ;
    188185  int getRowNum() { return rowNum_ ; } ;
     
    190187  // get various parameters
    191188  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 ) ;
    194191  virtual int getIndex( int irow ) ;
    195192  virtual int getPolarizationNum() ;
    196   virtual vector<double> getStartIntTime() ;
     193  virtual std::vector<double> getStartIntTime() ;
    197194  virtual double getStartIntTime( int i ) ;
    198195  virtual double getScanTime( int i ) ;
    199196  virtual double getMJD( char *time ) ;
    200   virtual vector<bool> getIFs() ;
    201   virtual vector<double> getFrequencies( int i ) ;
    202   virtual uInt getArrayId( string type ) ;
     197  virtual std::vector<bool> getIFs() ;
     198  virtual std::vector<double> getFrequencies( int i ) ;
     199  virtual uInt getArrayId( std::string type ) ;
    203200  virtual uInt getPolNo( int irow ) ;
    204201
     
    241238
    242239  // POLNO from RX
    243   uInt polNoFromRX( const char *rx ) ;
     240  //uInt polNoFromRX( const char *rx ) ;
     241  uInt polNoFromRX( const std::string &rx ) ;
    244242
    245243  // Type of file record
    246   string LOFIL ;
     244  std::string LOFIL ;
    247245
    248246  // Version
    249   string VER ;
     247  std::string VER ;
    250248
    251249  // Group name
    252   string GROUP ;
     250  std::string GROUP ;
    253251
    254252  // Project name
    255   string PROJ ;
     253  std::string PROJ ;
    256254
    257255  // Name of observation scheduling file
    258   string SCHED ;
     256  std::string SCHED ;
    259257
    260258  // Name of observer
    261   string OBSVR ;
     259  std::string OBSVR ;
    262260
    263261  // Observation start time with format of "YYYYMMDDHHMMSS" (UTC)
    264   string LOSTM ;
     262  std::string LOSTM ;
    265263
    266264  // observation end time with format of "YYYYMMDDHHMMSS" (UTC)
    267   string LOETM ;
     265  std::string LOETM ;
    268266
    269267  // Number of arrays (beams and IFs)
     
    274272
    275273  // Title of observation
    276   string TITLE ;
     274  std::string TITLE ;
    277275
    278276  // Name of target object
    279   string OBJ ;
     277  std::string OBJ ;
    280278
    281279  // Equinox (B1950 or J2000)
    282   string EPOCH ;
     280  std::string EPOCH ;
    283281
    284282  // Right ascension [rad]
     
    301299
    302300  // Scan sequence pattern
    303   string SCMOD ;
     301  std::string SCMOD ;
    304302
    305303  // User-defined recessional velocity [m/s]
     
    307305
    308306  // Reference frame for recessional velocity  (LSR or HEL or GAL)
    309   string VREF ;
     307  std::string VREF ;
    310308
    311309  // Definition of recessional velocity  (RAD or OPT)
    312   string VDEF ;
     310  std::string VDEF ;
    313311
    314312  // Switching mode  (POS or BEAM or FREQ)
    315   string SWMOD ;
     313  std::string SWMOD ;
    316314
    317315  // Switching frequency [Hz]
     
    340338
    341339  // Comet: Time of the perihelion passage
    342   string CMTTM ;
     340  std::string CMTTM ;
    343341
    344342  // Correction for position of subreflector DX [mm]
     
    391389
    392390  // Site (antenna) name  (45m or ASTE)
    393   string SITE ;
     391  std::string SITE ;
    394392
    395393  // Dummy data
    396   string CDMY1 ;
     394  std::string CDMY1 ;
    397395
    398396  // Type of detector frontend
    399   vector<string> RX ;
     397  std::vector<std::string> RX ;
    400398
    401399  // HPBW [rad]
    402   vector<double> HPBW ;
     400  std::vector<double> HPBW ;
    403401
    404402  // Aperture efficiencies
    405   vector<double> EFFA ;
     403  std::vector<double> EFFA ;
    406404
    407405  // Beam efficiencies
    408   vector<double> EFFB ;
     406  std::vector<double> EFFB ;
    409407
    410408  // Antenna efficiencies
    411   vector<double> EFFL ;
     409  std::vector<double> EFFL ;
    412410
    413411  // FSS efficiencies
    414   vector<double> EFSS ;
     412  std::vector<double> EFSS ;
    415413
    416414  // Antenna gain
    417   vector<double> GAIN ;
     415  std::vector<double> GAIN ;
    418416
    419417  // Type of polarization at feed horn  (R or L or H or V)
    420   vector<string> HORN ;
     418  std::vector<std::string> HORN ;
    421419
    422420  // Type of polarization  (CIRC or LINR)
    423   vector<string> POLTP ;
     421  std::vector<std::string> POLTP ;
    424422
    425423  // Rotation direction of circular polarization
    426   vector<double> POLDR ;
     424  std::vector<double> POLDR ;
    427425
    428426  // Polarization angle of linear polarization
    429   vector<double> POLAN ;
     427  std::vector<double> POLAN ;
    430428
    431429  // Switching frequency of frequcency switching [Hz]
    432   vector<double> DFRQ ;
     430  std::vector<double> DFRQ ;
    433431
    434432  // Type of sideband  (LSB or USB or DSB)
    435   vector<string> SIDBD ;
     433  std::vector<std::string> SIDBD ;
    436434
    437435  // Identifier of reference synthesizer
    438   vector<int> REFN ;
     436  std::vector<int> REFN ;
    439437
    440438  // Temperature of calibrator
    441   vector<int> IPINT ;
     439  std::vector<int> IPINT ;
    442440
    443441  // Beam id of the multi-beam detector
    444   vector<int> MULTN ;
     442  std::vector<int> MULTN ;
    445443
    446444  // Scaling factor of the multi-beam detector
    447   vector<double> MLTSCF ;
     445  std::vector<double> MLTSCF ;
    448446
    449447  // Type of LAG window  (NONE or HANN or HAMM or BLCK)
    450   vector<string> LAGWIND ;
     448  std::vector<std::string> LAGWIND ;
    451449
    452450  // Bandwidth at backend
    453   vector<double> BEBW ;
     451  std::vector<double> BEBW ;
    454452
    455453  // Spectral resolution at backend
    456   vector<double> BERES ;
     454  std::vector<double> BERES ;
    457455
    458456  // Channel width at backend
    459   vector<double> CHWID ;
     457  std::vector<double> CHWID ;
    460458
    461459  // Array usage  (1: used  0: not used)
    462   vector<int> ARRY ;
     460  std::vector<int> ARRY ;
    463461
    464462  // Frequency calibration: Number of measurement (max 10)
    465   vector<int> NFCAL ;
     463  std::vector<int> NFCAL ;
    466464
    467465  // Frequency calibration: Central frequency [Hz]
    468   vector<double> F0CAL ;
     466  std::vector<double> F0CAL ;
    469467
    470468  // Frequency calibration: Measured central frequency [Hz]
    471   vector< vector<double> > FQCAL ;
     469  std::vector< std::vector<double> > FQCAL ;
    472470
    473471  // Frequency calibration: Measured channel number
    474   vector< vector<double> > CHCAL ;
     472  std::vector< std::vector<double> > CHCAL ;
    475473
    476474  // Frequency calibration: Measured channel width [Hz]
    477   vector< vector<double> > CWCAL ;
     475  std::vector< std::vector<double> > CWCAL ;
    478476
    479477  // DSB scaling factor
    480   vector<double> DSBFC ;
     478  std::vector<double> DSBFC ;
    481479
    482480  // number of scan
     
    505503
    506504  // input filename
    507   string filename_ ;
     505  std::string filename_ ;
    508506
    509507  // file pointer
     
    517515
    518516  // reference frequency for each array
    519   vector<double> refFreq_ ;
     517  std::vector<double> refFreq_ ;
    520518
    521519  // record to store REFPIX, REFVAL, INCREMENT pair for each array
     
    524522
    525523// debug message output
    526 template<class T> inline void nro_debug_output( char *name, int len, vector<T> &val )
     524template<class T> inline void nro_debug_output( char *name, int len, std::vector<T> &val )
    527525{
    528526  for ( int i = 0 ; i < len ; i++ ) {
     
    538536}
    539537
    540 template<class T> inline void nro_debug_output( char *name, int len1, int len2, vector< vector<T> > &val )
     538template<class T> inline void nro_debug_output( char *name, int len1, int len2, std::vector< std::vector<T> > &val )
    541539{
    542540  for ( int i = 0 ; i < len1 ; i++ ) {
Note: See TracChangeset for help on using the changeset viewer.