Changeset 2386 for trunk/src


Ignore:
Timestamp:
12/22/11 19:48:03 (13 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-2816

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

Do data selection by TableExprNode only when it is really needed.


Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STGrid.cpp

    r2385 r2386  
    279279  os << "   center = " << center_ << endl ;
    280280  os << "   weighting = " << wtype_ << endl ;
    281   os << "   convfunc = " << convType_ << "with support " << convSupport_ << endl ;
     281  os << "   convfunc = " << convType_ << " with support " << convSupport_ << endl ;
    282282  os << "----------" << LogIO::POST ;
    283283  os << LogIO::NORMAL ;
     
    354354    polMap[0] = ipol ;
    355355
    356     os << "start pol" << ipol << LogIO::POST ;
     356    os << "start pol " << ipol << LogIO::POST ;
    357357
    358358    while( !pastEnd() ) {
     
    412412
    413413    }
     414
     415    os << "end pol " << ipol << LogIO::POST ;
    414416
    415417    nprocessed_ = 0 ;
     
    552554void STGrid::initPol( Int ipol )
    553555{
    554   if ( npol_ == 1 )
     556  LogIO os( LogOrigin("STGrid","initPol",WHERE) ) ;
     557  if ( npolOrg_ == 1 ) {
     558    os << "single polarization data." << LogIO::POST ;
    555559    ptab_ = tab_ ;
     560  }
    556561  else
    557562    ptab_ = tab_( tab_.col("POLNO") == (uInt)ipol ) ;
     
    707712void STGrid::selectData()
    708713{
     714  LogIO os( LogOrigin("STGrid","selectData",WHERE) ) ;   
    709715  Int ifno = ifno_ ;
    710716  Table taborg( infile_ ) ;
    711717  if ( ifno == -1 ) {
    712     LogIO os( LogOrigin("STGrid","selectData",WHERE) ) ;   
    713 //     os << LogIO::SEVERE
    714 //        << "Please set IFNO before actual gridding"
    715 //        << LogIO::EXCEPTION ;
    716718    ROScalarColumn<uInt> ifnoCol( taborg, "IFNO" ) ;
    717719    ifno = ifnoCol( 0 ) ;
     
    719721       << "IFNO is not given. Using default IFNO: " << ifno << LogIO::POST ;
    720722  }
    721 //   tab = taborg( taborg.col("IFNO") == ifno ) ;
    722723  TableExprNode node ;
    723   node = taborg.col("IFNO") == ifno ;
     724  if ( isMultiIF( taborg ) ) {
     725    os << "apply selection on IFNO" << LogIO::POST ;
     726    node = taborg.col("IFNO") == ifno ;
     727  }
    724728  if ( scanlist_.size() > 0 ) {
     729    os << "apply selection on SCANNO" << LogIO::POST ;
    725730    node = node && taborg.col("SCANNO").in( scanlist_ ) ;
    726731  }
    727   tab_ = taborg( node ) ;
     732  if ( node.isNull() ) {
     733    tab_ = taborg ;
     734  }
     735  else {
     736    tab_ = taborg( node ) ;
     737  }
    728738  if ( tab_.nrow() == 0 ) {
    729     LogIO os( LogOrigin("STGrid","selectData",WHERE) ) ;
    730739    os << LogIO::SEVERE
    731740       << "No corresponding rows for given selection: IFNO " << ifno ;
     
    734743    os << LogIO::EXCEPTION ;
    735744  }
    736   //attach( tab_ ) ;
     745}
     746
     747Bool STGrid::isMultiIF( Table &tab )
     748{
     749  ROScalarColumn<uInt> ifnoCol( tab, "IFNO" ) ;
     750  Vector<uInt> ifnos = ifnoCol.getColumn() ;
     751  return anyNE( ifnos, ifnos[0] ) ;
    737752}
    738753
     
    874889
    875890  RefRows rows( nprocessed_, nprocessed_+nrow-1, 1 ) ;
    876   os<<LogIO::DEBUGGING<<"nprocessed_="<<nprocessed_<<": rows.nrows()="<<rows.nrows()<<LogIO::POST ;
     891  //os<<LogIO::DEBUGGING<<"nprocessed_="<<nprocessed_<<": rows.nrows()="<<rows.nrows()<<LogIO::POST ;
    877892  spectraCol_.getColumnCells( rows, spectra ) ;
    878893  flagtraCol_.getColumnCells( rows, flagtra ) ;
     
    904919  //os << pols << LogIO::POST ;
    905920  Vector<uInt> pollistOrg ;
    906   uInt npolOrg = 0 ;
     921  npolOrg_ = 0 ;
    907922  uInt polno ;
    908923  for ( uInt i = 0 ; i < polnoCol.nrow() ; i++ ) {
     
    910925    polno = pols( i ) ;
    911926    if ( allNE( pollistOrg, polno ) ) {
    912       pollistOrg.resize( npolOrg+1, True ) ;
    913       pollistOrg[npolOrg] = polno ;
    914       npolOrg++ ;
     927      pollistOrg.resize( npolOrg_+1, True ) ;
     928      pollistOrg[npolOrg_] = polno ;
     929      npolOrg_++ ;
    915930    }
    916931  }
     
    933948    os << LogIO::SEVERE << "Empty pollist" << LogIO::EXCEPTION ;
    934949  }
    935   nrow_ = tab_.nrow() / npolOrg ;
     950  nrow_ = tab_.nrow() / npolOrg_ ;
    936951  ROArrayColumn<uChar> tmpCol( tab_, "FLAGTRA" ) ;
    937952  nchan_ = tmpCol( 0 ).nelements() ;
  • trunk/src/STGrid.h

    r2384 r2386  
    153153
    154154  void initPol( Int ipol ) ;
     155  Bool isMultiIF( Table &tab ) ;
    155156
    156157
     
    160161  Int ny_ ;
    161162  Int npol_ ;
     163  Int npolOrg_ ;
    162164  Int nchan_ ;
    163165  Int nrow_ ;
Note: See TracChangeset for help on using the changeset viewer.