Changeset 2026 for trunk


Ignore:
Timestamp:
03/02/11 17:40:42 (14 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-2718

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...

  1. Fill MOUNT and DISH_DIAMETER columns in ANTENNA subtable.
  2. Commented out messages for debugging and tuning.
Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/MSWriter.cpp

    r2022 r2026  
    4242#include <sys/time.h>
    4343
    44 // Boost
    45 #include <boost/pool/object_pool.hpp>
    46 
    4744using namespace casa ;
    4845using namespace std ;
     
    6663  os_ = LogIO() ;
    6764  os_.origin( LogOrigin( "MSWriter", "MSWriter()", WHERE ) ) ;
    68   os_ << "MSWriter::MSWriter()" << LogIO::POST ;
     65//   os_ << "MSWriter::MSWriter()" << LogIO::POST ;
    6966
    7067  // initialize writer
     
    7572{
    7673  os_.origin( LogOrigin( "MSWriter", "~MSWriter()", WHERE ) ) ;
    77   os_ << "MSWriter::~MSWriter()" << LogIO::POST ;
     74//   os_ << "MSWriter::~MSWriter()" << LogIO::POST ;
    7875
    7976  if ( mstable_ != 0 )
     
    8481{
    8582  os_.origin( LogOrigin( "MSWriter", "write()", WHERE ) ) ;
    86   double startSec = gettimeofday_sec() ;
    87   os_ << "start MSWriter::write() startSec=" << startSec << LogIO::POST ;
     83//   double startSec = gettimeofday_sec() ;
     84//   os_ << "start MSWriter::write() startSec=" << startSec << LogIO::POST ;
    8885
    8986  filename_ = filename ;
     
    114111    }
    115112  }
    116 
    117   // TEST
    118   // memory allocation by boost::object_pool
    119 //   boost::object_pool<ROTableColumn> *tpoolr = new boost::object_pool<ROTableColumn> ;
    120 //   ROTableColumn *tcol = 0 ;
    121   //
    122113
    123114  // set up MS
     
    197188    ROTableColumn sharedCol( t0, "FIELDNAME" ) ;
    198189    String fieldName = sharedCol.asString( 0 ) ;
    199 //     tcol = tpoolr->construct( t0, "FIELDNAME" ) ;
    200 //     String fieldName = tcol->asString( 0 ) ;
    201 //     tpoolr->destroy( tcol ) ;
    202190    sharedCol.attach( t0, "SRCNAME" ) ;
    203191    String srcName = sharedCol.asString( 0 ) ;
    204 //     tcol = tpoolr->construct( t0, "SRCNAME" ) ;
    205 //     String srcName = tcol->asString( 0 ) ;
    206 //     tpoolr->destroy( tcol ) ;
    207192    sharedCol.attach( t0, "TIME" ) ;
    208193    Double minTime = (Double)sharedCol.asdouble( 0 ) * 86400.0 ; // day->sec
    209 //     tcol = tpoolr->construct( t0, "TIME" ) ;
    210 //     Double minTime = (Double)(tcol->asdouble( 0 )) * 86400.0 ; // day -> sec
    211 //     tpoolr->destroy( tcol ) ;
    212194    ROArrayColumn<Double> scanRateCol( t0, "SCANRATE" ) ;
    213     //Vector<Double> scanRate = scanRateCol.getColumn()[0] ;
    214195    Vector<Double> scanRate = scanRateCol( 0 ) ;
    215196    String::size_type pos = fieldName.find( "__" ) ;
    216197    Int fieldId = -1 ;
    217198    if ( pos != String::npos ) {
    218       os_ << "fieldName.substr( pos+2 )=" << fieldName.substr( pos+2 ) << LogIO::POST ;
     199//       os_ << "fieldName.substr( pos+2 )=" << fieldName.substr( pos+2 ) << LogIO::POST ;
    219200      fieldId = String::toInt( fieldName.substr( pos+2 ) ) ;
    220201      fieldName = fieldName.substr( 0, pos ) ;
    221202    }
    222203    else {
    223       os_ << "use default field id" << LogIO::POST ;
     204//       os_ << "use default field id" << LogIO::POST ;
    224205      fieldId = defaultFieldId ;
    225206      defaultFieldId++ ;
    226207    }
    227     os_ << "fieldId" << fieldId << ": " << fieldName << LogIO::POST ;
     208//     os_ << "fieldId" << fieldId << ": " << fieldName << LogIO::POST ;
    228209
    229210    // FIELD_ID
     
    237218    while( !iter1.pastEnd() ) {
    238219      Table t1 = iter1.table() ;
    239 //       tcol = tpoolr->construct( t1, "BEAMNO" ) ;
    240 //       uInt beamNo = tcol->asuInt( 0 ) ;
    241 //       tpoolr->destroy( tcol ) ;
    242220      sharedCol.attach( t1, "BEAMNO" ) ;
    243221      uInt beamNo = sharedCol.asuInt( 0 ) ;
    244       os_ << "beamNo = " << beamNo << LogIO::POST ;
     222//       os_ << "beamNo = " << beamNo << LogIO::POST ;
    245223
    246224      // FEED1 and FEED2
     
    256234      while( !iter2.pastEnd() ) {
    257235        Table t2 = iter2.table() ;
    258 //         tcol = tpoolr->construct( t2, "SCANNO" ) ;
    259 //         uInt scanNo = tcol->asuInt( 0 ) ;
    260 //         tpoolr->destroy( tcol ) ;
    261236        sharedCol.attach( t2, "SCANNO" ) ;
    262237        uInt scanNo = sharedCol.asuInt( 0 ) ;
    263         os_ << "scanNo = " << scanNo << LogIO::POST ;
     238//         os_ << "scanNo = " << scanNo << LogIO::POST ;
    264239
    265240        // SCAN_NUMBER
     
    275250        while( !iter3.pastEnd() ) {
    276251          Table t3 = iter3.table() ;
    277 //           tcol = tpoolr->construct( t3, "IFNO" ) ;
    278 //           uInt ifNo = tcol->asuInt( 0 ) ;
    279 //           tpoolr->destroy( tcol ) ;
    280252          sharedCol.attach( t3, "IFNO" ) ;
    281253          uInt ifNo = sharedCol.asuInt( 0 ) ;
    282           os_ << "ifNo = " << ifNo << LogIO::POST ;
    283 //           tcol = tpoolr->construct( t3, "FREQ_ID" ) ;
    284 //           uInt freqId = tcol->asuInt( 0 ) ;
    285 //           tpoolr->destroy( tcol ) ;
     254//           os_ << "ifNo = " << ifNo << LogIO::POST ;
    286255          sharedCol.attach( t3, "FREQ_ID" ) ;
    287256          uInt freqId = sharedCol.asuInt( 0 ) ;
    288           os_ << "freqId = " << freqId << LogIO::POST ;
     257//           os_ << "freqId = " << freqId << LogIO::POST ;
    289258          Int subscan = 1 ; // 1-base
    290259          //
     
    294263          while( !iter4.pastEnd() ) {
    295264            Table t4 = iter4.table() ;
    296 //             tcol = tpoolr->construct( t4, "SRCTYPE" ) ;
    297 //             uInt srcType = tcol->asInt( 0 ) ;
    298 //             tpoolr->destroy( tcol ) ;
    299265            sharedCol.attach( t4, "SRCTYPE" ) ;
    300266            Int srcType = sharedCol.asInt( 0 ) ;
     
    313279              //uInt cycleNo = sharedCol.asuInt( 0 ) ;
    314280              Int nrow = t5.nrow() ;
    315               os_ << "nrow = " << nrow << LogIO::POST ;
     281//               os_ << "nrow = " << nrow << LogIO::POST ;
    316282             
    317283              Vector<Int> polnos( nrow ) ;
    318284              indgen( polnos, 0 ) ;
    319285              Int polid = addPolarization( polnos ) ;
    320               os_ << "polid = " << polid << LogIO::POST ;
     286//               os_ << "polid = " << polid << LogIO::POST ;
    321287             
    322288              // DATA/FLOAT_DATA
     
    335301                  convertArray( tmpB, flagCol( ipol ) ) ;
    336302                }
    337                 //*(*((RecordFieldPtr< Array<Float> > *)dataRF)) = dataArr ;
    338303                ((RecordFieldPtr< Array<Float> > *)dataRF)->define( dataArr ) ;
    339304               
    340305                // FLAG
    341                 //*flagRF = flagArr ;
    342306                flagRF.define( flagArr ) ;
    343307              }
     
    357321                dataArr.row( 1 ) = RealToComplex( dummy ) ;
    358322                dataArr.row( 2 ) = conj( dataArr.row( 1 ) ) ;
    359                 //*(*((RecordFieldPtr< Array<Complex> > *)dataRF)) = dataArr ;
    360323                ((RecordFieldPtr< Array<Complex> > *)dataRF)->define( dataArr ) ;
    361324               
     
    371334                convertArray( tmpB, ( flagCol( 2 ) | flagCol( 3 ) ) ) ;
    372335                flagArr.row( 2 ) = flagArr.row( 1 ) ;
    373                 //*flagRF = flagArr ;
    374336                flagRF.define( flagArr ) ;
    375337              }
    376338
    377339              // FLAG_ROW
    378 //               tcol = tpoolr->construct( t5, "FLAGROW" ) ;
    379340              sharedCol.attach( t5, "FLAGROW" ) ;
    380341              Vector<uInt> flagRowArr( nrow ) ;
    381342              for ( Int irow = 0 ; irow < nrow ; irow++ )
    382343                flagRowArr[irow] = sharedCol.asuInt( irow ) ;
    383 //                 flagRowArr[irow] = tcol->asuInt( irow ) ;
    384 //               tpoolr->destroy( tcol ) ;
    385344              *flagrowRF = anyNE( flagRowArr, (uInt)0 ) ;
    386345
    387346              // TIME and TIME_CENTROID
    388 //               tcol = tpoolr->construct( t5, "TIME" ) ;
    389 //               Double mTimeV = (Double)(tcol->asdouble(0)) * 86400.0 ; // day->sec
    390 //               tpoolr->destroy( tcol ) ;
    391347              sharedCol.attach( t5, "TIME" ) ;
    392348              Double mTimeV = (Double)sharedCol.asdouble( 0 ) * 86400.0 ; // day -> sec
     
    395351
    396352              // INTERVAL and EXPOSURE
    397 //               tcol = tpoolr->construct( t5, "INTERVAL" ) ;
    398 //               Double interval = (Double)(tcol->asdouble( 0 )) ;
    399 //               tpoolr->destroy( tcol ) ;
    400353              sharedCol.attach( t5, "INTERVAL" ) ;
    401354              Double interval = (Double)sharedCol.asdouble( 0 ) ;
     
    406359              // always 1 at the moment
    407360              Vector<Float> wArr( nrow, 1.0 ) ;
    408 //               *weightRF = wArr ;
    409 //               *sigmaRF = wArr ;
    410361              weightRF.define( wArr ) ;
    411362              sigmaRF.define( wArr ) ;
     
    413364              // add DATA_DESCRIPTION row
    414365              Int ddid = addDataDescription( polid, ifNo ) ;
    415               os_ << "ddid = " << ddid << LogIO::POST ;
     366//               os_ << "ddid = " << ddid << LogIO::POST ;
    416367              *ddidRF = ddid ;
    417368             
    418369              // for SYSCAL table
    419 //               tcol = tpoolr->construct( t5, "TCAL_ID" ) ;
    420370              sharedCol.attach( t5, "TCAL_ID" ) ;
    421371              Vector<uInt> tcalIdArr( nrow ) ;
    422372              for ( Int irow = 0 ; irow < nrow ; irow++ )
    423373                tcalIdArr[irow] = sharedCol.asuInt( irow ) ;
    424 //                 tcalIdArr[irow] = tcol->asuInt( irow ) ;
    425 //               tpoolr->destroy( tcol ) ;
    426               os_ << "tcalIdArr = " << tcalIdArr << LogIO::POST ;
     374//               os_ << "tcalIdArr = " << tcalIdArr << LogIO::POST ;
    427375              String key = String::toString( tcalIdArr[0] ) ;
    428376              if ( !tcalIdRec_.isDefined( key ) ) {
     
    434382                tcalRowRec_.define( key, concatenateArray( pastrows, t5.rowNumbers() ) ) ;
    435383              }
    436              
    437               // fill STATE_ID
    438               //ROScalarColumn<Int> srcTypeCol( t5, "SRCTYPE" ) ;
    439               //Int srcType = srcTypeCol( 0 ) ;
    440               //Int stateId = addState( srcType, subscan ) ;
    441               //*stateidRF = stateId ;
    442              
     384                           
    443385              // for POINTING table
    444386              if ( ptTabName_ == "" ) {
     
    457399             
    458400              // FLAG_CATEGORY is tentatively set
    459               //*flagcatRF = Cube<Bool>( nrow, nchan, 1, False ) ;
    460401              flagcatRF.define( Cube<Bool>( nrow, nchan, 1, False ) ) ;
    461402             
     
    529470  }
    530471
    531   double endSec = gettimeofday_sec() ;
    532   os_ << "end MSWriter::write() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     472//   double endSec = gettimeofday_sec() ;
     473//   os_ << "end MSWriter::write() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    533474
    534475  return True ;
     
    538479{
    539480//   os_.origin( LogOrigin( "MSWriter", "init()", WHERE ) ) ;
    540   double startSec = gettimeofday_sec() ;
    541   os_ << "start MSWriter::init() startSec=" << startSec << LogIO::POST ;
     481//   double startSec = gettimeofday_sec() ;
     482//   os_ << "start MSWriter::init() startSec=" << startSec << LogIO::POST ;
    542483 
    543484  // access to scantable
     
    573514    ROTableColumn col( table_->tcal().table(), "TCAL" ) ;
    574515    if ( col.isDefined( 0 ) ) {
    575       os_ << "nrow=" << table_->tcal().table().nrow() << ": TCAL table exists" << LogIO::POST ;
     516      os_ << "TCAL table exists: nrow=" << table_->tcal().table().nrow() << LogIO::POST ;
    576517      isTcal_ = True ;
    577518    }
    578519    else {
    579       os_ << "no TCAL rows" << LogIO::POST ;
     520      os_ << "No TCAL rows" << LogIO::POST ;
    580521    }
    581522  }
    582523  else {
    583     os_ << "no TCAL rows" << LogIO::POST ;
     524    os_ << "No TCAL rows" << LogIO::POST ;
    584525  }
    585526  if ( table_->weather().table().nrow() != 0 ) {
    586527    ROTableColumn col( table_->weather().table(), "TEMPERATURE" ) ;
    587528    if ( col.isDefined( 0 ) ) {
    588       os_ << "nrow=" << table_->weather().table().nrow() << ": WEATHER table exists" << LogIO::POST ;
     529      os_ << "WEATHER table exists: nrow=" << table_->weather().table().nrow() << LogIO::POST ;
    589530      isWeather_ =True ;
    590531    }
    591532    else {
    592       os_ << "no WEATHER rows" << LogIO::POST ;
     533      os_ << "No WEATHER rows" << LogIO::POST ;
    593534    }
    594535  }
    595536  else {
    596     os_ << "no WEATHER rows" << LogIO::POST ;
     537    os_ << "No WEATHER rows" << LogIO::POST ;
    597538  }
    598539
     
    630571  }
    631572
    632   double endSec = gettimeofday_sec() ;
    633   os_ << "end MSWriter::init() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     573//   double endSec = gettimeofday_sec() ;
     574//   os_ << "end MSWriter::init() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    634575}
    635576
     
    637578{
    638579//   os_.origin( LogOrigin( "MSWriter", "setupMS()", WHERE ) ) ;
    639   double startSec = gettimeofday_sec() ;
    640   os_ << "start MSWriter::setupMS() startSec=" << startSec << LogIO::POST ;
     580//   double startSec = gettimeofday_sec() ;
     581//   os_ << "start MSWriter::setupMS() startSec=" << startSec << LogIO::POST ;
    641582
    642583  TableDesc msDesc = MeasurementSet::requiredTableDesc() ;
     
    736677  mstable_->initRefs() ;
    737678
    738   double endSec = gettimeofday_sec() ;
    739   os_ << "end MSWriter::setupMS() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     679//   double endSec = gettimeofday_sec() ;
     680//   os_ << "end MSWriter::setupMS() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    740681}
    741682
    742683void MSWriter::fillObservation()
    743684{
    744   double startSec = gettimeofday_sec() ;
    745   os_ << "start MSWriter::fillObservation() startSec=" << startSec << LogIO::POST ;
     685//   double startSec = gettimeofday_sec() ;
     686//   os_ << "start MSWriter::fillObservation() startSec=" << startSec << LogIO::POST ;
    746687
    747688  // only 1 row
     
    760701    telescopeName = hAntennaName.substr( 0, pos ) ;
    761702  }
    762   os_ << "telescopeName = " << telescopeName << LogIO::POST ;
     703//   os_ << "telescopeName = " << telescopeName << LogIO::POST ;
    763704  msObsCols.telescopeName().put( 0, telescopeName ) ;
    764705  msObsCols.project().put( 0, header_.project ) ;
     
    771712  msObsCols.timeRangeMeas().put( 0, trange ) ;
    772713
    773   double endSec = gettimeofday_sec() ;
    774   os_ << "end MSWriter::fillObservation() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     714//   double endSec = gettimeofday_sec() ;
     715//   os_ << "end MSWriter::fillObservation() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    775716}
    776717
    777718void MSWriter::fillAntenna()
    778719{
    779   double startSec = gettimeofday_sec() ;
    780   os_ << "start MSWriter::fillAntenna() startSec=" << startSec << LogIO::POST ;
     720//   double startSec = gettimeofday_sec() ;
     721//   os_ << "start MSWriter::fillAntenna() startSec=" << startSec << LogIO::POST ;
    781722
    782723  // only 1 row
     
    800741    stationName = hAntennaName ;
    801742  }
    802   os_ << "antennaName = " << antennaName << LogIO::POST ;
    803   os_ << "stationName = " << stationName << LogIO::POST ;
     743//   os_ << "antennaName = " << antennaName << LogIO::POST ;
     744//   os_ << "stationName = " << stationName << LogIO::POST ;
    804745 
    805746  msAntCols.name().put( 0, antennaName ) ;
    806747  msAntCols.station().put( 0, stationName ) ;
    807748
    808   os_ << "antennaPosition = " << header_.antennaposition << LogIO::POST ;
     749//   os_ << "antennaPosition = " << header_.antennaposition << LogIO::POST ;
    809750 
    810751  msAntCols.position().put( 0, header_.antennaposition ) ;
    811752
    812   double endSec = gettimeofday_sec() ;
    813   os_ << "end MSWriter::fillAntenna() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     753  // MOUNT is set to "ALT-AZ"
     754  msAntCols.mount().put( 0, "ALT-AZ" ) ;
     755
     756  Double diameter = getDishDiameter( antennaName ) ;
     757  msAntCols.dishDiameterQuant().put( 0, Quantity( diameter, "m" ) ) ;
     758
     759//   double endSec = gettimeofday_sec() ;
     760//   os_ << "end MSWriter::fillAntenna() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    814761}
    815762
    816763void MSWriter::fillProcessor()
    817764{
    818   double startSec = gettimeofday_sec() ;
    819   os_ << "start MSWriter::fillProcessor() startSec=" << startSec << LogIO::POST ;
     765//   double startSec = gettimeofday_sec() ;
     766//   os_ << "start MSWriter::fillProcessor() startSec=" << startSec << LogIO::POST ;
    820767 
    821768  // only add empty 1 row
     
    823770  msProc.addRow( 1, True ) ;
    824771
    825   double endSec = gettimeofday_sec() ;
    826   os_ << "end MSWriter::fillProcessor() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     772//   double endSec = gettimeofday_sec() ;
     773//   os_ << "end MSWriter::fillProcessor() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    827774}
    828775
    829776void MSWriter::fillSource()
    830777{
    831   double startSec = gettimeofday_sec() ;
    832   os_ << "start MSWriter::fillSource() startSec=" << startSec << LogIO::POST ;
     778//   double startSec = gettimeofday_sec() ;
     779//   os_ << "start MSWriter::fillSource() startSec=" << startSec << LogIO::POST ;
    833780 
    834781  // access to MS SOURCE subtable
     
    967914  }
    968915
    969   double endSec = gettimeofday_sec() ;
    970   os_ << "end MSWriter::fillSource() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     916//   double endSec = gettimeofday_sec() ;
     917//   os_ << "end MSWriter::fillSource() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    971918}
    972919
    973920void MSWriter::fillWeather()
    974921{
    975   double startSec = gettimeofday_sec() ;
    976   os_ << "start MSWriter::fillWeather() startSec=" << startSec << LogIO::POST ;
     922//   double startSec = gettimeofday_sec() ;
     923//   os_ << "start MSWriter::fillWeather() startSec=" << startSec << LogIO::POST ;
    977924
    978925  // access to MS WEATHER subtable
     
    1025972  mswCols.interval().putColumn( intervalArr ) ;
    1026973
    1027   double endSec = gettimeofday_sec() ;
    1028   os_ << "end MSWriter::fillWeather() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     974//   double endSec = gettimeofday_sec() ;
     975//   os_ << "end MSWriter::fillWeather() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    1029976}
    1030977
    1031978void MSWriter::fillSysCal()
    1032979{
    1033   double startSec = gettimeofday_sec() ;
    1034   os_ << "start MSWriter::fillSysCal() startSec=" << startSec << LogIO::POST ;
     980//   double startSec = gettimeofday_sec() ;
     981//   os_ << "start MSWriter::fillSysCal() startSec=" << startSec << LogIO::POST ;
    1035982
    1036983  //tcalIdRec_.print( cout ) ;
     
    10921039  ROTableColumn ifnoCol( tab, "IFNO" ) ;
    10931040  for ( uInt irow = 0 ; irow < nrow ; irow++ ) {
    1094     double t1 = gettimeofday_sec() ;
     1041//     double t1 = gettimeofday_sec() ;
    10951042    Vector<uInt> ids = tcalIdRec_.asArrayuInt( irow ) ;
    1096     os_ << "ids = " << ids << LogIO::POST ;
     1043//     os_ << "ids = " << ids << LogIO::POST ;
    10971044    uInt npol = ids.size() ;
    10981045    Vector<uInt> rows = tcalRowRec_.asArrayuInt( irow ) ;
    1099     os_ << "rows = " << rows << LogIO::POST ;
     1046//     os_ << "rows = " << rows << LogIO::POST ;
    11001047    Vector<Double> atime( rows.nelements() ) ;
    11011048    Vector<Double> ainterval( rows.nelements() ) ;
     
    11271074    Table t ;
    11281075    if ( idCol.asuInt( ids[0] ) == ids[0] ) {
    1129       os_ << "sorted at irow=" << irow << " ids[0]=" << ids[0] << LogIO::POST ;
     1076//       os_ << "sorted at irow=" << irow << " ids[0]=" << ids[0] << LogIO::POST ;
    11301077      Vector<Float> dummyC = tcalCol( ids[0] ) ;
    11311078      tcal.resize( npol, dummyC.size() ) ;
     
    11331080    }
    11341081    else {
    1135       os_ << "NOT sorted at irow=" << irow << " ids[0]=" << ids[0] << LogIO::POST ;
     1082//       os_ << "NOT sorted at irow=" << irow << " ids[0]=" << ids[0] << LogIO::POST ;
    11361083      t = stt( stt.col("ID") == ids[0] ) ;
    11371084      Vector<Float> dummyC = tcalCol( 0 ) ;
     
    11411088    if ( npol == 2 ) {
    11421089      if ( idCol.asuInt( ids[1] ) == ids[1] ) {
    1143         os_ << "sorted at irow=" << irow << " ids[1]=" << ids[1] << LogIO::POST ;
     1090//         os_ << "sorted at irow=" << irow << " ids[1]=" << ids[1] << LogIO::POST ;
    11441091        tcal.row( 1 ) = tcalCol( ids[1] ) ;
    11451092      }
    11461093      else {
    1147         os_ << "NOT sorted at irow=" << irow << " ids[1]=" << ids[1] << LogIO::POST ;
     1094//         os_ << "NOT sorted at irow=" << irow << " ids[1]=" << ids[1] << LogIO::POST ;
    11481095        t = stt( stt.col("ID") == ids[1] ) ;
    11491096        tcalCol.attach( t, "TCAL" ) ;
     
    12281175    row.put( mssc.nrow()-1 ) ;
    12291176
    1230     double t2 = gettimeofday_sec() ;
    1231     os_ << irow << "th loop elapsed time = " << t2-t1 << "sec" << LogIO::POST ;
     1177//     double t2 = gettimeofday_sec() ;
     1178//     os_ << irow << "th loop elapsed time = " << t2-t1 << "sec" << LogIO::POST ;
    12321179  }
    12331180 
    1234   double endSec = gettimeofday_sec() ;
    1235   os_ << "end MSWriter::fillSysCal() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     1181//   double endSec = gettimeofday_sec() ;
     1182//   os_ << "end MSWriter::fillSysCal() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    12361183}
    12371184
    12381185void MSWriter::addFeed( Int id )
    12391186{
    1240   double startSec = gettimeofday_sec() ;
    1241   os_ << "start MSWriter::addFeed() startSec=" << startSec << LogIO::POST ;
     1187//   double startSec = gettimeofday_sec() ;
     1188//   os_ << "start MSWriter::addFeed() startSec=" << startSec << LogIO::POST ;
    12421189
    12431190  // add row
     
    12761223  msFeedCols.polResponse().put( nrow-1, polResponse ) ;
    12771224
    1278   double endSec = gettimeofday_sec() ;
    1279   os_ << "end MSWriter::addFeed() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     1225//   double endSec = gettimeofday_sec() ;
     1226//   os_ << "end MSWriter::addFeed() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    12801227}
    12811228
    12821229void MSWriter::addSpectralWindow( Int spwid, Int freqid )
    12831230{
    1284   double startSec = gettimeofday_sec() ;
    1285   os_ << "start MSWriter::addSpectralWindow() startSec=" << startSec << LogIO::POST ;
     1231//   double startSec = gettimeofday_sec() ;
     1232//   os_ << "start MSWriter::addSpectralWindow() startSec=" << startSec << LogIO::POST ;
    12861233 
    12871234  // add row
     
    13321279  msSpwCols.chanFreq().put( spwid, sharedDoubleArr ) ;
    13331280
    1334   double endSec = gettimeofday_sec() ;
    1335   os_ << "end MSWriter::addSpectralWindow() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     1281//   double endSec = gettimeofday_sec() ;
     1282//   os_ << "end MSWriter::addSpectralWindow() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    13361283}
    13371284
    13381285void MSWriter::addField( Int fid, String fieldname, String srcname, Double t, Vector<Double> rate )
    13391286{
    1340   double startSec = gettimeofday_sec() ;
    1341   os_ << "start MSWriter::addField() startSec=" << startSec << LogIO::POST ;
     1287//   double startSec = gettimeofday_sec() ;
     1288//   os_ << "start MSWriter::addField() startSec=" << startSec << LogIO::POST ;
    13421289 
    13431290  MSField msField = mstable_->field() ;
     
    13661313    Vector<Double> srcDir = msSrcCols.direction()( 0 ) ;
    13671314    Matrix<Double> srcDirA( IPosition( 2, 2, 1+numPoly ) ) ;
    1368     os_ << "srcDirA = " << srcDirA << LogIO::POST ;
    1369     os_ << "sliced srcDirA = " << srcDirA.column( 0 ) << LogIO::POST ;
     1315//     os_ << "srcDirA = " << srcDirA << LogIO::POST ;
     1316//     os_ << "sliced srcDirA = " << srcDirA.column( 0 ) << LogIO::POST ;
    13701317    srcDirA.column( 0 ) = srcDir ;
    1371     os_ << "srcDirA = " << srcDirA << LogIO::POST ;
     1318//     os_ << "srcDirA = " << srcDirA << LogIO::POST ;
    13721319    if ( numPoly != 0 )
    13731320      srcDirA.column( 1 ) = rate ;
     
    13781325  msFieldCols.sourceId().put( fid, srcId ) ;
    13791326
    1380   double endSec = gettimeofday_sec() ;
    1381   os_ << "end MSWriter::addField() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     1327//   double endSec = gettimeofday_sec() ;
     1328//   os_ << "end MSWriter::addField() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    13821329}
    13831330
    13841331void MSWriter::addPointing( String &name, Double &me, Double &interval, Matrix<Double> &dir )
    13851332{
    1386   double startSec = gettimeofday_sec() ;
    1387   os_ << "start MSWriter::addPointing() startSec=" << startSec << LogIO::POST ;
     1333//   double startSec = gettimeofday_sec() ;
     1334//   os_ << "start MSWriter::addPointing() startSec=" << startSec << LogIO::POST ;
    13881335 
    13891336  // access to POINTING subtable
     
    14171364  row.put( nrow ) ;
    14181365
    1419   double endSec = gettimeofday_sec() ;
    1420   os_ << "end MSWriter::addPointing() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     1366//   double endSec = gettimeofday_sec() ;
     1367//   os_ << "end MSWriter::addPointing() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    14211368}
    14221369
    14231370Int MSWriter::addPolarization( Vector<Int> polnos )
    14241371{
    1425   double startSec = gettimeofday_sec() ;
    1426   os_ << "start MSWriter::addPolarization() startSec=" << startSec << LogIO::POST ;
    1427 
    1428   os_ << "polnos = " << polnos << LogIO::POST ;
     1372//   double startSec = gettimeofday_sec() ;
     1373//   os_ << "start MSWriter::addPolarization() startSec=" << startSec << LogIO::POST ;
     1374
     1375//   os_ << "polnos = " << polnos << LogIO::POST ;
    14291376  MSPolarization msPol = mstable_->polarization() ;
    14301377  uInt nrow = msPol.nrow() ;
     
    14801427  }
    14811428
    1482   double endSec = gettimeofday_sec() ;
    1483   os_ << "end MSWriter::addPolarization() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     1429//   double endSec = gettimeofday_sec() ;
     1430//   os_ << "end MSWriter::addPolarization() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    14841431
    14851432  return polid ;
     
    14881435Int MSWriter::addDataDescription( Int polid, Int spwid )
    14891436{
    1490   double startSec = gettimeofday_sec() ;
    1491   os_ << "start MSWriter::addDataDescription() startSec=" << startSec << LogIO::POST ;
     1437//   double startSec = gettimeofday_sec() ;
     1438//   os_ << "start MSWriter::addDataDescription() startSec=" << startSec << LogIO::POST ;
    14921439
    14931440  MSDataDescription msDataDesc = mstable_->dataDescription() ;
     
    15071454    }
    15081455  }
    1509   os_ << "ddid = " << ddid << LogIO::POST ;
     1456//   os_ << "ddid = " << ddid << LogIO::POST ;
    15101457 
    15111458
     
    15181465  }
    15191466
    1520   double endSec = gettimeofday_sec() ;
    1521   os_ << "end MSWriter::addDataDescription() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     1467//   double endSec = gettimeofday_sec() ;
     1468//   os_ << "end MSWriter::addDataDescription() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    15221469
    15231470  return ddid ;
     
    15261473Int MSWriter::addState( Int st, Int &subscan )
    15271474{
    1528   double startSec = gettimeofday_sec() ;
    1529   os_ << "start MSWriter::addState() startSec=" << startSec << LogIO::POST ;
     1475//   double startSec = gettimeofday_sec() ;
     1476//   os_ << "start MSWriter::addState() startSec=" << startSec << LogIO::POST ;
    15301477
    15311478  // access to STATE subtable
     
    15381485  Double tload ;
    15391486  queryType( st, obsMode, isSignal, tnoise, tload ) ;
    1540   os_ << "obsMode = " << obsMode << " isSignal = " << isSignal << LogIO::POST ;
     1487//   os_ << "obsMode = " << obsMode << " isSignal = " << isSignal << LogIO::POST ;
    15411488
    15421489  Int idx = -1 ;
    15431490  ROScalarColumn<String> obsModeCol( msState, "OBS_MODE" ) ;
    1544   //ROScalarColumn<Bool> sigCol( msState, "SIG" ) ;
    1545   //ROScalarColumn<Bool> refCol( msState, "REF" ) ;
    15461491  ROScalarColumn<Int> subscanCol( msState, "SUB_SCAN" ) ;
    1547 //   Vector<String> obsModeArr = obsModeCol.getColumn() ;
    1548 //   Vector<Bool> sigArr = sigCol.getColumn() ;
    1549 //   Vector<Bool> refArr = refCol.getColumn() ;
    1550 //   Vector<Int> subscanArr = subscanCol.getColumn() ;
    15511492  for ( uInt irow = 0 ; irow < nrow ; irow++ ) {
    15521493    if ( obsModeCol(irow) == obsMode
     
    15541495         //&& refCol(irow) != isSignal
    15551496         && subscanCol(irow) == subscan ) {
    1556 //     if ( obsModeArr[irow] == obsMode
    1557 //          && sigArr[irow] == isSignal
    1558 //          && refArr[irow] != isSignal
    1559 //          && subscanArr[irow] == subscan ) {
    15601497      idx = irow ;
    15611498      break ;
     
    15791516    *loadRF = tload ;
    15801517    row.put( nrow ) ;
    1581 //     ScalarColumn<String> obsModeCol( msState, "OBS_MODE" ) ;
    1582 //     obsModeCol.put( nrow, obsMode ) ;
    1583 //     ScalarColumn<Bool> sharedBCol( msState, "SIG" ) ;
    1584 //     sharedBCol.put( nrow, isSignal ) ;
    1585 //     sharedBCol.attach( msState, "REF" ) ;
    1586 //     sharedBCol.put( nrow, !isSignal ) ;
    1587 //     ScalarColumn<Int> subscanCol( msState, "SUB_SCAN" ) ;
    1588 //     subscanCol.put( nrow, subscan ) ;
    15891518    idx = nrow ;
    15901519  }
    15911520  subscan++ ;
    15921521
    1593   double endSec = gettimeofday_sec() ;
    1594   os_ << "end MSWriter::addState() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     1522//   double endSec = gettimeofday_sec() ;
     1523//   os_ << "end MSWriter::addState() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    15951524
    15961525  return idx ;
     
    15991528Vector<Int> MSWriter::toCorrType( Vector<Int> polnos )
    16001529{
    1601   double startSec = gettimeofday_sec() ;
    1602   os_ << "start MSWriter::toCorrType() startSec=" << startSec << LogIO::POST ;
     1530//   double startSec = gettimeofday_sec() ;
     1531//   os_ << "start MSWriter::toCorrType() startSec=" << startSec << LogIO::POST ;
    16031532
    16041533  uInt npol = polnos.size() ;
     
    16861615  }
    16871616
    1688   double endSec = gettimeofday_sec() ;
    1689   os_ << "end MSWriter::toCorrType() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     1617//   double endSec = gettimeofday_sec() ;
     1618//   os_ << "end MSWriter::toCorrType() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    16901619
    16911620  return corrType ;
     
    16941623void MSWriter::getValidTimeRange( Double &me, Double &interval, Table &tab )
    16951624{
    1696   double startSec = gettimeofday_sec() ;
    1697   os_ << "start MSWriter::getVaridTimeRange() startSec=" << startSec << LogIO::POST ;
     1625//   double startSec = gettimeofday_sec() ;
     1626//   os_ << "start MSWriter::getVaridTimeRange() startSec=" << startSec << LogIO::POST ;
    16981627
    16991628  // sort table
     
    17121641  interval = ( maxTime - minTime ) * 86400.0 ;
    17131642
    1714   double endSec = gettimeofday_sec() ;
    1715   os_ << "end MSWriter::getValidTimeRange() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     1643//   double endSec = gettimeofday_sec() ;
     1644//   os_ << "end MSWriter::getValidTimeRange() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    17161645}
    17171646
    17181647void MSWriter::getValidTimeRange( Double &me, Double &interval, Vector<Double> &atime, Vector<Double> &ainterval )
    17191648{
    1720   double startSec = gettimeofday_sec() ;
    1721   os_ << "start MSWriter::getVaridTimeRange() startSec=" << startSec << LogIO::POST ;
     1649//   double startSec = gettimeofday_sec() ;
     1650//   os_ << "start MSWriter::getVaridTimeRange() startSec=" << startSec << LogIO::POST ;
    17221651
    17231652  // sort table
     
    17341663  interval = ( maxTime - minTime ) * 86400.0 + mean( ainterval ) ;
    17351664
    1736   double endSec = gettimeofday_sec() ;
    1737   os_ << "end MSWriter::getValidTimeRange() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     1665//   double endSec = gettimeofday_sec() ;
     1666//   os_ << "end MSWriter::getValidTimeRange() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    17381667}
    17391668
     
    17411670void MSWriter::queryType( Int type, String &stype, Bool &b, Double &t, Double &l )
    17421671{
    1743   double startSec = gettimeofday_sec() ;
    1744   os_ << "start MSWriter::queryType() startSec=" << startSec << LogIO::POST ;
     1672//   double startSec = gettimeofday_sec() ;
     1673//   os_ << "start MSWriter::queryType() startSec=" << startSec << LogIO::POST ;
    17451674
    17461675  switch ( type ) {
     
    19211850  }
    19221851
    1923   double endSec = gettimeofday_sec() ;
    1924   os_ << "end MSWriter::queryType() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    1925 }
    1926 }
     1852//   double endSec = gettimeofday_sec() ;
     1853//   os_ << "end MSWriter::queryType() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
     1854}
     1855
     1856Double MSWriter::getDishDiameter( String antname )
     1857{
     1858  Double diameter = 0.0 ;
     1859 
     1860  antname.upcase() ;
     1861
     1862  if ( antname.matches( Regex( "DV[0-9]+$" ) )
     1863       || antname.matches( Regex( "DA[0-9]+$" ) )
     1864       || antname.matches( Regex( "PM[0-9]+$" ) ) )
     1865    diameter = 12.0 ;
     1866  else if ( antname.matches( Regex( "CM[0-9]+$" ) ) )
     1867    diameter = 7.0 ;
     1868  else if ( antname.contains( "GBT" ) )
     1869    diameter = 104.9 ;
     1870  else if ( antname.contains( "MOPRA" ) )
     1871    diameter = 22.0 ;
     1872  else if ( antname.contains( "PKS" ) || antname.contains( "PARKS" ) )
     1873    diameter = 64.0 ;
     1874  else if ( antname.contains( "TIDBINBILLA" ) )
     1875    diameter = 70.0 ;
     1876  else if ( antname.contains( "CEDUNA" ) )
     1877    diameter = 30.0 ;
     1878  else if ( antname.contains( "HOBART" ) )
     1879    diameter = 26.0 ;
     1880  else if ( antname.contains( "APEX" ) )
     1881    diameter = 12.0 ;
     1882  else if ( antname.contains( "ASTE" ) )
     1883    diameter = 10.0 ;
     1884  else if ( antname.contains( "NRO" ) )
     1885    diameter = 45.0 ;
     1886  else
     1887    diameter = 1.0 ;
     1888
     1889  return diameter ;
     1890}
     1891}
  • trunk/src/MSWriter.h

    r2019 r2026  
    8282  //void queryType( casa::Int type, casa::String &stype, casa::Bool &b ) ;
    8383  void queryType( casa::Int type, casa::String &stype, casa::Bool &b, casa::Double &t, Double &l ) ;
     84  casa::Double getDishDiameter( casa::String antname ) ;
    8485
    8586  // tool for HPC
Note: See TracChangeset for help on using the changeset viewer.