Changeset 1993


Ignore:
Timestamp:
02/16/11 13:05:11 (13 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-2718

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

Small improvement on TCAL(_SPECTRUM) and TSYS(_SPECTRUM) handling.


Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/MSFiller.cpp

    r1990 r1993  
    7777    isProcessor_( False ),
    7878    isSysCal_( False ),
    79     isWeather_( False )
     79    isWeather_( False ),
     80    colTsys_( "TSYS_SPECTRUM" ),
     81    colTcal_( "TCAL_SPECTRUM" )
    8082{
    8183  os_ = LogIO() ;
     
    189191  if ( caltab.nrow() == 0 )
    190192    isSysCal_ = False ;
     193  else {
     194    if ( !caltab.tableDesc().isColumn( colTcal_ ) )
     195      colTcal_ = "TCAL" ;
     196    if ( !caltab.tableDesc().isColumn( colTsys_ ) )
     197      colTsys_ = "TSYS" ;
     198  }
    191199  MSPointing pointtab = mstable_.pointing() ;
    192200  if ( mstable_.weather().nrow() == 0 )
     
    384392          //os_ << "npol = " << npol << LogIO::POST ;
    385393          //os_ << "corrtype = " << corrtype << LogIO::POST ;
    386           if ( sdh.npol < npol ) sdh.npol = npol ;
     394          sdh.npol = max( sdh.npol, npol ) ;
    387395          if ( sdh.poltype == "" ) sdh.poltype = getPolType( corrtype[0] ) ;
    388396          // source information
     
    453461          Bool even = False ;
    454462          if ( (nchan/2)*2 == nchan ) even = True ;
    455           if ( sdh.nchan < nchan ) sdh.nchan = nchan ;
     463          sdh.nchan = max( sdh.nchan, nchan ) ;
    456464          ROScalarQuantColumn<Double> *tmpQuantCol = new ROScalarQuantColumn<Double>( spwtab, "TOTAL_BANDWIDTH" ) ;
    457465          Double totbw = (*tmpQuantCol)( spwId ).getValue( "Hz" ) ;
    458466          delete tmpQuantCol ;
    459           if ( sdh.bandwidth < totbw ) sdh.bandwidth = totbw ;
     467          sdh.bandwidth = max( sdh.bandwidth, totbw ) ;
    460468          if ( sdh.freqref == "" )
    461469            //sdh.freqref = MFrequency::showType( freqRef ) ;
     
    562570              os_ << "start fill SPECTRA and FLAG: " << time0 << LogIO::POST ;
    563571              ROArrayColumn<Bool> mFlagCol( t5, "FLAG" ) ;
     572              //Cube<Bool> mFlagArr = mFlagCol.getColumn() ;
    564573              if ( isFloatData_ ) {
    565574                //os_ << "FLOAT_DATA exists" << LogIO::POST ;
    566575                ROArrayColumn<Float> mFloatDataCol( t5, "FLOAT_DATA" ) ;
     576                //Cube<Float> mFloatDataArr = mFloatDataCol.getColumn() ;
    567577                addednr = nrow*npol ;
    568578                oldnr += addednr ;
     
    571581                for ( Int irow = 0 ; irow < nrow ; irow++ ) {
    572582                  Matrix<Float> sp = mFloatDataCol( irow ) ;
     583                  //Matrix<Float> sp = mFloatDataArr.xyPlane( irow ) ;
    573584                  for ( Int ipol = 0 ; ipol < npol ; ipol++ ) {
    574585                    spCol->put( prevnr+ipol*nrow+irow, sp.row(ipol) ) ;
     
    577588                for ( Int irow = 0 ; irow < nrow ; irow++ ) {
    578589                  Matrix<Bool> flb = mFlagCol( irow ) ;
     590                  //Matrix<Bool> flb = mFlagArr.xyPlane( irow ) ;
    579591                  Matrix<uChar> fl( flb.shape() ) ;
    580592                  convertArray( fl, flb ) ;
     
    592604                //os_ << "DATA exists" << LogIO::POST ;
    593605                ROArrayColumn<Complex> mDataCol( t5, "DATA" ) ;
     606                //Cube<Complex> mDataArr = mDataCol.getColumn() ;
    594607                addednr = nrow*npol ;
    595608                oldnr += addednr ;
     
    599612                  Bool crossOK = False ;
    600613                  Matrix<Complex> sp = mDataCol( irow ) ;
     614                  //Matrix<Complex> sp = mDataArr.xyPlane( irow ) ;
    601615                  for ( Int ipol = 0 ; ipol < npol ; ipol++ ) {
    602616                    if ( corrtype[ipol] == Stokes::XY || corrtype[ipol] == Stokes::YX
     
    620634                  Bool crossOK = False ;
    621635                  Matrix<Bool> flb = mFlagCol( irow ) ;
     636                  //Matrix<Bool> flb = mFlagArr.xyPlane( irow ) ;
    622637                  Matrix<uChar> fl( flb.shape() ) ;
    623638                  convertArray( fl, flb ) ;
     
    667682              time0 = gettimeofday_sec() ;
    668683              os_ << "start fill TSYS: " << time0 << LogIO::POST ;
    669               Vector<Double> sysCalTime ;
     684              Vector<Double> sysCalTime( nrow, -1.0 ) ;
     685              //Vector<Double> sysCalTime ;
    670686              if ( isSysCal_ ) {
    671                 sysCalTime = getSysCalTime( caltabsel, *mTimeCol ) ;
     687                //sysCalTime = getSysCalTime( caltabsel, *mTimeCol ) ;
     688                getSysCalTime( caltabsel, *mTimeCol, sysCalTime ) ;
    672689                tidx = prevnr ;
    673690                uInt calidx = 0 ;
     
    14551472    return ;
    14561473  }
    1457   Bool isSp = sctab.tableDesc().isColumn( "TCAL_SPECTRUM" ) ;
    1458   //Table sctabsel =  sctab( sctab.col("ANTENNA_ID") == antenna_ ) ;
    14591474  Table sctabsel( sctab( sctab.col("ANTENNA_ID") == antenna_ ) ) ;
    14601475  if ( sctabsel.nrow() == 0 ) {
     
    14961511        //os_ << "fillTcal::t2.nrow = " << nrow << LogIO::POST ;
    14971512        ROScalarQuantColumn<Double> scTimeCol( t2, "TIME" ) ;
    1498         IPosition newShape( 2, 1, nrow ) ;
    1499         if ( isSp ) {
    1500           scTcalCol.attach( t2, "TCAL_SPECTRUM" ) ;
    1501           newShape[0] = scTcalCol.shape(0)(1) ;
    1502         }
    1503         else {
    1504           scTcalCol.attach( t1, "TCAL" ) ;
    1505         }
     1513        scTcalCol.attach( t2, colTcal_ ) ;
    15061514        tab.addRow( nrow*npol ) ;
    15071515        newnr += nrow*npol ;
     
    15801588}
    15811589
    1582 Vector<Double> MSFiller::getSysCalTime( MSSysCal &tab, MEpoch::ROScalarColumn &tcol )
     1590//Vector<Double> MSFiller::getSysCalTime( MSSysCal &tab, MEpoch::ROScalarColumn &tcol )
     1591void MSFiller::getSysCalTime( MSSysCal &tab, MEpoch::ROScalarColumn &tcol, Vector<Double> &tstr )
    15831592{
    15841593  double startSec = gettimeofday_sec() ;
    15851594  os_ << "start MSFiller::getSysCalTime() startSec=" << startSec << LogIO::POST ;
    1586   uInt nrow = tcol.table().nrow() ;
    1587   Vector<Double> tstr( nrow, -1.0 ) ;
     1595  //uInt nrow = tcol.table().nrow() ;
     1596  uInt nrow = tstr.nelements() ;
     1597  //Vector<Double> tstr( nrow, -1.0 ) ;
    15881598  if ( tab.nrow() == 0 )
    1589     return tstr ;
     1599    //return tstr ;
     1600    return ;
    15901601  uInt scnrow = tab.nrow() ;
    15911602  ROScalarMeasColumn<MEpoch> scTimeCol( tab, "TIME" ) ;
     
    16151626  double endSec = gettimeofday_sec() ;
    16161627  os_ << "end MSFiller::getSysCalTime() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
    1617   return tstr ;
     1628  //return tstr ;
     1629  return ;
    16181630}
    16191631
     
    16281640    return 0 ;
    16291641  }
    1630   Bool isSp = tab.tableDesc().isColumn( "TSYS_SPECTRUM" ) ;
    16311642  ROScalarMeasColumn<MEpoch> scTimeCol( tab, "TIME" ) ;
    16321643  ROArrayColumn<Float> mTsysCol ;
    1633   if ( isSp ) {
    1634     mTsysCol.attach( tab, "TSYS_SPECTRUM" ) ;
    1635   }
    1636   else {
    1637     mTsysCol.attach( tab, "TSYS" ) ;
    1638   }
     1644  mTsysCol.attach( tab, colTsys_ ) ;
    16391645  for ( uInt i = idx ; i < nrow ; i++ ) {
    16401646    Double tref = scTimeCol( i ).get( "s" ).getValue() ;
  • trunk/src/MSFiller.h

    r1990 r1993  
    2525#include <casa/Arrays/Vector.h>
    2626#include <casa/Arrays/Matrix.h>
     27#include <casa/Arrays/Cube.h>
    2728#include <casa/Logging/LogIO.h>
    2829
     
    8485  // assume that tab is selected by ANTENNA_ID, FEED_ID, SPECTRAL_WINDOW_ID
    8586  // and sorted by TIME
    86   casa::Vector<casa::Double> getSysCalTime( casa::MSSysCal &tab, casa::MEpoch::ROScalarColumn &tcol ) ;
     87  //casa::Vector<casa::Double> getSysCalTime( casa::MSSysCal &tab, casa::MEpoch::ROScalarColumn &tcol ) ;
     88  void getSysCalTime( casa::MSSysCal &tab, casa::MEpoch::ROScalarColumn &tcal, casa::Vector<casa::Double> &scTime ) ;
    8789
    8890  // get tsys by time stamp
     
    117119  casa::Bool isWeather_ ;
    118120
     121  casa::String colTsys_ ;
     122  casa::String colTcal_ ;
     123
    119124  casa::LogIO os_ ;
    120125 
Note: See TracChangeset for help on using the changeset viewer.