Changeset 2026
- Timestamp:
- 03/02/11 17:40:42 (14 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/MSWriter.cpp
r2022 r2026 42 42 #include <sys/time.h> 43 43 44 // Boost45 #include <boost/pool/object_pool.hpp>46 47 44 using namespace casa ; 48 45 using namespace std ; … … 66 63 os_ = LogIO() ; 67 64 os_.origin( LogOrigin( "MSWriter", "MSWriter()", WHERE ) ) ; 68 os_ << "MSWriter::MSWriter()" << LogIO::POST ;65 // os_ << "MSWriter::MSWriter()" << LogIO::POST ; 69 66 70 67 // initialize writer … … 75 72 { 76 73 os_.origin( LogOrigin( "MSWriter", "~MSWriter()", WHERE ) ) ; 77 os_ << "MSWriter::~MSWriter()" << LogIO::POST ;74 // os_ << "MSWriter::~MSWriter()" << LogIO::POST ; 78 75 79 76 if ( mstable_ != 0 ) … … 84 81 { 85 82 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 ; 88 85 89 86 filename_ = filename ; … … 114 111 } 115 112 } 116 117 // TEST118 // memory allocation by boost::object_pool119 // boost::object_pool<ROTableColumn> *tpoolr = new boost::object_pool<ROTableColumn> ;120 // ROTableColumn *tcol = 0 ;121 //122 113 123 114 // set up MS … … 197 188 ROTableColumn sharedCol( t0, "FIELDNAME" ) ; 198 189 String fieldName = sharedCol.asString( 0 ) ; 199 // tcol = tpoolr->construct( t0, "FIELDNAME" ) ;200 // String fieldName = tcol->asString( 0 ) ;201 // tpoolr->destroy( tcol ) ;202 190 sharedCol.attach( t0, "SRCNAME" ) ; 203 191 String srcName = sharedCol.asString( 0 ) ; 204 // tcol = tpoolr->construct( t0, "SRCNAME" ) ;205 // String srcName = tcol->asString( 0 ) ;206 // tpoolr->destroy( tcol ) ;207 192 sharedCol.attach( t0, "TIME" ) ; 208 193 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 -> sec211 // tpoolr->destroy( tcol ) ;212 194 ROArrayColumn<Double> scanRateCol( t0, "SCANRATE" ) ; 213 //Vector<Double> scanRate = scanRateCol.getColumn()[0] ;214 195 Vector<Double> scanRate = scanRateCol( 0 ) ; 215 196 String::size_type pos = fieldName.find( "__" ) ; 216 197 Int fieldId = -1 ; 217 198 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 ; 219 200 fieldId = String::toInt( fieldName.substr( pos+2 ) ) ; 220 201 fieldName = fieldName.substr( 0, pos ) ; 221 202 } 222 203 else { 223 os_ << "use default field id" << LogIO::POST ;204 // os_ << "use default field id" << LogIO::POST ; 224 205 fieldId = defaultFieldId ; 225 206 defaultFieldId++ ; 226 207 } 227 os_ << "fieldId" << fieldId << ": " << fieldName << LogIO::POST ;208 // os_ << "fieldId" << fieldId << ": " << fieldName << LogIO::POST ; 228 209 229 210 // FIELD_ID … … 237 218 while( !iter1.pastEnd() ) { 238 219 Table t1 = iter1.table() ; 239 // tcol = tpoolr->construct( t1, "BEAMNO" ) ;240 // uInt beamNo = tcol->asuInt( 0 ) ;241 // tpoolr->destroy( tcol ) ;242 220 sharedCol.attach( t1, "BEAMNO" ) ; 243 221 uInt beamNo = sharedCol.asuInt( 0 ) ; 244 os_ << "beamNo = " << beamNo << LogIO::POST ;222 // os_ << "beamNo = " << beamNo << LogIO::POST ; 245 223 246 224 // FEED1 and FEED2 … … 256 234 while( !iter2.pastEnd() ) { 257 235 Table t2 = iter2.table() ; 258 // tcol = tpoolr->construct( t2, "SCANNO" ) ;259 // uInt scanNo = tcol->asuInt( 0 ) ;260 // tpoolr->destroy( tcol ) ;261 236 sharedCol.attach( t2, "SCANNO" ) ; 262 237 uInt scanNo = sharedCol.asuInt( 0 ) ; 263 os_ << "scanNo = " << scanNo << LogIO::POST ;238 // os_ << "scanNo = " << scanNo << LogIO::POST ; 264 239 265 240 // SCAN_NUMBER … … 275 250 while( !iter3.pastEnd() ) { 276 251 Table t3 = iter3.table() ; 277 // tcol = tpoolr->construct( t3, "IFNO" ) ;278 // uInt ifNo = tcol->asuInt( 0 ) ;279 // tpoolr->destroy( tcol ) ;280 252 sharedCol.attach( t3, "IFNO" ) ; 281 253 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 ; 286 255 sharedCol.attach( t3, "FREQ_ID" ) ; 287 256 uInt freqId = sharedCol.asuInt( 0 ) ; 288 os_ << "freqId = " << freqId << LogIO::POST ;257 // os_ << "freqId = " << freqId << LogIO::POST ; 289 258 Int subscan = 1 ; // 1-base 290 259 // … … 294 263 while( !iter4.pastEnd() ) { 295 264 Table t4 = iter4.table() ; 296 // tcol = tpoolr->construct( t4, "SRCTYPE" ) ;297 // uInt srcType = tcol->asInt( 0 ) ;298 // tpoolr->destroy( tcol ) ;299 265 sharedCol.attach( t4, "SRCTYPE" ) ; 300 266 Int srcType = sharedCol.asInt( 0 ) ; … … 313 279 //uInt cycleNo = sharedCol.asuInt( 0 ) ; 314 280 Int nrow = t5.nrow() ; 315 os_ << "nrow = " << nrow << LogIO::POST ;281 // os_ << "nrow = " << nrow << LogIO::POST ; 316 282 317 283 Vector<Int> polnos( nrow ) ; 318 284 indgen( polnos, 0 ) ; 319 285 Int polid = addPolarization( polnos ) ; 320 os_ << "polid = " << polid << LogIO::POST ;286 // os_ << "polid = " << polid << LogIO::POST ; 321 287 322 288 // DATA/FLOAT_DATA … … 335 301 convertArray( tmpB, flagCol( ipol ) ) ; 336 302 } 337 //*(*((RecordFieldPtr< Array<Float> > *)dataRF)) = dataArr ;338 303 ((RecordFieldPtr< Array<Float> > *)dataRF)->define( dataArr ) ; 339 304 340 305 // FLAG 341 //*flagRF = flagArr ;342 306 flagRF.define( flagArr ) ; 343 307 } … … 357 321 dataArr.row( 1 ) = RealToComplex( dummy ) ; 358 322 dataArr.row( 2 ) = conj( dataArr.row( 1 ) ) ; 359 //*(*((RecordFieldPtr< Array<Complex> > *)dataRF)) = dataArr ;360 323 ((RecordFieldPtr< Array<Complex> > *)dataRF)->define( dataArr ) ; 361 324 … … 371 334 convertArray( tmpB, ( flagCol( 2 ) | flagCol( 3 ) ) ) ; 372 335 flagArr.row( 2 ) = flagArr.row( 1 ) ; 373 //*flagRF = flagArr ;374 336 flagRF.define( flagArr ) ; 375 337 } 376 338 377 339 // FLAG_ROW 378 // tcol = tpoolr->construct( t5, "FLAGROW" ) ;379 340 sharedCol.attach( t5, "FLAGROW" ) ; 380 341 Vector<uInt> flagRowArr( nrow ) ; 381 342 for ( Int irow = 0 ; irow < nrow ; irow++ ) 382 343 flagRowArr[irow] = sharedCol.asuInt( irow ) ; 383 // flagRowArr[irow] = tcol->asuInt( irow ) ;384 // tpoolr->destroy( tcol ) ;385 344 *flagrowRF = anyNE( flagRowArr, (uInt)0 ) ; 386 345 387 346 // TIME and TIME_CENTROID 388 // tcol = tpoolr->construct( t5, "TIME" ) ;389 // Double mTimeV = (Double)(tcol->asdouble(0)) * 86400.0 ; // day->sec390 // tpoolr->destroy( tcol ) ;391 347 sharedCol.attach( t5, "TIME" ) ; 392 348 Double mTimeV = (Double)sharedCol.asdouble( 0 ) * 86400.0 ; // day -> sec … … 395 351 396 352 // INTERVAL and EXPOSURE 397 // tcol = tpoolr->construct( t5, "INTERVAL" ) ;398 // Double interval = (Double)(tcol->asdouble( 0 )) ;399 // tpoolr->destroy( tcol ) ;400 353 sharedCol.attach( t5, "INTERVAL" ) ; 401 354 Double interval = (Double)sharedCol.asdouble( 0 ) ; … … 406 359 // always 1 at the moment 407 360 Vector<Float> wArr( nrow, 1.0 ) ; 408 // *weightRF = wArr ;409 // *sigmaRF = wArr ;410 361 weightRF.define( wArr ) ; 411 362 sigmaRF.define( wArr ) ; … … 413 364 // add DATA_DESCRIPTION row 414 365 Int ddid = addDataDescription( polid, ifNo ) ; 415 os_ << "ddid = " << ddid << LogIO::POST ;366 // os_ << "ddid = " << ddid << LogIO::POST ; 416 367 *ddidRF = ddid ; 417 368 418 369 // for SYSCAL table 419 // tcol = tpoolr->construct( t5, "TCAL_ID" ) ;420 370 sharedCol.attach( t5, "TCAL_ID" ) ; 421 371 Vector<uInt> tcalIdArr( nrow ) ; 422 372 for ( Int irow = 0 ; irow < nrow ; irow++ ) 423 373 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 ; 427 375 String key = String::toString( tcalIdArr[0] ) ; 428 376 if ( !tcalIdRec_.isDefined( key ) ) { … … 434 382 tcalRowRec_.define( key, concatenateArray( pastrows, t5.rowNumbers() ) ) ; 435 383 } 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 443 385 // for POINTING table 444 386 if ( ptTabName_ == "" ) { … … 457 399 458 400 // FLAG_CATEGORY is tentatively set 459 //*flagcatRF = Cube<Bool>( nrow, nchan, 1, False ) ;460 401 flagcatRF.define( Cube<Bool>( nrow, nchan, 1, False ) ) ; 461 402 … … 529 470 } 530 471 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 ; 533 474 534 475 return True ; … … 538 479 { 539 480 // 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 ; 542 483 543 484 // access to scantable … … 573 514 ROTableColumn col( table_->tcal().table(), "TCAL" ) ; 574 515 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 ; 576 517 isTcal_ = True ; 577 518 } 578 519 else { 579 os_ << " no TCAL rows" << LogIO::POST ;520 os_ << "No TCAL rows" << LogIO::POST ; 580 521 } 581 522 } 582 523 else { 583 os_ << " no TCAL rows" << LogIO::POST ;524 os_ << "No TCAL rows" << LogIO::POST ; 584 525 } 585 526 if ( table_->weather().table().nrow() != 0 ) { 586 527 ROTableColumn col( table_->weather().table(), "TEMPERATURE" ) ; 587 528 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 ; 589 530 isWeather_ =True ; 590 531 } 591 532 else { 592 os_ << " no WEATHER rows" << LogIO::POST ;533 os_ << "No WEATHER rows" << LogIO::POST ; 593 534 } 594 535 } 595 536 else { 596 os_ << " no WEATHER rows" << LogIO::POST ;537 os_ << "No WEATHER rows" << LogIO::POST ; 597 538 } 598 539 … … 630 571 } 631 572 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 ; 634 575 } 635 576 … … 637 578 { 638 579 // 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 ; 641 582 642 583 TableDesc msDesc = MeasurementSet::requiredTableDesc() ; … … 736 677 mstable_->initRefs() ; 737 678 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 ; 740 681 } 741 682 742 683 void MSWriter::fillObservation() 743 684 { 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 ; 746 687 747 688 // only 1 row … … 760 701 telescopeName = hAntennaName.substr( 0, pos ) ; 761 702 } 762 os_ << "telescopeName = " << telescopeName << LogIO::POST ;703 // os_ << "telescopeName = " << telescopeName << LogIO::POST ; 763 704 msObsCols.telescopeName().put( 0, telescopeName ) ; 764 705 msObsCols.project().put( 0, header_.project ) ; … … 771 712 msObsCols.timeRangeMeas().put( 0, trange ) ; 772 713 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 ; 775 716 } 776 717 777 718 void MSWriter::fillAntenna() 778 719 { 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 ; 781 722 782 723 // only 1 row … … 800 741 stationName = hAntennaName ; 801 742 } 802 os_ << "antennaName = " << antennaName << LogIO::POST ;803 os_ << "stationName = " << stationName << LogIO::POST ;743 // os_ << "antennaName = " << antennaName << LogIO::POST ; 744 // os_ << "stationName = " << stationName << LogIO::POST ; 804 745 805 746 msAntCols.name().put( 0, antennaName ) ; 806 747 msAntCols.station().put( 0, stationName ) ; 807 748 808 os_ << "antennaPosition = " << header_.antennaposition << LogIO::POST ;749 // os_ << "antennaPosition = " << header_.antennaposition << LogIO::POST ; 809 750 810 751 msAntCols.position().put( 0, header_.antennaposition ) ; 811 752 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 ; 814 761 } 815 762 816 763 void MSWriter::fillProcessor() 817 764 { 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 ; 820 767 821 768 // only add empty 1 row … … 823 770 msProc.addRow( 1, True ) ; 824 771 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 ; 827 774 } 828 775 829 776 void MSWriter::fillSource() 830 777 { 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 ; 833 780 834 781 // access to MS SOURCE subtable … … 967 914 } 968 915 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 ; 971 918 } 972 919 973 920 void MSWriter::fillWeather() 974 921 { 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 ; 977 924 978 925 // access to MS WEATHER subtable … … 1025 972 mswCols.interval().putColumn( intervalArr ) ; 1026 973 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 ; 1029 976 } 1030 977 1031 978 void MSWriter::fillSysCal() 1032 979 { 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 ; 1035 982 1036 983 //tcalIdRec_.print( cout ) ; … … 1092 1039 ROTableColumn ifnoCol( tab, "IFNO" ) ; 1093 1040 for ( uInt irow = 0 ; irow < nrow ; irow++ ) { 1094 double t1 = gettimeofday_sec() ;1041 // double t1 = gettimeofday_sec() ; 1095 1042 Vector<uInt> ids = tcalIdRec_.asArrayuInt( irow ) ; 1096 os_ << "ids = " << ids << LogIO::POST ;1043 // os_ << "ids = " << ids << LogIO::POST ; 1097 1044 uInt npol = ids.size() ; 1098 1045 Vector<uInt> rows = tcalRowRec_.asArrayuInt( irow ) ; 1099 os_ << "rows = " << rows << LogIO::POST ;1046 // os_ << "rows = " << rows << LogIO::POST ; 1100 1047 Vector<Double> atime( rows.nelements() ) ; 1101 1048 Vector<Double> ainterval( rows.nelements() ) ; … … 1127 1074 Table t ; 1128 1075 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 ; 1130 1077 Vector<Float> dummyC = tcalCol( ids[0] ) ; 1131 1078 tcal.resize( npol, dummyC.size() ) ; … … 1133 1080 } 1134 1081 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 ; 1136 1083 t = stt( stt.col("ID") == ids[0] ) ; 1137 1084 Vector<Float> dummyC = tcalCol( 0 ) ; … … 1141 1088 if ( npol == 2 ) { 1142 1089 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 ; 1144 1091 tcal.row( 1 ) = tcalCol( ids[1] ) ; 1145 1092 } 1146 1093 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 ; 1148 1095 t = stt( stt.col("ID") == ids[1] ) ; 1149 1096 tcalCol.attach( t, "TCAL" ) ; … … 1228 1175 row.put( mssc.nrow()-1 ) ; 1229 1176 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 ; 1232 1179 } 1233 1180 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 ; 1236 1183 } 1237 1184 1238 1185 void MSWriter::addFeed( Int id ) 1239 1186 { 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 ; 1242 1189 1243 1190 // add row … … 1276 1223 msFeedCols.polResponse().put( nrow-1, polResponse ) ; 1277 1224 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 ; 1280 1227 } 1281 1228 1282 1229 void MSWriter::addSpectralWindow( Int spwid, Int freqid ) 1283 1230 { 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 ; 1286 1233 1287 1234 // add row … … 1332 1279 msSpwCols.chanFreq().put( spwid, sharedDoubleArr ) ; 1333 1280 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 ; 1336 1283 } 1337 1284 1338 1285 void MSWriter::addField( Int fid, String fieldname, String srcname, Double t, Vector<Double> rate ) 1339 1286 { 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 ; 1342 1289 1343 1290 MSField msField = mstable_->field() ; … … 1366 1313 Vector<Double> srcDir = msSrcCols.direction()( 0 ) ; 1367 1314 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 ; 1370 1317 srcDirA.column( 0 ) = srcDir ; 1371 os_ << "srcDirA = " << srcDirA << LogIO::POST ;1318 // os_ << "srcDirA = " << srcDirA << LogIO::POST ; 1372 1319 if ( numPoly != 0 ) 1373 1320 srcDirA.column( 1 ) = rate ; … … 1378 1325 msFieldCols.sourceId().put( fid, srcId ) ; 1379 1326 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 ; 1382 1329 } 1383 1330 1384 1331 void MSWriter::addPointing( String &name, Double &me, Double &interval, Matrix<Double> &dir ) 1385 1332 { 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 ; 1388 1335 1389 1336 // access to POINTING subtable … … 1417 1364 row.put( nrow ) ; 1418 1365 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 ; 1421 1368 } 1422 1369 1423 1370 Int MSWriter::addPolarization( Vector<Int> polnos ) 1424 1371 { 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 ; 1429 1376 MSPolarization msPol = mstable_->polarization() ; 1430 1377 uInt nrow = msPol.nrow() ; … … 1480 1427 } 1481 1428 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 ; 1484 1431 1485 1432 return polid ; … … 1488 1435 Int MSWriter::addDataDescription( Int polid, Int spwid ) 1489 1436 { 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 ; 1492 1439 1493 1440 MSDataDescription msDataDesc = mstable_->dataDescription() ; … … 1507 1454 } 1508 1455 } 1509 os_ << "ddid = " << ddid << LogIO::POST ;1456 // os_ << "ddid = " << ddid << LogIO::POST ; 1510 1457 1511 1458 … … 1518 1465 } 1519 1466 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 ; 1522 1469 1523 1470 return ddid ; … … 1526 1473 Int MSWriter::addState( Int st, Int &subscan ) 1527 1474 { 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 ; 1530 1477 1531 1478 // access to STATE subtable … … 1538 1485 Double tload ; 1539 1486 queryType( st, obsMode, isSignal, tnoise, tload ) ; 1540 os_ << "obsMode = " << obsMode << " isSignal = " << isSignal << LogIO::POST ;1487 // os_ << "obsMode = " << obsMode << " isSignal = " << isSignal << LogIO::POST ; 1541 1488 1542 1489 Int idx = -1 ; 1543 1490 ROScalarColumn<String> obsModeCol( msState, "OBS_MODE" ) ; 1544 //ROScalarColumn<Bool> sigCol( msState, "SIG" ) ;1545 //ROScalarColumn<Bool> refCol( msState, "REF" ) ;1546 1491 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() ;1551 1492 for ( uInt irow = 0 ; irow < nrow ; irow++ ) { 1552 1493 if ( obsModeCol(irow) == obsMode … … 1554 1495 //&& refCol(irow) != isSignal 1555 1496 && subscanCol(irow) == subscan ) { 1556 // if ( obsModeArr[irow] == obsMode1557 // && sigArr[irow] == isSignal1558 // && refArr[irow] != isSignal1559 // && subscanArr[irow] == subscan ) {1560 1497 idx = irow ; 1561 1498 break ; … … 1579 1516 *loadRF = tload ; 1580 1517 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 ) ;1589 1518 idx = nrow ; 1590 1519 } 1591 1520 subscan++ ; 1592 1521 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 ; 1595 1524 1596 1525 return idx ; … … 1599 1528 Vector<Int> MSWriter::toCorrType( Vector<Int> polnos ) 1600 1529 { 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 ; 1603 1532 1604 1533 uInt npol = polnos.size() ; … … 1686 1615 } 1687 1616 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 ; 1690 1619 1691 1620 return corrType ; … … 1694 1623 void MSWriter::getValidTimeRange( Double &me, Double &interval, Table &tab ) 1695 1624 { 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 ; 1698 1627 1699 1628 // sort table … … 1712 1641 interval = ( maxTime - minTime ) * 86400.0 ; 1713 1642 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 ; 1716 1645 } 1717 1646 1718 1647 void MSWriter::getValidTimeRange( Double &me, Double &interval, Vector<Double> &atime, Vector<Double> &ainterval ) 1719 1648 { 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 ; 1722 1651 1723 1652 // sort table … … 1734 1663 interval = ( maxTime - minTime ) * 86400.0 + mean( ainterval ) ; 1735 1664 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 ; 1738 1667 } 1739 1668 … … 1741 1670 void MSWriter::queryType( Int type, String &stype, Bool &b, Double &t, Double &l ) 1742 1671 { 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 ; 1745 1674 1746 1675 switch ( type ) { … … 1921 1850 } 1922 1851 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 1856 Double 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 82 82 //void queryType( casa::Int type, casa::String &stype, casa::Bool &b ) ; 83 83 void queryType( casa::Int type, casa::String &stype, casa::Bool &b, casa::Double &t, Double &l ) ; 84 casa::Double getDishDiameter( casa::String antname ) ; 84 85 85 86 // tool for HPC
Note:
See TracChangeset
for help on using the changeset viewer.