Changeset 2362 for trunk/src/STGrid.cpp


Ignore:
Timestamp:
12/07/11 15:53:03 (12 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-2816

Ready for Test: No

Interface Changes: Yes

What Interface Changed: Added method to specify IFNO to be processed

Test Programs: List test programs

Put in Release Notes: Yes/No?

Module(s): Module Names change impacts.

Description: Describe your changes here...

Added method to specify IFNO to be processed.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STGrid.cpp

    r2361 r2362  
    4545void  STGrid::init()
    4646{
     47  ifno_ = -1 ;
    4748  nx_ = -1 ;
    4849  ny_ = -1 ;
     
    5051  nchan_ = 0 ;
    5152  nrow_ = 0 ;
    52   ngrid_ = 0 ;
    5353  cellx_ = 0.0 ;
    5454  celly_ = 0.0 ;
     
    154154  Matrix<uInt> rflag ;
    155155  Matrix<Float> weight ;
    156   getData( infile_, spectra, direction, flagtra, rflag, weight ) ;
     156  getData( spectra, direction, flagtra, rflag, weight ) ;
    157157  IPosition sshape = spectra.shape() ;
    158158  //os << "spectra.shape()=" << spectra.shape() << LogIO::POST ;
     
    168168 
    169169  // grid parameter
    170 //   os << "----------" << endl ;
    171 //   os << "Grid parameter summary" << endl ;
    172 //   os << "   (nx,ny) = (" << nx_ << "," << ny_ << ")" << endl ;
    173 //   os << "   (cellx,celly) = (" << cellx_ << "," << celly_ << ")" << endl ;
    174 //   os << "   center = " << center_ << endl ;
    175 //   os << "----------" << LogIO::POST ;
     170  os << LogIO::DEBUGGING ;
     171  os << "----------" << endl ;
     172  os << "Grid parameter summary" << endl ;
     173  os << "   (nx,ny) = (" << nx_ << "," << ny_ << ")" << endl ;
     174  os << "   (cellx,celly) = (" << cellx_ << "," << celly_ << ")" << endl ;
     175  os << "   center = " << center_ << endl ;
     176  os << "----------" << LogIO::POST ;
     177  os << LogIO::NORMAL ;
    176178
    177179  // convolution kernel
     
    384386}
    385387
    386 void STGrid::getData( String &infile,
    387                       Cube<Float> &spectra,
     388void STGrid::selectData( Table &tab )
     389{
     390  Int ifno = ifno_ ;
     391  Table taborg( infile_ ) ;
     392  if ( ifno == -1 ) {
     393    LogIO os( LogOrigin("STGrid","getData",WHERE) ) ;
     394//     os << LogIO::SEVERE
     395//        << "Please set IFNO before actual gridding"
     396//        << LogIO::EXCEPTION ;
     397    ROScalarColumn<uInt> ifnoCol( taborg, "IFNO" ) ;
     398    ifno = ifnoCol( 0 ) ;
     399    os << LogIO::WARN
     400       << "IFNO is not given. Using default IFNO: " << ifno << LogIO::POST ;
     401  }
     402  tab = taborg( taborg.col("IFNO") == ifno ) ;
     403  if ( tab.nrow() == 0 ) {
     404    LogIO os( LogOrigin("STGrid","getData",WHERE) ) ;
     405    os << LogIO::SEVERE
     406       << "No corresponding rows for given IFNO: " << ifno
     407       << LogIO::EXCEPTION ;
     408  }
     409}
     410
     411void STGrid::getData( Cube<Float> &spectra,
    388412                      Matrix<Double> &direction,
    389413                      Cube<uChar> &flagtra,
     
    391415                      Matrix<Float> &weight )
    392416{
    393   Table tab( infile ) ;
    394   //uInt npol = tab.keywordSet().asuInt( "nPol" ) ;
     417  Table tab ;
     418  selectData( tab ) ;
    395419  ROScalarColumn<uInt> polnoCol( tab, "POLNO" ) ;
    396   //uInt npol = max( polnoCol.getColumn() ) + 1 ;
    397420  Vector<uInt> pols = polnoCol.getColumn() ;
    398421  Vector<uInt> pollistOrg ;
     
    509532  if ( npol_ > 1 ) {
    510533    LogIO os( LogOrigin("STGrid", "getWeight", WHERE) ) ;
    511     os << LogIO::WARN << "STGrid doesn't support assigning independent polarization-dependent weight. Use averaged weight over polarization." << LogIO::POST ;
     534    os << LogIO::WARN << "STGrid doesn't support assigning polarization-dependent weight. Use averaged weight over polarization." << LogIO::POST ;
    512535  }
    513536}
     
    667690  Table tab = out->table() ;
    668691  IPosition dshape = data_.shape() ;
    669   //Int npol = dshape[2] ;
    670   //Int nchan = dshape[3] ;
    671692  Int nrow = nx_ * ny_ * npol_ ;
    672693  tab.rwKeywordSet().define( "nPol", npol_ ) ;
Note: See TracChangeset for help on using the changeset viewer.