Changeset 2021 for trunk/src/MSFiller.cpp
- Timestamp:
- 03/02/11 13:00:54 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/MSFiller.cpp
r2019 r2021 44 44 #include <measures/TableMeasures/ArrayQuantColumn.h> 45 45 46 #include <ms/MeasurementSets/MSAntennaIndex.h> 47 46 48 #include <atnf/PKSIO/SrcType.h> 47 49 … … 67 69 tablename_( "" ), 68 70 antenna_( -1 ), 71 antennaStr_(""), 69 72 getPt_( False ), 70 73 isFloatData_( False ), … … 107 110 } 108 111 else { 109 antenna_ = atoi( msrec.asString( "antenna" ).c_str() ) ; 112 //antenna_ = atoi( msrec.asString( "antenna" ).c_str() ) ; 113 antennaStr_ = msrec.asString( "antenna" ) ; 110 114 } 111 115 } … … 116 120 117 121 os_ << "Parsing MS options" << endl ; 122 rec.print(cout) ; 118 123 os_ << " getPt = " << getPt_ << endl ; 119 os_ << " antenna = " << antenna_ << LogIO::POST ; 124 os_ << " antenna = " << antenna_ << endl ; 125 os_ << " antennaStr = " << antennaStr_ << LogIO::POST ; 120 126 121 127 MeasurementSet *tmpMS = new MeasurementSet( filename, Table::Old ) ; … … 123 129 // && tmpMS->col("ANTENNA1") == tmpMS->col("ANTENNA2") ) ; 124 130 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 } 125 138 mstable_ = MeasurementSet( (*tmpMS)( tmpMS->col("ANTENNA1") == antenna_ 126 139 && tmpMS->col("ANTENNA1") == tmpMS->col("ANTENNA2") ) ) ; … … 274 287 String telescopeName = "" ; 275 288 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 ; 278 291 279 292 // row based … … 314 327 TableIterator iter0( mstable_, "OBSERVATION_ID" ) ; 315 328 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 ; 318 331 Table t0 = iter0.table() ; 319 332 tcolr = tpoolr->construct( t0, "OBSERVATION_ID" ) ; … … 342 355 } 343 356 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 ; 346 359 // 347 360 // ITERATION: FEED1 … … 349 362 TableIterator iter1( t0, "FEED1" ) ; 350 363 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 ; 353 366 Table t1 = iter1.table() ; 354 367 // assume FEED1 == FEED2 … … 366 379 *uintRF = 0 ; 367 380 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 ; 370 383 // 371 384 // ITERATION: FIELD_ID … … 373 386 TableIterator iter2( t1, "FIELD_ID" ) ; 374 387 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 ; 377 390 Table t2 = iter2.table() ; 378 391 tcolr = tpoolr->construct( t2, "FIELD_ID" ) ; … … 399 412 400 413 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 ; 403 416 // 404 417 // ITERATION: DATA_DESC_ID … … 406 419 TableIterator iter3( t2, "DATA_DESC_ID" ) ; 407 420 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 ; 410 423 Table t3 = iter3.table() ; 411 424 tcolr = tpoolr->construct( t3, "DATA_DESC_ID" ) ; … … 432 445 Vector<Int> corrtype = (*roArrICol)( polId ) ; 433 446 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 ; 436 449 sdh.npol = max( sdh.npol, npol ) ; 437 450 if ( sdh.poltype == "" ) sdh.poltype = getPolType( corrtype[0] ) ; … … 469 482 470 483 //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 same481 sysVel = sysVels( IPosition(1,0) ) ;482 }483 484 // SRCVELOCITY485 RecordFieldPtr<Double> doubleRF( trec, "SRCVELOCITY" ) ;486 *doubleRF = sysVel ;487 488 //delete tmpArrCol ;489 //os_ << "sysVel = " << sysVel << LogIO::POST ;490 484 ROScalarMeasColumn<MDirection> *tmpMeasCol = new ROScalarMeasColumn<MDirection>( srctabSel, "DIRECTION" ) ; 491 485 MDirection md = (*tmpMeasCol)( 0 ) ; 492 486 delete tmpMeasCol ; 487 493 488 // for MOLECULES subtable 494 489 tcolr = tpoolr->construct( srctabSel, "NUM_LINES" ) ; 495 490 Int numLines = tcolr->asInt( 0 ) ; 496 491 tpoolr->destroy( tcolr ) ; 497 //os_ << "numLines = " << numLines << LogIO::POST ; 492 // os_ << "numLines = " << numLines << LogIO::POST ; 493 498 494 Vector<Double> restFreqs( numLines, 0.0 ) ; 499 495 Vector<String> transitionName( numLines, "" ) ; 496 Vector<Double> sysVels ; 497 Double sysVel = 0.0 ; 500 498 if ( numLines != 0 ) { 501 499 if ( srctabSel.tableDesc().isColumn( "REST_FREQUENCY" ) ) { … … 514 512 //os_ << "transitionNameCol.nrow() = " << transitionCol.nrow() << LogIO::POST ; 515 513 } 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 } 516 524 } 525 526 // SRCVELOCITY 527 RecordFieldPtr<Double> doubleRF( trec, "SRCVELOCITY" ) ; 528 *doubleRF = sysVel ; 529 530 // os_ << "sysVel = " << sysVel << LogIO::POST ; 531 517 532 uInt molId = table_->molecules().addEntry( restFreqs, transitionName, transitionName ) ; 518 533 … … 612 627 scTsysCol.attach( caltabsel, colTsys_ ) ; 613 628 } 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 ; 616 631 // 617 632 // ITERATION: SCAN_NUMBER … … 619 634 TableIterator iter4( t3, "SCAN_NUMBER" ) ; 620 635 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 ; 623 638 Table t4 = iter4.table() ; 624 639 tcolr = tpoolr->construct( t4, "SCAN_NUMBER" ) ; … … 630 645 *uintRF = scanNum - 1 ; 631 646 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 ; 634 649 // 635 650 // ITERATION: STATE_ID … … 1242 1257 os_ << "No SysCal rows" << LogIO::POST ; 1243 1258 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 ) ; 1244 1262 return ; 1245 1263 } … … 1344 1362 //os_ << "tStart = " << tStart << " dtEnd = " << tEnd-tStart << " dwtime = " << wtime-tStart << LogIO::POST ; 1345 1363 if ( wtime >= tStart && wtime <= tEnd ) 1364 wid = i-1 ; 1365 else 1346 1366 wid = i ; 1347 1367 }
Note:
See TracChangeset
for help on using the changeset viewer.