Ignore:
Timestamp:
03/02/11 13:00:54 (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...

Bug fix related to ALMA data.

  1. bug fix when NUM_LINES is 0 in SOURCE subtable
  2. support variable number of polarization data (e.g. including WVR data)
  3. bug fix on WEATHER_ID numbering in MSFiller


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/MSFiller.cpp

    r2019 r2021  
    4444#include <measures/TableMeasures/ArrayQuantColumn.h>
    4545
     46#include <ms/MeasurementSets/MSAntennaIndex.h>
     47
    4648#include <atnf/PKSIO/SrcType.h>
    4749
     
    6769    tablename_( "" ),
    6870    antenna_( -1 ),
     71    antennaStr_(""),
    6972    getPt_( False ),
    7073    isFloatData_( False ),
     
    107110      }
    108111      else {
    109         antenna_ = atoi( msrec.asString( "antenna" ).c_str() ) ;
     112        //antenna_ = atoi( msrec.asString( "antenna" ).c_str() ) ;
     113        antennaStr_ = msrec.asString( "antenna" ) ;
    110114      }
    111115    }
     
    116120
    117121  os_ << "Parsing MS options" << endl ;
     122  rec.print(cout) ;
    118123  os_ << "   getPt = " << getPt_ << endl ;
    119   os_ << "   antenna = " << antenna_ << LogIO::POST ;
     124  os_ << "   antenna = " << antenna_ << endl ;
     125  os_ << "   antennaStr = " << antennaStr_ << LogIO::POST ;
    120126
    121127  MeasurementSet *tmpMS = new MeasurementSet( filename, Table::Old ) ;
     
    123129  //                     && tmpMS->col("ANTENNA1") == tmpMS->col("ANTENNA2") ) ;
    124130  tablename_ = tmpMS->tableName() ;
     131  if ( antenna_ == -1 && antennaStr_.size() > 0 ) {
     132    MSAntennaIndex msAntIdx( tmpMS->antenna() ) ;
     133    Vector<Int> id = msAntIdx.matchAntennaName( antennaStr_ ) ;
     134    if ( id.size() > 0 )
     135      antenna_ = id[0] ;
     136    os_ << "searched antenna_ = " << antenna_ << LogIO::POST ;
     137  }
    125138  mstable_ = MeasurementSet( (*tmpMS)( tmpMS->col("ANTENNA1") == antenna_
    126139                                       && tmpMS->col("ANTENNA1") == tmpMS->col("ANTENNA2") ) ) ;
     
    274287  String telescopeName = "" ;
    275288
    276   //double time1 = gettimeofday_sec() ;
    277   //os_ << "end fill init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
     289//   double time1 = gettimeofday_sec() ;
     290//   os_ << "end fill init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    278291
    279292  // row based
     
    314327  TableIterator iter0( mstable_, "OBSERVATION_ID" ) ;
    315328  while( !iter0.pastEnd() ) {
    316     //time0 = gettimeofday_sec() ;
    317     //os_ << "start 0th iteration: " << time0 << LogIO::POST ;
     329//     time0 = gettimeofday_sec() ;
     330//     os_ << "start 0th iteration: " << time0 << LogIO::POST ;
    318331    Table t0 = iter0.table() ;
    319332    tcolr = tpoolr->construct( t0, "OBSERVATION_ID" ) ;
     
    342355    }
    343356    Int nbeam = 0 ;
    344     //time1 = gettimeofday_sec() ;
    345     //os_ << "end 0th iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
     357//     time1 = gettimeofday_sec() ;
     358//     os_ << "end 0th iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    346359    //
    347360    // ITERATION: FEED1
     
    349362    TableIterator iter1( t0, "FEED1" ) ;
    350363    while( !iter1.pastEnd() ) {
    351       //time0 = gettimeofday_sec() ;
    352       //os_ << "start 1st iteration: " << time0 << LogIO::POST ;
     364//       time0 = gettimeofday_sec() ;
     365//       os_ << "start 1st iteration: " << time0 << LogIO::POST ;
    353366      Table t1 = iter1.table() ;
    354367      // assume FEED1 == FEED2
     
    366379      *uintRF = 0 ;
    367380
    368       //time1 = gettimeofday_sec() ;
    369       //os_ << "end 1st iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
     381//       time1 = gettimeofday_sec() ;
     382//       os_ << "end 1st iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    370383      //
    371384      // ITERATION: FIELD_ID
     
    373386      TableIterator iter2( t1, "FIELD_ID" ) ;
    374387      while( !iter2.pastEnd() ) {
    375         //time0 = gettimeofday_sec() ;
    376         //os_ << "start 2nd iteration: " << time0 << LogIO::POST ;
     388//         time0 = gettimeofday_sec() ;
     389//         os_ << "start 2nd iteration: " << time0 << LogIO::POST ;
    377390        Table t2 = iter2.table() ;
    378391        tcolr = tpoolr->construct( t2, "FIELD_ID" ) ;
     
    399412
    400413
    401         //time1 = gettimeofday_sec() ;
    402         //os_ << "end 2nd iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
     414//         time1 = gettimeofday_sec() ;
     415//         os_ << "end 2nd iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    403416        //
    404417        // ITERATION: DATA_DESC_ID
     
    406419        TableIterator iter3( t2, "DATA_DESC_ID" ) ;
    407420        while( !iter3.pastEnd() ) {
    408           //time0 = gettimeofday_sec() ;
    409           //os_ << "start 3rd iteration: " << time0 << LogIO::POST ;
     421//           time0 = gettimeofday_sec() ;
     422//           os_ << "start 3rd iteration: " << time0 << LogIO::POST ;
    410423          Table t3 = iter3.table() ;
    411424          tcolr = tpoolr->construct( t3, "DATA_DESC_ID" ) ;
     
    432445          Vector<Int> corrtype = (*roArrICol)( polId ) ;
    433446          delete roArrICol ;
    434           //os_ << "npol = " << npol << LogIO::POST ;
    435           //os_ << "corrtype = " << corrtype << LogIO::POST ;
     447//           os_ << "npol = " << npol << LogIO::POST ;
     448//           os_ << "corrtype = " << corrtype << LogIO::POST ;
    436449          sdh.npol = max( sdh.npol, npol ) ;
    437450          if ( sdh.poltype == "" ) sdh.poltype = getPolType( corrtype[0] ) ;
     
    469482
    470483          //os_ << "srcDir = " << srcDir << LogIO::POST ;
    471           Array<Double> sysVels ;
    472           Double sysVel = 0.0 ;
    473           if ( srctabSel.tableDesc().isColumn( "SYSVEL" ) ) {
    474             roArrDCol = new ROArrayColumn<Double>( srctabSel, "SYSVEL" ) ;
    475             sysVels = (*roArrDCol)( 0 ) ;
    476             delete roArrDCol ;
    477           }
    478           if ( !sysVels.empty() ) {
    479             //os_ << "sysVels.shape() = " << sysVels.shape() << LogIO::POST ;
    480             // NB: assume all SYSVEL values are the same
    481             sysVel = sysVels( IPosition(1,0) ) ;
    482           }
    483 
    484           // SRCVELOCITY
    485           RecordFieldPtr<Double> doubleRF( trec, "SRCVELOCITY" ) ;
    486           *doubleRF = sysVel ;
    487 
    488           //delete tmpArrCol ;
    489           //os_ << "sysVel = " << sysVel << LogIO::POST ;
    490484          ROScalarMeasColumn<MDirection> *tmpMeasCol = new ROScalarMeasColumn<MDirection>( srctabSel, "DIRECTION" ) ;
    491485          MDirection md = (*tmpMeasCol)( 0 ) ;
    492486          delete tmpMeasCol ;
     487
    493488          // for MOLECULES subtable
    494489          tcolr = tpoolr->construct( srctabSel, "NUM_LINES" ) ;
    495490          Int numLines = tcolr->asInt( 0 ) ;
    496491          tpoolr->destroy( tcolr ) ;
    497           //os_ << "numLines = " << numLines << LogIO::POST ;
     492//           os_ << "numLines = " << numLines << LogIO::POST ;
     493
    498494          Vector<Double> restFreqs( numLines, 0.0 ) ;
    499495          Vector<String> transitionName( numLines, "" ) ;
     496          Vector<Double> sysVels ;
     497          Double sysVel = 0.0 ;
    500498          if ( numLines != 0 ) {
    501499            if ( srctabSel.tableDesc().isColumn( "REST_FREQUENCY" ) ) {
     
    514512              //os_ << "transitionNameCol.nrow() = " << transitionCol.nrow() << LogIO::POST ;
    515513            }
     514            if ( srctabSel.tableDesc().isColumn( "SYSVEL" ) ) {
     515              roArrDCol = new ROArrayColumn<Double>( srctabSel, "SYSVEL" ) ;
     516              sysVels = (*roArrDCol)( 0 ) ;
     517              delete roArrDCol ;
     518            }
     519            if ( !sysVels.empty() ) {
     520              //os_ << "sysVels.shape() = " << sysVels.shape() << LogIO::POST ;
     521              // NB: assume all SYSVEL values are the same
     522              sysVel = sysVels( IPosition(1,0) ) ;
     523            }
    516524          }
     525
     526          // SRCVELOCITY
     527          RecordFieldPtr<Double> doubleRF( trec, "SRCVELOCITY" ) ;
     528          *doubleRF = sysVel ;
     529
     530//           os_ << "sysVel = " << sysVel << LogIO::POST ;
     531
    517532          uInt molId = table_->molecules().addEntry( restFreqs, transitionName, transitionName ) ;
    518533
     
    612627            scTsysCol.attach( caltabsel, colTsys_ ) ;
    613628          }
    614           //time1 = gettimeofday_sec() ;
    615           //os_ << "end 3rd iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
     629//           time1 = gettimeofday_sec() ;
     630//           os_ << "end 3rd iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    616631          //
    617632          // ITERATION: SCAN_NUMBER
     
    619634          TableIterator iter4( t3, "SCAN_NUMBER" ) ;
    620635          while( !iter4.pastEnd() ) {
    621             //time0 = gettimeofday_sec() ;
    622             //os_ << "start 4th iteration: " << time0 << LogIO::POST ;
     636//             time0 = gettimeofday_sec() ;
     637//             os_ << "start 4th iteration: " << time0 << LogIO::POST ;
    623638            Table t4 = iter4.table() ;
    624639            tcolr = tpoolr->construct( t4, "SCAN_NUMBER" ) ;
     
    630645            *uintRF = scanNum - 1 ;
    631646
    632             //time1 = gettimeofday_sec() ;
    633             //os_ << "end 4th iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
     647//             time1 = gettimeofday_sec() ;
     648//             os_ << "end 4th iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;
    634649            //
    635650            // ITERATION: STATE_ID
     
    12421257    os_ << "No SysCal rows" << LogIO::POST ;
    12431258    table_->tcal().table().addRow(1,True) ;
     1259    Vector<Float> defaultTcal( 1, 1.0 ) ;
     1260    ArrayColumn<Float> tcalCol( table_->tcal().table(), "TCAL" ) ;
     1261    tcalCol.put( 0, defaultTcal ) ;
    12441262    return ;
    12451263  }
     
    13441362    //os_ << "tStart = " << tStart << " dtEnd = " << tEnd-tStart << " dwtime = " << wtime-tStart << LogIO::POST ;
    13451363    if ( wtime >= tStart && wtime <= tEnd )
     1364      wid = i-1 ;
     1365    else
    13461366      wid = i ;
    13471367  }
Note: See TracChangeset for help on using the changeset viewer.