Changeset 2246
- Timestamp:
- 07/25/11 14:41:23 (13 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/MSFiller.cpp
r2245 r2246 260 260 delete sharedQDArrCol ; 261 261 MPosition mp( MVPosition( antpos ), MPosition::ITRF ) ; 262 Vector<Double> pt ; 263 ROArrayColumn<Double> pdcol ; 264 Vector<Double> defaultScanrate( 2, 0.0 ) ; 262 265 if ( getPt_ ) { 263 266 pointtab = MSPointing( pointtab( pointtab.col("ANTENNA_ID")==antenna_ ).sort("TIME") ) ; 264 } 265 ROScalarColumn<Double> ptcol( pointtab, "TIME" ) ; 266 ROArrayColumn<Double> pdcol( pointtab, "DIRECTION" ) ; 267 ROScalarColumn<Double> ptcol( pointtab, "TIME" ) ; 268 ptcol.getColumn( pt ) ; 269 TableRecord trec = ptcol.keywordSet() ; 270 String tUnit = trec.asArrayString( "QuantumUnits" ).data()[0] ; 271 if ( tUnit == "d" ) 272 pt *= 86400.0 ; 273 pdcol.attach( pointtab, "DIRECTION" ) ; 274 } 267 275 String stationName = asString( "STATION", antenna_, anttab, tpoolr ) ; 268 276 String antennaName = asString( "NAME", antenna_, anttab, tpoolr ) ; … … 497 505 for ( uInt irow = 0 ; irow < caltabsel.nrow() ; irow++ ) 498 506 scTime[irow] = scTimeCol( irow ) ; 499 ROScalarColumn<Double> *scIntervalCol = new ROScalarColumn<Double>( caltabsel, "INTERVAL" ) ; 500 scInterval = scIntervalCol->getColumn() ; 501 delete scIntervalCol ; 507 ROScalarColumn<Double> scIntervalCol( caltabsel, "INTERVAL" ) ; 508 scIntervalCol.getColumn( scInterval ) ; 502 509 if ( colTsys_ != "NONE" ) 503 510 scTsysCol.attach( caltabsel, colTsys_ ) ; … … 566 573 for ( Int irow = 0 ; irow < nrow ; irow++ ) 567 574 mTimeB[irow] = (*mTimeCol)( irow ) ; 568 // ROTableColumn *mIntervalCol = tpoolr->construct( t5, "INTERVAL" ) ;569 // ROTableColumn *mFlagRowCol = tpoolr->construct( t5, "FLAG_ROW" ) ;570 575 Block<Int> sysCalIdx( nrow, -1 ) ; 571 576 if ( isSysCal_ ) { … … 606 611 607 612 // FLAGROW 608 // *flrRF = (uInt)mFlagRowCol->asBool( irow ) ;609 613 *flrRF = (uInt)asBool( "FLAG_ROW", irow, t5, tpoolr ) ; 610 614 … … 619 623 620 624 // INTERVAL 621 // *intervalRF = (Double)(mIntervalCol->asdouble( irow )) ;622 625 *intervalRF = asDouble( "INTERVAL", irow, t5, tpoolr ) ; 623 626 … … 648 651 Vector<Double> dir ; 649 652 Vector<Double> azel ; 650 Vector<Double> scanrate ;653 Vector<Double> scanrate = defaultScanrate ; 651 654 String refString ; 652 655 if ( getPt_ ) 653 //diridx = getDirection( diridx, dir, azel, scanrate, pointtab, mTimeB[irow], mp ) ; 654 diridx = getDirection( diridx, dir, azel, scanrate, ptcol, pdcol, mTimeB[irow], mp ) ; 656 diridx = getDirection( diridx, dir, azel, scanrate, pt, pdcol, mTimeB[irow], mp ) ; 655 657 else 656 658 getSourceDirection( dir, azel, scanrate, mTimeB[irow], mp, delayDir ) ; … … 1404 1406 Vector<Double> &srate, 1405 1407 String &ref, 1406 ROScalarColumn<Double> &tcol,1408 Vector<Double> &tcol, 1407 1409 ROArrayColumn<Double> &dcol, 1408 1410 Double t ) … … 1414 1416 // assume that cols is sorted by TIME 1415 1417 Bool doInterp = False ; 1416 uInt nrow = tcol.nrow() ; 1418 //uInt nrow = tcol.nrow() ; 1419 uInt nrow = dcol.nrow() ; 1417 1420 if ( nrow == 0 ) 1418 1421 return 0 ; 1419 TableRecord trec = tcol.keywordSet() ;1420 String tUnit = trec.asArrayString( "QuantumUnits" ).data()[0] ;1421 Double factor = 1.0 ;1422 if ( tUnit == "d" )1423 factor = 86400.0 ;1424 // binary search if idx == 01425 1422 if ( idx == 0 ) { 1426 1423 uInt nrowb = 1000 ; … … 1430 1427 uInt high = min( nrowb, nrow-iblock*nrowb ) ; 1431 1428 1432 if ( tcol( high-1 ) * factor< t ) {1429 if ( tcol( high-1 ) < t ) { 1433 1430 idx = iblock * nrowb ; 1434 1431 continue ; 1435 1432 } 1436 1433 1437 RefRows refrows( iblock*nrowb, iblock*nrowb+high, 1 ) ; 1438 Vector<Double> tarr = tcol.getColumnCells( refrows ) ; 1439 if ( tUnit == "d" ) 1440 tarr *= factor ; 1434 Slice slice( iblock*nrowb, nrowb ) ; 1435 Vector<Double> tarr = tcol( slice ) ; 1441 1436 1442 1437 uInt bidx = binarySearch( tarr, t ) ; … … 1447 1442 } 1448 1443 else { 1449 Vector<Double> tarr = tcol.getColumn() ; 1450 if ( tUnit == "d" ) 1451 tarr *= factor ; 1452 idx = binarySearch( tarr, t ) ; 1444 idx = binarySearch( tcol, t ) ; 1453 1445 } 1454 1446 } … … 1459 1451 //time0 = gettimeofday_sec() ; 1460 1452 //os_ << "start getDirection 2nd stage startSec=" << time0 << LogIO::POST ; 1461 while( tcol( idx ) * factor > t && idx > 0 ) 1453 //while( tcol( idx ) * factor > t && idx > 0 ) 1454 while( tcol[idx] > t && idx > 0 ) 1462 1455 idx-- ; 1463 1456 //os_ << "idx = " << idx << LogIO::POST ; … … 1465 1458 // index search 1466 1459 for ( uInt i = idx ; i < nrow ; i++ ) { 1467 //Double tref = tcol( i ).get( "s" ).getValue() ; 1468 Double tref = tcol( i ) * factor ; 1460 Double tref = tcol[i] ; 1469 1461 if ( tref == t ) { 1470 1462 idx = i ; … … 1496 1488 //os_ << "ip = " << ip << LogIO::POST ; 1497 1489 //ref = dmcol(idx)(ip).getRefString() ; 1498 trec = dcol.keywordSet() ;1490 TableRecord trec = dcol.keywordSet() ; 1499 1491 Record rec = trec.asRecord( "MEASINFO" ) ; 1500 1492 ref = rec.asString( "Ref" ) ; … … 1503 1495 //os_ << "do interpolation" << LogIO::POST ; 1504 1496 //os_ << "dcol(idx).shape() = " << dcol(idx).shape() << LogIO::POST ; 1505 // Double tref0 = tcol(idx).get("s").getValue() ; 1506 // Double tref1 = tcol(idx+1).get("s").getValue() ; 1507 Double tref0 = tcol(idx) * factor ; 1508 Double tref1 = tcol(idx+1) * factor ; 1497 Double tref0 = tcol[idx] ; 1498 Double tref1 = tcol[idx+1] ; 1509 1499 Matrix<Double> mdir0 = dcol( idx ) ; 1510 1500 Matrix<Double> mdir1 = dcol( idx+1 ) ; … … 1687 1677 Vector<Double> &azel, 1688 1678 Vector<Double> &srate, 1689 ROScalarColumn<Double> &ptcol,1679 Vector<Double> &ptcol, 1690 1680 ROArrayColumn<Double> &pdcol, 1691 1681 MEpoch &t, … … 1732 1722 //double startSec = gettimeofday_sec() ; 1733 1723 //os_ << "start MSFiller::getSourceDirection() startSec=" << startSec << LogIO::POST ; 1734 Vector<Double> defaultScanrate( 2, 0.0 ) ;1735 1724 Vector<Double> defaultDir = srcdir[0].getAngle( "rad" ).getValue() ; 1736 1725 if ( srcdir.nelements() > 1 ) 1737 defaultScanrate = srcdir[1].getAngle( "rad" ).getValue() ;1726 srate = srcdir[1].getAngle( "rad" ).getValue() ; 1738 1727 String ref = srcdir[0].getRefString() ; 1739 1728 MDirection::Types dirType ; … … 1746 1735 else 1747 1736 dir = defaultDir ; 1748 if ( ref != "AZELGEO" ) { 1749 MDirection::Convert toazel( dirType, MDirection::Ref( MDirection::AZELGEO, mf ) ) ; 1750 azel = toazel( defaultDir ).getAngle("rad").getValue() ; 1751 } 1752 else 1753 azel = defaultDir ; 1754 srate = defaultScanrate ; 1737 MDirection::Convert toazel( dirType, MDirection::Ref( MDirection::AZELGEO, mf ) ) ; 1738 azel = toazel( defaultDir ).getAngle("rad").getValue() ; 1755 1739 //double endSec = gettimeofday_sec() ; 1756 1740 //os_ << "end MSFiller::getSourceDirection() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ; -
trunk/src/MSFiller.h
r2238 r2246 30 30 #include <casa/Containers/Record.h> 31 31 #include <casa/Containers/Block.h> 32 33 //#include <tables/Tables/TableColumn.h>34 32 35 33 #include <ms/MeasurementSets/MeasurementSet.h> … … 94 92 casa::Vector<casa::Double> &srate, 95 93 casa::String &ref, 96 casa:: ROScalarColumn<casa::Double> &ptcol,94 casa::Vector<casa::Double> &ptcol, 97 95 casa::ROArrayColumn<casa::Double> &pdcol, 98 96 casa::Double t ) ; … … 101 99 casa::Vector<casa::Double> &azel, 102 100 casa::Vector<casa::Double> &srate, 103 casa:: ROScalarColumn<casa::Double> &ptcol,101 casa::Vector<casa::Double> &ptcol, 104 102 casa::ROArrayColumn<casa::Double> &pdcol, 105 103 casa::MEpoch &t, casa::MPosition &antpos ) ;
Note:
See TracChangeset
for help on using the changeset viewer.