Changeset 2246


Ignore:
Timestamp:
07/25/11 14:41:23 (13 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

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...

More improvement


Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/MSFiller.cpp

    r2245 r2246  
    260260  delete sharedQDArrCol ;
    261261  MPosition mp( MVPosition( antpos ), MPosition::ITRF ) ;
     262  Vector<Double> pt ;
     263  ROArrayColumn<Double> pdcol ;
     264  Vector<Double> defaultScanrate( 2, 0.0 ) ;
    262265  if ( getPt_ ) {
    263266    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  }
    267275  String stationName = asString( "STATION", antenna_, anttab, tpoolr ) ;
    268276  String antennaName = asString( "NAME", antenna_, anttab, tpoolr ) ;
     
    497505            for ( uInt irow = 0 ; irow < caltabsel.nrow() ; irow++ )
    498506              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 ) ;
    502509            if ( colTsys_ != "NONE" )
    503510              scTsysCol.attach( caltabsel, colTsys_ ) ;
     
    566573              for ( Int irow = 0 ; irow < nrow ; irow++ )
    567574                mTimeB[irow] = (*mTimeCol)( irow ) ;
    568 //               ROTableColumn *mIntervalCol = tpoolr->construct( t5, "INTERVAL" ) ;
    569 //               ROTableColumn *mFlagRowCol = tpoolr->construct( t5, "FLAG_ROW" ) ;
    570575              Block<Int> sysCalIdx( nrow, -1 ) ;
    571576              if ( isSysCal_ ) {
     
    606611
    607612                // FLAGROW
    608 //                 *flrRF = (uInt)mFlagRowCol->asBool( irow ) ;
    609613                *flrRF = (uInt)asBool( "FLAG_ROW", irow, t5, tpoolr ) ;
    610614
     
    619623
    620624                // INTERVAL
    621 //                 *intervalRF = (Double)(mIntervalCol->asdouble( irow )) ;
    622625                *intervalRF = asDouble( "INTERVAL", irow, t5, tpoolr ) ;
    623626
     
    648651                Vector<Double> dir ;
    649652                Vector<Double> azel ;
    650                 Vector<Double> scanrate ;
     653                Vector<Double> scanrate = defaultScanrate ;
    651654                String refString ;
    652655                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 ) ;
    655657                else
    656658                  getSourceDirection( dir, azel, scanrate, mTimeB[irow], mp, delayDir ) ;
     
    14041406                             Vector<Double> &srate,
    14051407                             String &ref,
    1406                              ROScalarColumn<Double> &tcol,
     1408                             Vector<Double> &tcol,
    14071409                             ROArrayColumn<Double> &dcol,
    14081410                             Double t )
     
    14141416  // assume that cols is sorted by TIME
    14151417  Bool doInterp = False ;
    1416   uInt nrow = tcol.nrow() ;
     1418  //uInt nrow = tcol.nrow() ;
     1419  uInt nrow = dcol.nrow() ;
    14171420  if ( nrow == 0 )
    14181421    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 == 0
    14251422  if ( idx == 0 ) {
    14261423    uInt nrowb = 1000 ;
     
    14301427        uInt high = min( nrowb, nrow-iblock*nrowb ) ;
    14311428
    1432         if ( tcol( high-1 ) * factor < t ) {
     1429        if ( tcol( high-1 ) < t ) {
    14331430          idx = iblock * nrowb ;
    14341431          continue ;
    14351432        }
    14361433
    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 ) ;
    14411436
    14421437        uInt bidx = binarySearch( tarr, t ) ;
     
    14471442    }
    14481443    else {
    1449       Vector<Double> tarr = tcol.getColumn() ;
    1450       if ( tUnit == "d" )
    1451         tarr *= factor ;
    1452       idx = binarySearch( tarr, t ) ;
     1444      idx = binarySearch( tcol, t ) ;
    14531445    }
    14541446  }
     
    14591451  //time0 = gettimeofday_sec() ;
    14601452  //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 )
    14621455    idx-- ;
    14631456  //os_ << "idx = " << idx << LogIO::POST ;
     
    14651458  // index search
    14661459  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] ;
    14691461    if ( tref == t ) {
    14701462      idx = i ;
     
    14961488  //os_ << "ip = " << ip << LogIO::POST ;
    14971489  //ref = dmcol(idx)(ip).getRefString() ;
    1498   trec = dcol.keywordSet() ;
     1490  TableRecord trec = dcol.keywordSet() ;
    14991491  Record rec = trec.asRecord( "MEASINFO" ) ;
    15001492  ref = rec.asString( "Ref" ) ;
     
    15031495    //os_ << "do interpolation" << LogIO::POST ;
    15041496    //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] ;
    15091499    Matrix<Double> mdir0 = dcol( idx ) ;
    15101500    Matrix<Double> mdir1 = dcol( idx+1 ) ;
     
    16871677                             Vector<Double> &azel,
    16881678                             Vector<Double> &srate,
    1689                              ROScalarColumn<Double> &ptcol,
     1679                             Vector<Double> &ptcol,
    16901680                             ROArrayColumn<Double> &pdcol,
    16911681                             MEpoch &t,
     
    17321722  //double startSec = gettimeofday_sec() ;
    17331723  //os_ << "start MSFiller::getSourceDirection() startSec=" << startSec << LogIO::POST ;
    1734   Vector<Double> defaultScanrate( 2, 0.0 ) ;
    17351724  Vector<Double> defaultDir = srcdir[0].getAngle( "rad" ).getValue() ;
    17361725  if ( srcdir.nelements() > 1 )
    1737     defaultScanrate = srcdir[1].getAngle( "rad" ).getValue() ;
     1726    srate = srcdir[1].getAngle( "rad" ).getValue() ;
    17381727  String ref = srcdir[0].getRefString() ;
    17391728  MDirection::Types dirType ;
     
    17461735  else
    17471736    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() ;
    17551739  //double endSec = gettimeofday_sec() ;
    17561740  //os_ << "end MSFiller::getSourceDirection() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
  • trunk/src/MSFiller.h

    r2238 r2246  
    3030#include <casa/Containers/Record.h>
    3131#include <casa/Containers/Block.h>
    32 
    33 //#include <tables/Tables/TableColumn.h>
    3432
    3533#include <ms/MeasurementSets/MeasurementSet.h>
     
    9492                           casa::Vector<casa::Double> &srate,
    9593                           casa::String &ref,
    96                            casa::ROScalarColumn<casa::Double> &ptcol,
     94                           casa::Vector<casa::Double> &ptcol,
    9795                           casa::ROArrayColumn<casa::Double> &pdcol,
    9896                           casa::Double t ) ;
     
    10199                           casa::Vector<casa::Double> &azel,
    102100                           casa::Vector<casa::Double> &srate,
    103                            casa::ROScalarColumn<casa::Double> &ptcol,
     101                           casa::Vector<casa::Double> &ptcol,
    104102                           casa::ROArrayColumn<casa::Double> &pdcol,
    105103                           casa::MEpoch &t, casa::MPosition &antpos ) ;
Note: See TracChangeset for help on using the changeset viewer.