- Timestamp:
- 12/07/11 15:53:03 (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapgrid.py
r2361 r2362 12 12 def setData( self, infile ): 13 13 self.gridder._setin( infile ) 14 15 def setIF( self, ifno ): 16 self.gridder._setif( ifno ) 14 17 15 18 def setPolList( self, pollist ): -
trunk/src/STGrid.cpp
r2361 r2362 45 45 void STGrid::init() 46 46 { 47 ifno_ = -1 ; 47 48 nx_ = -1 ; 48 49 ny_ = -1 ; … … 50 51 nchan_ = 0 ; 51 52 nrow_ = 0 ; 52 ngrid_ = 0 ;53 53 cellx_ = 0.0 ; 54 54 celly_ = 0.0 ; … … 154 154 Matrix<uInt> rflag ; 155 155 Matrix<Float> weight ; 156 getData( infile_,spectra, direction, flagtra, rflag, weight ) ;156 getData( spectra, direction, flagtra, rflag, weight ) ; 157 157 IPosition sshape = spectra.shape() ; 158 158 //os << "spectra.shape()=" << spectra.shape() << LogIO::POST ; … … 168 168 169 169 // 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 ; 176 178 177 179 // convolution kernel … … 384 386 } 385 387 386 void STGrid::getData( String &infile, 387 Cube<Float> &spectra, 388 void 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 411 void STGrid::getData( Cube<Float> &spectra, 388 412 Matrix<Double> &direction, 389 413 Cube<uChar> &flagtra, … … 391 415 Matrix<Float> &weight ) 392 416 { 393 Table tab ( infile );394 //uInt npol = tab.keywordSet().asuInt( "nPol") ;417 Table tab ; 418 selectData( tab ) ; 395 419 ROScalarColumn<uInt> polnoCol( tab, "POLNO" ) ; 396 //uInt npol = max( polnoCol.getColumn() ) + 1 ;397 420 Vector<uInt> pols = polnoCol.getColumn() ; 398 421 Vector<uInt> pollistOrg ; … … 509 532 if ( npol_ > 1 ) { 510 533 LogIO os( LogOrigin("STGrid", "getWeight", WHERE) ) ; 511 os << LogIO::WARN << "STGrid doesn't support assigning independentpolarization-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 ; 512 535 } 513 536 } … … 667 690 Table tab = out->table() ; 668 691 IPosition dshape = data_.shape() ; 669 //Int npol = dshape[2] ;670 //Int nchan = dshape[3] ;671 692 Int nrow = nx_ * ny_ * npol_ ; 672 693 tab.rwKeywordSet().define( "nPol", npol_ ) ; -
trunk/src/STGrid.h
r2361 r2362 49 49 void setFileIn( const string infile ) ; 50 50 51 void setIF( unsigned int ifno ) { ifno_ = ifno ; } ; 52 51 53 void setPolList( vector<unsigned int> pols ) ; 52 54 … … 78 80 String ¢er ) ; 79 81 80 void getData( String &infile, 81 Cube<Float> &spectra, 82 void getData( Cube<Float> &spectra, 82 83 Matrix<Double> &direction, 83 84 Cube<uChar> &flagtra, … … 99 100 void pbFunc( Vector<Float> &convFunc ) ; 100 101 void setConvFunc( Vector<Float> &convFunc ) ; 102 void selectData( Table &tab ) ; 101 103 102 104 String infile_ ; 105 Int ifno_ ; 103 106 Int nx_ ; 104 107 Int ny_ ; … … 106 109 Int nchan_ ; 107 110 Int nrow_ ; 108 Int ngrid_ ;109 111 Double cellx_ ; 110 112 Double celly_ ; -
trunk/src/python_STGrid.cpp
r2361 r2362 21 21 .def( init <> () ) 22 22 .def( init < const std::string > () ) 23 .def("_setif", &STGrid::setIF) 23 24 .def("_setpollist", &STGrid::setPolList) 24 25 .def("_defineimage", &STGrid::defineImage)
Note:
See TracChangeset
for help on using the changeset viewer.