Changeset 2004
- Timestamp:
- 02/22/11 20:24:33 (14 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/scantable.py
r1994 r2004 10 10 from asap.env import is_casapy 11 11 from asap._asap import Scantable 12 from asap._asap import filler 12 from asap._asap import filler, msfiller 13 13 from asap.parameters import rcParams 14 14 from asap.logging import asaplog, asaplog_post_dec … … 232 232 if format2 == 'ASAP': 233 233 self._save(name) 234 ## elif format2 == 'MS2': 235 ## msopt = {'ms': {'overwrite': overwrite } } 236 ## from asap._asap import mswriter 237 ## writer = mswriter( self ) 238 ## writer.write( name, msopt ) 234 239 else: 235 240 from asap._asap import stwriter as stw … … 2687 2692 def _check_ifs(self): 2688 2693 #nchans = [self.nchan(i) for i in range(self.nif(-1))] 2689 #nchans = filter(lambda t: t > 0, nchans)2690 2694 nchans = [self.nchan(i) for i in self.getifnos()] 2695 nchans = filter(lambda t: t > 0, nchans) 2691 2696 return (sum(nchans)/len(nchans) == nchans[0]) 2692 2697 … … 2708 2713 for name in fullnames: 2709 2714 tbl = Scantable(stype) 2710 r = filler(tbl) 2711 rx = rcParams['scantable.reference'] 2712 r.setreferenceexpr(rx) 2715 if is_ms( name ): 2716 r = msfiller( tbl ) 2717 else: 2718 r = filler( tbl ) 2719 rx = rcParams['scantable.reference'] 2720 r.setreferenceexpr(rx) 2721 #r = filler(tbl) 2722 #rx = rcParams['scantable.reference'] 2723 #r.setreferenceexpr(rx) 2713 2724 msg = "Importing %s..." % (name) 2714 2725 asaplog.push(msg, False) -
trunk/src/MSFiller.cpp
r2003 r2004 94 94 { 95 95 os_.origin( LogOrigin( "MSFiller", "open()", WHERE ) ) ; 96 double startSec = gettimeofday_sec() ;97 os_ << "start MSFiller::open() startsec=" << startSec << LogIO::POST ;96 // double startSec = gettimeofday_sec() ; 97 // os_ << "start MSFiller::open() startsec=" << startSec << LogIO::POST ; 98 98 //os_ << " filename = " << filename << endl ; 99 99 … … 137 137 isData_ = mstable_.tableDesc().isColumn( "DATA" ) ; 138 138 139 double endSec = gettimeofday_sec() ;140 os_ << "end MSFiller::open() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;139 // double endSec = gettimeofday_sec() ; 140 // os_ << "end MSFiller::open() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ; 141 141 return true ; 142 142 } … … 145 145 { 146 146 os_.origin( LogOrigin( "MSFiller", "fill()", WHERE ) ) ; 147 double startSec = gettimeofday_sec() ;148 os_ << "start MSFiller::fill() startSec=" << startSec << LogIO::POST ;149 150 double time0 = gettimeofday_sec() ;151 os_ << "start init fill: " << time0 << LogIO::POST ;147 // double startSec = gettimeofday_sec() ; 148 // os_ << "start MSFiller::fill() startSec=" << startSec << LogIO::POST ; 149 150 // double time0 = gettimeofday_sec() ; 151 // os_ << "start init fill: " << time0 << LogIO::POST ; 152 152 153 153 // Initialize header … … 175 175 const TableRecord msrec = mstable_.keywordSet() ; 176 176 isDoppler_ = msrec.isDefined( "DOPPLER" ) ; 177 if ( isDoppler_ ) 178 if ( mstable_.doppler().nrow() == 0 ) 179 isDoppler_ = False ; 177 180 isFlagCmd_ = msrec.isDefined( "FLAG_CMD" ) ; 181 if ( isFlagCmd_ ) 182 if ( mstable_.flagCmd().nrow() == 0 ) 183 isFlagCmd_ = False ; 178 184 isFreqOffset_ = msrec.isDefined( "FREQ_OFFSET" ) ; 185 if ( isFreqOffset_ ) 186 if ( mstable_.freqOffset().nrow() == 0 ) 187 isFreqOffset_ = False ; 179 188 isHistory_ = msrec.isDefined( "HISTORY" ) ; 189 if ( isHistory_ ) 190 if ( mstable_.history().nrow() == 0 ) 191 isHistory_ = False ; 180 192 isProcessor_ = msrec.isDefined( "PROCESSOR" ) ; 193 if ( isProcessor_ ) 194 if ( mstable_.processor().nrow() == 0 ) 195 isProcessor_ = False ; 181 196 isSysCal_ = msrec.isDefined( "SYSCAL" ) ; 197 if ( isSysCal_ ) 198 if ( mstable_.sysCal().nrow() == 0 ) 199 isSysCal_ = False ; 182 200 isWeather_ = msrec.isDefined( "WEATHER" ) ; 183 201 if ( isWeather_ ) 202 if ( mstable_.weather().nrow() == 0 ) 203 isWeather_ = False ; 204 184 205 // Access to MS subtables 185 206 MSField fieldtab = mstable_.field() ; … … 198 219 colTsys_ = "TSYS" ; 199 220 } 200 //colTcal_ = "TCAL" ;201 //colTsys_ = "TSYS" ;221 // colTcal_ = "TCAL" ; 222 // colTsys_ = "TSYS" ; 202 223 MSPointing pointtab = mstable_.pointing() ; 203 224 if ( mstable_.weather().nrow() == 0 ) … … 216 237 217 238 // SUBTABLES: WEATHER 218 if ( isWeather_ ) 219 fillWeather() ; 239 fillWeather() ; 220 240 221 241 // SUBTABLES: FOCUS … … 223 243 224 244 // SUBTABLES: TCAL 225 if ( isSysCal_ ) 226 fillTcal( tpoolr ) ; 245 fillTcal( tpoolr ) ; 227 246 228 247 // SUBTABLES: FIT … … 257 276 String telescopeName = "" ; 258 277 259 double time1 = gettimeofday_sec() ;260 os_ << "end fill init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;278 //double time1 = gettimeofday_sec() ; 279 //os_ << "end fill init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ; 261 280 262 281 // row based … … 297 316 TableIterator iter0( mstable_, "OBSERVATION_ID" ) ; 298 317 while( !iter0.pastEnd() ) { 299 time0 = gettimeofday_sec() ;300 os_ << "start 0th iteration: " << time0 << LogIO::POST ;318 //time0 = gettimeofday_sec() ; 319 //os_ << "start 0th iteration: " << time0 << LogIO::POST ; 301 320 Table t0 = iter0.table() ; 302 321 tcolr = tpoolr->construct( t0, "OBSERVATION_ID" ) ; … … 325 344 } 326 345 Int nbeam = 0 ; 327 time1 = gettimeofday_sec() ;328 os_ << "end 0th iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;346 //time1 = gettimeofday_sec() ; 347 //os_ << "end 0th iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ; 329 348 // 330 349 // ITERATION: FEED1 … … 332 351 TableIterator iter1( t0, "FEED1" ) ; 333 352 while( !iter1.pastEnd() ) { 334 time0 = gettimeofday_sec() ;335 os_ << "start 1st iteration: " << time0 << LogIO::POST ;353 //time0 = gettimeofday_sec() ; 354 //os_ << "start 1st iteration: " << time0 << LogIO::POST ; 336 355 Table t1 = iter1.table() ; 337 356 // assume FEED1 == FEED2 … … 349 368 *uintRF = 0 ; 350 369 351 time1 = gettimeofday_sec() ;352 os_ << "end 1st iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;370 //time1 = gettimeofday_sec() ; 371 //os_ << "end 1st iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ; 353 372 // 354 373 // ITERATION: FIELD_ID … … 356 375 TableIterator iter2( t1, "FIELD_ID" ) ; 357 376 while( !iter2.pastEnd() ) { 358 time0 = gettimeofday_sec() ;359 os_ << "start 2nd iteration: " << time0 << LogIO::POST ;377 //time0 = gettimeofday_sec() ; 378 //os_ << "start 2nd iteration: " << time0 << LogIO::POST ; 360 379 Table t2 = iter2.table() ; 361 380 tcolr = tpoolr->construct( t2, "FIELD_ID" ) ; … … 368 387 String fieldName = tcolr->asString( fieldId ) + "__" + String::toString(fieldId) ; 369 388 tpoolr->destroy( tcolr ) ; 389 ROArrayMeasColumn<MDirection> *delayDirCol = new ROArrayMeasColumn<MDirection>( fieldtab, "DELAY_DIR" ) ; 390 Vector<MDirection> delayDir = (*delayDirCol)( fieldId ) ; 391 delete delayDirCol ; 392 Vector<Double> defaultScanrate( 2, 0.0 ) ; 393 Vector<Double> defaultDir = delayDir[0].getAngle( "rad" ).getValue() ; 394 if ( delayDir.nelements() > 1 ) 395 defaultScanrate = delayDir[1].getAngle( "rad" ).getValue() ; 396 370 397 371 398 // FIELDNAME … … 374 401 375 402 376 time1 = gettimeofday_sec() ;377 os_ << "end 2nd iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;403 //time1 = gettimeofday_sec() ; 404 //os_ << "end 2nd iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ; 378 405 // 379 406 // ITERATION: DATA_DESC_ID … … 381 408 TableIterator iter3( t2, "DATA_DESC_ID" ) ; 382 409 while( !iter3.pastEnd() ) { 383 time0 = gettimeofday_sec() ;384 os_ << "start 3rd iteration: " << time0 << LogIO::POST ;410 //time0 = gettimeofday_sec() ; 411 //os_ << "start 3rd iteration: " << time0 << LogIO::POST ; 385 412 Table t3 = iter3.table() ; 386 413 tcolr = tpoolr->construct( t3, "DATA_DESC_ID" ) ; … … 393 420 Int spwId = tcolr->asInt( ddId ) ; 394 421 tpoolr->destroy( tcolr ) ; 422 // TODO: This must be updated if writer will be replaced from STWriter to MSWriter 423 sdh.nif = max( sdh.nif, spwId ) ; 395 424 396 425 // IFNO … … 410 439 if ( sdh.poltype == "" ) sdh.poltype = getPolType( corrtype[0] ) ; 411 440 // source information 412 MSSource srctabSel( srctab( srctab.col("SOURCE_ID") == srcId && srctab.col("SPECTRAL_WINDOW_ID") == spwId ) ) ; 413 os_ << "srcId = " << srcId << " spwId = " << spwId << " nrow = " << srctabSel.nrow() << LogIO::POST ; 441 //os_ << "srcId = " << srcId << ", spwId = " << spwId << LogIO::POST ; 442 MSSource srctabSel = srctab( srctab.col("SOURCE_ID") == srcId && srctab.col("SPECTRAL_WINDOW_ID") == spwId ) ; 443 if ( srctabSel.nrow() == 0 ) { 444 srctabSel = srctab( srctab.col("SOURCE_ID") == srcId && srctab.col("SPECTRAL_WINDOW_ID") == -1 ) ; 445 } 414 446 tcolr = tpoolr->construct( srctabSel, "NAME" ) ; 415 447 String srcName = tcolr->asString( 0 ) ; … … 479 511 //os_ << "restFreqs = " << restFreqs << LogIO::POST ; 480 512 if ( srctabSel.tableDesc().isColumn( "TRANSITION" ) ) { 481 tcolr = tpoolr->construct( srctabSel, "TRANSITION" ) ;482 transitionName = tcolr->asString( 0 ) ;483 tpoolr->destroy( tcolr) ;484 //os_ << "transitionNameCol.nrow() = " << transition NameCol.nrow() << LogIO::POST ;513 ROArrayColumn<String> transitionCol( srctabSel, "TRANSITION" ) ; 514 if ( transitionCol.isDefined( 0 ) ) 515 transitionName = transitionCol( 0 ) ; 516 //os_ << "transitionNameCol.nrow() = " << transitionCol.nrow() << LogIO::POST ; 485 517 } 486 518 } … … 567 599 568 600 // for TSYS and TCAL 569 MSSysCal caltabsel( caltab( caltab.col("ANTENNA_ID") == antenna_ && caltab.col("FEED_ID") == feedId && caltab.col("SPECTRAL_WINDOW_ID") == spwId ).sort("TIME") ) ; 570 ROScalarMeasColumn<MEpoch> scTimeCol( caltabsel, "TIME" ) ; 571 Vector<MEpoch> scTime( caltabsel.nrow() ) ; 572 for ( uInt irow = 0 ; irow < caltabsel.nrow() ; irow++ ) 573 scTime[irow] = scTimeCol( irow ) ; 574 ROScalarColumn<Double> *scIntervalCol = new ROScalarColumn<Double>( caltabsel, "INTERVAL" ) ; 575 Vector<Double> scInterval = scIntervalCol->getColumn() ; 576 delete scIntervalCol ; 577 ROArrayColumn<Float> scTsysCol( caltabsel, "TSYS" ) ; 578 time1 = gettimeofday_sec() ; 579 os_ << "end 3rd iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ; 601 Vector<MEpoch> scTime ; 602 Vector<Double> scInterval ; 603 ROArrayColumn<Float> scTsysCol ; 604 MSSysCal caltabsel ; 605 if ( isSysCal_ ) { 606 caltabsel = caltab( caltab.col("ANTENNA_ID") == antenna_ && caltab.col("FEED_ID") == feedId && caltab.col("SPECTRAL_WINDOW_ID") == spwId ).sort("TIME") ; 607 ROScalarMeasColumn<MEpoch> scTimeCol( caltabsel, "TIME" ) ; 608 scTime.resize( caltabsel.nrow() ) ; 609 for ( uInt irow = 0 ; irow < caltabsel.nrow() ; irow++ ) 610 scTime[irow] = scTimeCol( irow ) ; 611 ROScalarColumn<Double> *scIntervalCol = new ROScalarColumn<Double>( caltabsel, "INTERVAL" ) ; 612 scInterval = scIntervalCol->getColumn() ; 613 delete scIntervalCol ; 614 scTsysCol.attach( caltabsel, colTsys_ ) ; 615 } 616 //time1 = gettimeofday_sec() ; 617 //os_ << "end 3rd iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ; 580 618 // 581 619 // ITERATION: SCAN_NUMBER … … 583 621 TableIterator iter4( t3, "SCAN_NUMBER" ) ; 584 622 while( !iter4.pastEnd() ) { 585 time0 = gettimeofday_sec() ;586 os_ << "start 4th iteration: " << time0 << LogIO::POST ;623 //time0 = gettimeofday_sec() ; 624 //os_ << "start 4th iteration: " << time0 << LogIO::POST ; 587 625 Table t4 = iter4.table() ; 588 626 tcolr = tpoolr->construct( t4, "SCAN_NUMBER" ) ; … … 594 632 *uintRF = scanNum - 1 ; 595 633 596 uInt cycle = 0 ; 597 time1 = gettimeofday_sec() ; 598 os_ << "end 4th iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ; 634 //time1 = gettimeofday_sec() ; 635 //os_ << "end 4th iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ; 599 636 // 600 637 // ITERATION: STATE_ID … … 602 639 TableIterator iter5( t4, "STATE_ID" ) ; 603 640 while( !iter5.pastEnd() ) { 604 time0 = gettimeofday_sec() ;605 os_ << "start 5th iteration: " << time0 << LogIO::POST ;641 //time0 = gettimeofday_sec() ; 642 //os_ << "start 5th iteration: " << time0 << LogIO::POST ; 606 643 Table t5 = iter5.table() ; 607 644 tcolr = tpoolr->construct( t5, "STATE_ID" ) ; … … 614 651 615 652 Int nrow = t5.nrow() ; 616 time1 = gettimeofday_sec() ; 617 os_ << "end 5th iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ; 653 //time1 = gettimeofday_sec() ; 654 //os_ << "end 5th iteration init: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ; 655 656 uInt cycle = 0 ; 618 657 619 658 Cube<Float> spArr ; … … 632 671 else if ( isData_ ) { 633 672 spArr.resize( npol, nchan, nrow ) ; 673 flArr.resize( npol, nchan, nrow ) ; 634 674 ROArrayColumn<Bool> mFlagCol( t5, "FLAG" ) ; 635 675 ROArrayColumn<Complex> mDataCol( t5, "DATA" ) ; … … 638 678 Matrix<Complex> sp = mDataCol( irow ) ; 639 679 Matrix<Bool> fl = mFlagCol( irow ) ; 680 Matrix<Float> spxy = spArr.xyPlane( irow ) ; 681 Matrix<Bool> flxy = flArr.xyPlane( irow ) ; 640 682 for ( Int ipol = 0 ; ipol < npol ; ipol++ ) { 641 683 if ( corrtype[ipol] == Stokes::XY || corrtype[ipol] == Stokes::YX 642 684 || corrtype[ipol] == Stokes::RL || corrtype[ipol] == Stokes::LR ) { 643 685 if ( !crossOK ) { 644 sp Arr( Slicer(Slice(ipol,1),Slice(0,nchan),Slice(irow,1))) = real( sp.row( ipol ) ) ;645 fl Arr( Slicer(Slice(ipol,1),Slice(0,nchan),Slice(irow,1))) = fl.row( ipol ) ;686 spxy.row( ipol ) = real( sp.row( ipol ) ) ; 687 flxy.row( ipol ) = fl.row( ipol ) ; 646 688 if ( corrtype[ipol] == Stokes::XY || corrtype[ipol] == Stokes::RL ) { 647 sp Arr( Slicer(Slice(ipol+1,1),Slice(0,nchan),Slice(irow,1))) = imag( sp.row( ipol ) ) ;648 fl Arr( Slicer(Slice(ipol+1,1),Slice(0,nchan),Slice(irow,1))) = fl.row( ipol ) ;689 spxy.row( ipol+1 ) = imag( sp.row( ipol ) ) ; 690 flxy.row( ipol+1 ) = fl.row( ipol ) ; 649 691 } 650 692 else { 651 sp Arr( Slicer(Slice(ipol+1,1),Slice(0,nchan),Slice(irow,1))) = imag( conj( sp.row( ipol ) ) ) ;652 fl Arr( Slicer(Slice(ipol+1,1),Slice(0,nchan),Slice(irow,1))) = fl.row( ipol ) ;693 spxy.row( ipol+1 ) = imag( conj( sp.row( ipol ) ) ) ; 694 flxy.row( ipol+1 ) = fl.row( ipol ) ; 653 695 } 696 crossOK = True ; 654 697 } 655 698 } 656 699 else { 657 sp Arr( Slicer(Slice(ipol,1),Slice(0,nchan),Slice(irow,1)) ) = real( sp.row( ipol ) ) ;658 fl Arr( Slicer(Slice(ipol,1),Slice(0,nchan),Slice(irow,1)) ) = fl.row( ipol ) ;700 spxy.row( ipol ) = real( sp.row( ipol ) ) ; 701 flxy.row( ipol ) = fl.row( ipol ) ; 659 702 } 660 703 } … … 672 715 ROTableColumn *mIntervalCol = tpoolr->construct( t5, "INTERVAL" ) ; 673 716 ROTableColumn *mFlagRowCol = tpoolr->construct( t5, "FLAG_ROW" ) ; 674 //Vector<Double> sysCalTime( nrow, -1.0 ) ;675 717 Block<Double> sysCalTime( nrow, -1.0 ) ; 676 718 Block<Int> sysCalIdx( nrow, -1 ) ; 677 719 if ( isSysCal_ ) { 678 //getSysCalTime( caltabsel, mTimeB, sysCalTime, sysCalIdx ) ;679 720 getSysCalTime( scTime, scInterval, mTimeB, sysCalTime, sysCalIdx ) ; 680 721 } 681 722 delete mTimeCol ; 682 723 Matrix<Float> defaulttsys( npol, 1, 1.0 ) ; 683 //uInt calidx = 0 ;684 724 Int srcType = getSrcType( stateId, tpoolr ) ; 685 Vector<Double> defaultScanrate( 2, 0.0 ) ;686 725 uInt diridx = 0 ; 687 726 MDirection::Types dirType ; … … 720 759 721 760 // SPECTRA, FLAG 722 //Matrix<Float> sp = mFloatDataCol( irow ) ;723 //Matrix<Bool> flb = mFlagCol( irow ) ;724 761 Matrix<Float> sp = spArr.xyPlane( irow ) ; 725 762 Matrix<Bool> flb = flArr.xyPlane( irow ) ; … … 728 765 729 766 // TIME 730 *timeRF = mTimeB[irow].get(" s").getValue() ;767 *timeRF = mTimeB[irow].get("d").getValue() ; 731 768 732 769 // INTERVAL … … 735 772 // TSYS 736 773 Matrix<Float> tsys ; 737 //calidx = getTsys( calidx, tsys, caltabsel, sysCalTime[irow] ) ;738 // calidx = getTsys( calidx, tsys, scTsysCol, scTime, sysCalTime[irow] ) ;739 // if ( tsys.nelements() == 0 )740 // tsys = defaulttsys ;741 774 if ( sysCalIdx[irow] != -1 ) 742 775 tsys = scTsysCol( irow ) ; … … 745 778 746 779 // TCAL_ID 747 Block<uInt> tcalids = getTcalId( feedId, spwId, sysCalTime[irow] ) ; 748 if ( tcalids.size() == 0 ) { 749 tcalids.resize( npol ) ; 750 tcalids = 0 ; 780 Block<uInt> tcalids( npol, 0 ) ; 781 if ( sysCalIdx[irow] != -1 ) { 782 tcalids = getTcalId( feedId, spwId, scTime[sysCalIdx[irow]] ) ; 751 783 } 752 784 … … 798 830 else { 799 831 String ref = md.getRefString() ; 800 Vector<Double> defaultDir = srcDir ;832 //Vector<Double> defaultDir = srcDir ; 801 833 MDirection::getType( dirType, "J2000" ) ; 802 834 if ( ref != "J2000" ) { … … 829 861 row.put( stab.nrow()-1 ) ; 830 862 } 863 864 cycle++ ; 831 865 } 832 //delete mTimeCol ;833 866 tpoolr->destroy( mIntervalCol ) ; 834 867 tpoolr->destroy( mFlagRowCol ) ; 835 868 836 time1 = gettimeofday_sec() ;837 os_ << "end 5th iteration: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ;869 //time1 = gettimeofday_sec() ; 870 //os_ << "end 5th iteration: " << time1 << " (" << time1-time0 << "sec)" << LogIO::POST ; 838 871 839 872 iter5.next() ; … … 865 898 866 899 // Table Keywords 867 sdh.nif = ifmap.size() ; 900 // TODO: This must be updated if writer will be replaced from STWriter to MSWriter 901 // sdh.nif = ifmap.size() ; 902 sdh.nif++ ; 868 903 if ( ( telescopeName == "" ) || ( antennaName == telescopeName ) ) { 869 904 sdh.antennaname = antennaName ; … … 910 945 stab.rwKeywordSet().define( "GBT_GO", goTabName ) ; 911 946 } 912 double endSec = gettimeofday_sec() ;913 os_ << "end MSFiller::fill() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;947 // double endSec = gettimeofday_sec() ; 948 // os_ << "end MSFiller::fill() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ; 914 949 } 915 950 … … 924 959 Int MSFiller::getSrcType( Int stateId, boost::object_pool<ROTableColumn> *tpool ) 925 960 { 926 double startSec = gettimeofday_sec() ;927 os_ << "start MSFiller::getSrcType() startSec=" << startSec << LogIO::POST ;961 // double startSec = gettimeofday_sec() ; 962 // os_ << "start MSFiller::getSrcType() startSec=" << startSec << LogIO::POST ; 928 963 929 964 MSState statetab = mstable_.state() ; … … 1031 1066 1032 1067 //os_ << "srcType = " << srcType << LogIO::POST ; 1033 double endSec = gettimeofday_sec() ;1034 os_ << "end MSFiller::getSrcType() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;1068 // double endSec = gettimeofday_sec() ; 1069 // os_ << "end MSFiller::getSrcType() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ; 1035 1070 return srcType ; 1036 1071 } … … 1039 1074 Block<uInt> MSFiller::getPolNo( Int corrType ) 1040 1075 { 1041 double startSec = gettimeofday_sec() ;1042 os_ << "start MSFiller::getPolNo() startSec=" << startSec << LogIO::POST ;1076 // double startSec = gettimeofday_sec() ; 1077 // os_ << "start MSFiller::getPolNo() startSec=" << startSec << LogIO::POST ; 1043 1078 Block<uInt> polno( 1 ) ; 1044 1079 … … 1070 1105 } 1071 1106 //os_ << "polno = " << polno << LogIO::POST ; 1072 double endSec = gettimeofday_sec() ;1073 os_ << "end MSFiller::getPolNo() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;1107 // double endSec = gettimeofday_sec() ; 1108 // os_ << "end MSFiller::getPolNo() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ; 1074 1109 1075 1110 return polno ; … … 1078 1113 String MSFiller::getPolType( Int corrType ) 1079 1114 { 1080 double startSec = gettimeofday_sec() ;1081 os_ << "start MSFiller::getPolType() startSec=" << startSec << LogIO::POST ;1115 // double startSec = gettimeofday_sec() ; 1116 // os_ << "start MSFiller::getPolType() startSec=" << startSec << LogIO::POST ; 1082 1117 String poltype = "" ; 1083 1118 … … 1091 1126 poltype = "linpol" ; 1092 1127 1093 double endSec = gettimeofday_sec() ;1094 os_ << "end MSFiller::getPolType() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;1128 // double endSec = gettimeofday_sec() ; 1129 // os_ << "end MSFiller::getPolType() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ; 1095 1130 return poltype ; 1096 1131 } … … 1098 1133 void MSFiller::fillWeather() 1099 1134 { 1100 double startSec = gettimeofday_sec() ; 1101 os_ << "start MSFiller::fillWeather() startSec=" << startSec << LogIO::POST ; 1135 // double startSec = gettimeofday_sec() ; 1136 // os_ << "start MSFiller::fillWeather() startSec=" << startSec << LogIO::POST ; 1137 1138 if ( !isWeather_ ) { 1139 // add dummy row 1140 table_->weather().table().addRow(1,True) ; 1141 return ; 1142 } 1143 1102 1144 Table mWeather = mstable_.weather() ; 1103 1145 //Table mWeatherSel = mWeather( mWeather.col("ANTENNA_ID") == antenna_ ).sort("TIME") ; … … 1174 1216 mwInterval_ *= 86400.0 ; 1175 1217 //os_ << "mwTime[0] = " << mwTime_[0] << " mwInterval[0] = " << mwInterval_[0] << LogIO::POST ; 1176 double endSec = gettimeofday_sec() ;1177 os_ << "end MSFiller::fillWeather() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;1218 // double endSec = gettimeofday_sec() ; 1219 // os_ << "end MSFiller::fillWeather() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ; 1178 1220 } 1179 1221 1180 1222 void MSFiller::fillFocus() 1181 1223 { 1182 double startSec = gettimeofday_sec() ;1183 os_ << "start MSFiller::fillFocus() startSec=" << startSec << LogIO::POST ;1224 // double startSec = gettimeofday_sec() ; 1225 // os_ << "start MSFiller::fillFocus() startSec=" << startSec << LogIO::POST ; 1184 1226 // tentative 1185 1227 Table tab = table_->focus().table() ; … … 1187 1229 ScalarColumn<uInt> idCol( tab, "ID" ) ; 1188 1230 idCol.put( 0, 0 ) ; 1189 double endSec = gettimeofday_sec() ;1190 os_ << "end MSFiller::fillFocus() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;1231 // double endSec = gettimeofday_sec() ; 1232 // os_ << "end MSFiller::fillFocus() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ; 1191 1233 } 1192 1234 1193 1235 void MSFiller::fillTcal( boost::object_pool<ROTableColumn> *tpoolr ) 1194 1236 { 1195 double startSec = gettimeofday_sec() ; 1196 os_ << "start MSFiller::fillTcal() startSec=" << startSec << LogIO::POST ; 1237 // double startSec = gettimeofday_sec() ; 1238 // os_ << "start MSFiller::fillTcal() startSec=" << startSec << LogIO::POST ; 1239 1240 if ( !isSysCal_ ) { 1241 // add dummy row 1242 os_ << "No SysCal rows" << LogIO::POST ; 1243 table_->tcal().table().addRow(1,True) ; 1244 return ; 1245 } 1197 1246 1198 1247 Table sctab = mstable_.sysCal() ; … … 1264 1313 1265 1314 //tcalrec_.print( std::cout ) ; 1266 double endSec = gettimeofday_sec() ;1267 os_ << "end MSFiller::fillTcal() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;1315 // double endSec = gettimeofday_sec() ; 1316 // os_ << "end MSFiller::fillTcal() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ; 1268 1317 } 1269 1318 1270 1319 uInt MSFiller::getWeatherId( uInt idx, Double wtime ) 1271 1320 { 1272 double startSec = gettimeofday_sec() ;1273 os_ << "start MSFiller::getWeatherId() startSec=" << startSec << LogIO::POST ;1321 // double startSec = gettimeofday_sec() ; 1322 // os_ << "start MSFiller::getWeatherId() startSec=" << startSec << LogIO::POST ; 1274 1323 uInt nrow = mwTime_.size() ; 1275 1324 if ( nrow == 0 ) … … 1300 1349 //os_ << LogIO::WARN << "Couldn't find correct WEATHER_ID for time " << wtime << LogIO::POST ; 1301 1350 1302 double endSec = gettimeofday_sec() ;1303 os_ << "end MSFiller::getWeatherId() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;1351 // double endSec = gettimeofday_sec() ; 1352 // os_ << "end MSFiller::getWeatherId() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ; 1304 1353 return wid ; 1305 1354 } … … 1307 1356 void MSFiller::getSysCalTime( Vector<MEpoch> &scTime, Vector<Double> &scInterval, Block<MEpoch> &tcol, Block<Double> &tstr, Block<Int> &tidx ) 1308 1357 { 1309 double startSec = gettimeofday_sec() ; 1310 os_ << "start MSFiller::getSysCalTime() startSec=" << startSec << LogIO::POST ; 1358 // double startSec = gettimeofday_sec() ; 1359 // os_ << "start MSFiller::getSysCalTime() startSec=" << startSec << LogIO::POST ; 1360 1361 if ( !isSysCal_ ) 1362 return ; 1363 1311 1364 uInt nrow = tstr.nelements() ; 1312 1365 if ( scTime.nelements() == 0 ) … … 1321 1374 for ( uInt i = 0 ; i < nrow ; i++ ) { 1322 1375 Double t = tcol[i].get( "s" ).getValue() ; 1323 os_ << "getSysCalTime() irow = " << i << " idx = " << idx << LogIO::POST ;1324 1376 for ( uInt j = idx ; j < scnrow-1 ; j++ ) { 1325 1377 Double tsc1 = scTime[j].get( "s" ).getValue() ; … … 1343 1395 } 1344 1396 } 1345 double endSec = gettimeofday_sec() ;1346 os_ << "end MSFiller::getSysCalTime() endSec=" << endSec << " (" << endSec-startSec << "sec) scnrow = " << scnrow << " tcol.nelements = " << tcol.nelements() << LogIO::POST ;1397 // double endSec = gettimeofday_sec() ; 1398 // os_ << "end MSFiller::getSysCalTime() endSec=" << endSec << " (" << endSec-startSec << "sec) scnrow = " << scnrow << " tcol.nelements = " << tcol.nelements() << LogIO::POST ; 1347 1399 return ; 1348 1400 } 1349 1401 1350 // uInt MSFiller::getTsys( uInt idx, Matrix<Float> &tsys, ROArrayColumn<Float> &mTsysCol, Block<MEpoch> &scTimeCol, Double t ) 1351 //{1402 Block<uInt> MSFiller::getTcalId( Int fid, Int spwid, MEpoch &t ) 1403 { 1352 1404 // double startSec = gettimeofday_sec() ; 1353 // os_ << "start MSFiller::getTsys() startSec=" << startSec << LogIO::POST ; 1354 // uInt nrow = mTsysCol.nrow() ; 1355 // if ( nrow == 0 ) { 1356 // os_ << "No SysCal rows" << LogIO::POST ; 1357 // tsys.resize( IPosition(0) ) ; 1358 // return 0 ; 1359 // } 1360 // for ( uInt i = idx ; i < nrow ; i++ ) { 1361 // Double tref = scTimeCol[i].get("s").getValue() ; 1362 // if ( t == tref ) { 1363 // tsys.reference( mTsysCol( i ) ) ; 1364 // idx = i ; 1365 // break ; 1366 // } 1367 // } 1368 // //os_ << "MSFiller::getTsys() idx = " << idx << " tsys = " << tsys << LogIO::POST ; 1369 // double endSec = gettimeofday_sec() ; 1370 // os_ << "end MSFiller::getTsys() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ; 1371 // return idx ; 1372 // } 1373 1374 Block<uInt> MSFiller::getTcalId( Int fid, Int spwid, Double t ) 1375 { 1376 double startSec = gettimeofday_sec() ; 1377 os_ << "start MSFiller::getTcalId() startSec=" << startSec << LogIO::POST ; 1378 if ( table_->tcal().table().nrow() == 0 ) { 1405 // os_ << "start MSFiller::getTcalId() startSec=" << startSec << LogIO::POST ; 1406 //if ( table_->tcal().table().nrow() == 0 ) { 1407 if ( !isSysCal_ ) { 1379 1408 os_ << "No TCAL rows" << LogIO::POST ; 1380 1409 Block<uInt> tcalids( 0 ) ; 1381 1410 return tcalids ; 1382 1411 } 1383 String sctime = MVTime( Quantum<Double>(t,"s") ).string(MVTime::YMD) ; 1412 //String sctime = MVTime( Quantum<Double>(t,"s") ).string(MVTime::YMD) ; 1413 String sctime = MVTime( t.getValue() ).string(MVTime::YMD) ; 1384 1414 String key = keyTcal( fid, spwid, sctime ) ; 1385 1415 if ( !tcalrec_.isDefined( key ) ) { … … 1396 1426 tcalids[ipol] = ids[0] + ipol - 1 ; 1397 1427 1398 double endSec = gettimeofday_sec() ;1399 os_ << "end MSFiller::getTcalId() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;1428 // double endSec = gettimeofday_sec() ; 1429 // os_ << "end MSFiller::getTcalId() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ; 1400 1430 return tcalids ; 1401 1431 } … … 1403 1433 uInt MSFiller::getDirection( uInt idx, Vector<Double> &dir, Vector<Double> &srate, String &ref, MSPointing &tab, Double t ) 1404 1434 { 1405 double startSec = gettimeofday_sec() ;1406 os_ << "start MSFiller::getDirection() startSec=" << startSec << LogIO::POST ;1435 // double startSec = gettimeofday_sec() ; 1436 // os_ << "start MSFiller::getDirection() startSec=" << startSec << LogIO::POST ; 1407 1437 // assume that cols is sorted by TIME 1408 1438 Bool doInterp = False ; … … 1417 1447 if ( idx == 0 ) { 1418 1448 uInt nrowb = 75000 ; 1419 if ( nrow > n block) {1449 if ( nrow > nrowb ) { 1420 1450 uInt nblock = nrow / nrowb + 1 ; 1421 1451 for ( uInt iblock = 0 ; iblock < nblock ; iblock++ ) { 1422 uInt high = min( n block, nrow-iblock*nblock) ;1452 uInt high = min( nrowb, nrow-iblock*nrowb ) ; 1423 1453 1424 1454 if ( tcol( high-1 ).get( "s" ).getValue() < t ) { 1425 idx = iblock * n block;1455 idx = iblock * nrowb ; 1426 1456 continue ; 1427 1457 } … … 1429 1459 Vector<MEpoch> tarr( high ) ; 1430 1460 for ( uInt irow = 0 ; irow < high ; irow++ ) { 1431 tarr[irow] = tcol( iblock*n block+irow ) ;1461 tarr[irow] = tcol( iblock*nrowb+irow ) ; 1432 1462 } 1433 1463 1434 1464 uInt bidx = binarySearch( tarr, t ) ; 1435 1465 1436 idx = iblock * n block+ bidx ;1466 idx = iblock * nrowb + bidx ; 1437 1467 break ; 1438 1468 } … … 1510 1540 } 1511 1541 1512 double endSec = gettimeofday_sec() ;1513 os_ << "end MSFiller::getDirection() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;1542 // double endSec = gettimeofday_sec() ; 1543 // os_ << "end MSFiller::getDirection() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ; 1514 1544 return idx ; 1515 1545 } -
trunk/src/MSFiller.h
r2003 r2004 86 86 void getSysCalTime( casa::Vector<casa::MEpoch> &scTimeIn, casa::Vector<casa::Double> &scInterval, casa::Block<casa::MEpoch> &tcol, casa::Block<casa::Double> &scTimeOut, casa::Block<casa::Int> &tidx ) ; 87 87 88 // get tsys by time stamp89 // assume that tab is selected by ANTENNA_ID, FEED_ID, SPECTRAL_WINDOW_ID90 // and sorted by TIME91 // casa::uInt getTsys( casa::uInt idx, casa::Matrix<casa::Float> &tsys, casa::ROArrayColumn<casa::Float> &tsysCol, casa::Block<casa::MEpoch> &scTime, casa::Double t ) ;92 93 88 // get TCAL_ID 94 casa::Block<casa::uInt> getTcalId( casa::Int feedId, casa::Int spwId, casa:: Doublet ) ;89 casa::Block<casa::uInt> getTcalId( casa::Int feedId, casa::Int spwId, casa::MEpoch &t ) ; 95 90 96 91 // get direction for DIRECTION, AZIMUTH, and ELEVATION columns -
trunk/src/STMath.cpp
r1967 r2004 1047 1047 if ( tcal <= 0.0 ) { 1048 1048 caloff->tcal().getEntry(tcalt, tcalout, tcalId); 1049 if (polno<=3) { 1050 tcalUsed = tcalout[polno]; 1051 } 1049 // if (polno<=3) { 1050 // tcalUsed = tcalout[polno]; 1051 // } 1052 // else { 1053 // tcalUsed = tcalout[0]; 1054 // } 1055 if ( tcalout.size() == 1 ) 1056 tcalUsed = tcalout[0] ; 1057 else if ( tcalout.size() == nchan ) 1058 tcalUsed = mean(tcalout) ; 1052 1059 else { 1053 tcalUsed = tcalout[0]; 1060 uInt ipol = polno ; 1061 if ( ipol > 3 ) ipol = 0 ; 1062 tcalUsed = tcalout[ipol] ; 1054 1063 } 1055 1064 } -
trunk/src/STWriter.cpp
r1819 r2004 228 228 inst->molecules().getEntry(pksrec.restFreq,stmp0,stmp1, 229 229 rec.asuInt("MOLECULE_ID")); 230 inst->tcal().getEntry(pksrec.tcalTime, pksrec.tcal,231 rec.asuInt("TCAL_ID"));230 // inst->tcal().getEntry(pksrec.tcalTime, pksrec.tcal, 231 // rec.asuInt("TCAL_ID")); 232 232 inst->weather().getEntry(pksrec.temperature, pksrec.pressure, 233 233 pksrec.humidity, pksrec.windSpeed, … … 240 240 // dummy data 241 241 uInt npol = pksrec.spectra.ncolumn(); 242 243 // TCAL 244 inst->tcal().getEntry( pksrec.tcalTime, pksrec.tcal, 245 rec.asuInt("TCAL_ID") ) ; 246 if ( pksrec.tcal.nelements() == 1 ) { 247 ROScalarColumn<uInt> uintCol( itable, "TCAL_ID" ) ; 248 Vector<uInt> tcalids = uintCol.getColumn() ; 249 pksrec.tcal.resize( npol ) ; 250 Vector<Float> dummyA ; 251 String dummyS ; 252 for ( uInt ipol = 0 ; ipol < npol ; ipol++ ) { 253 inst->tcal().getEntry( dummyS, dummyA, tcalids[ipol] ) ; 254 pksrec.tcal[ipol] = dummyA[0] ; 255 } 256 } 257 else if ( pksrec.tcal.nelements() == nchan ) { 258 ROScalarColumn<uInt> uintCol( itable, "TCAL_ID" ) ; 259 Vector<uInt> tcalids = uintCol.getColumn() ; 260 pksrec.tcal.resize( npol ) ; 261 Vector<Float> dummyA ; 262 String dummyS ; 263 for ( uInt ipol = 0 ; ipol < npol ; ipol++ ) { 264 inst->tcal().getEntry( dummyS, dummyA, tcalids[ipol] ) ; 265 pksrec.tcal[ipol] = mean( dummyA ) ; 266 } 267 } 268 //LogIO os ; 269 //os << "npol = " << npol << " pksrec.tcal = " << pksrec.tcal << LogIO::POST ; 242 270 243 271 pksrec.mjd = rec.asDouble("TIME");
Note:
See TracChangeset
for help on using the changeset viewer.