Changeset 2362


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.


Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapgrid.py

    r2361 r2362  
    1212    def setData( self, infile ):
    1313        self.gridder._setin( infile )
     14
     15    def setIF( self, ifno ):
     16        self.gridder._setif( ifno )
    1417
    1518    def setPolList( self, pollist ):
  • 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_ ) ;
  • trunk/src/STGrid.h

    r2361 r2362  
    4949  void setFileIn( const string infile ) ;
    5050
     51  void setIF( unsigned int ifno ) { ifno_ = ifno ; } ;
     52
    5153  void setPolList( vector<unsigned int> pols ) ;
    5254
     
    7880                  String &center ) ;
    7981 
    80   void getData( String &infile,
    81                 Cube<Float> &spectra,
     82  void getData( Cube<Float> &spectra,
    8283                Matrix<Double> &direction,
    8384                Cube<uChar> &flagtra,
     
    99100  void pbFunc( Vector<Float> &convFunc ) ;
    100101  void setConvFunc( Vector<Float> &convFunc ) ;
     102  void selectData( Table &tab ) ;
    101103
    102104  String infile_ ;
     105  Int ifno_ ;
    103106  Int nx_ ;
    104107  Int ny_ ;
     
    106109  Int nchan_ ;
    107110  Int nrow_ ;
    108   Int ngrid_ ;
    109111  Double cellx_ ;
    110112  Double celly_ ;
  • trunk/src/python_STGrid.cpp

    r2361 r2362  
    2121    .def( init <> () )
    2222    .def( init < const std::string > () )
     23    .def("_setif", &STGrid::setIF)
    2324    .def("_setpollist", &STGrid::setPolList)
    2425    .def("_defineimage", &STGrid::defineImage)
Note: See TracChangeset for help on using the changeset viewer.