- Timestamp:
- 12/08/11 18:31:00 (13 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STGrid.cpp
r2363 r2364 22 22 23 23 #include <Scantable.h> 24 #include <MathUtils.h> 25 24 26 #include "STGrid.h" 25 27 … … 72 74 void STGrid::setPolList( vector<unsigned int> pols ) 73 75 { 74 //pollist_ = Vector<uInt>( pols ) ;75 76 pollist_.assign( Vector<uInt>( pols ) ) ; 76 77 cout << "pollist_ = " << pollist_ << endl ; 78 } 79 80 void STGrid::setScanList( vector<unsigned int> scans ) 81 { 82 scanlist_.assign( Vector<uInt>( scans ) ) ; 83 cout << "scanlist_ = " << scanlist_ << endl ; 77 84 } 78 85 … … 108 115 } 109 116 110 void STGrid::set Option( string convType,111 117 void STGrid::setFunc( string convType, 118 int convSupport ) 112 119 { 113 120 convType_ = String( convType ) ; … … 154 161 Matrix<uInt> rflag ; 155 162 Matrix<Float> weight ; 163 double t0, t1 ; 164 t0 = mathutil::gettimeofday_sec() ; 156 165 getData( spectra, direction, flagtra, rflag, weight ) ; 166 t1 = mathutil::gettimeofday_sec() ; 167 os << "getData: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; 157 168 IPosition sshape = spectra.shape() ; 158 169 //os << "spectra.shape()=" << spectra.shape() << LogIO::POST ; … … 164 175 Cube<Int> flagI ; 165 176 Matrix<Int> rflagI ; 177 t0 = mathutil::gettimeofday_sec() ; 166 178 toInt( &flagtra, &flagI ) ; 167 179 toInt( &rflag, &rflagI ) ; 180 t1 = mathutil::gettimeofday_sec() ; 181 os << "toInt: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; 168 182 169 183 // grid parameter … … 179 193 // convolution kernel 180 194 Vector<Float> convFunc ; 195 t0 = mathutil::gettimeofday_sec() ; 181 196 setConvFunc( convFunc ) ; 197 t1 = mathutil::gettimeofday_sec() ; 198 os << "setConvFunc: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; 182 199 //cout << "convSupport=" << convSupport_ << endl ; 183 200 //cout << "convFunc=" << convFunc << endl ; … … 185 202 // world -> pixel 186 203 Matrix<Double> xypos( direction.shape(), 0.0 ) ; 204 t0 = mathutil::gettimeofday_sec() ; 187 205 toPixel( direction, xypos ) ; 206 t1 = mathutil::gettimeofday_sec() ; 207 os << "toPixel: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; 188 208 189 209 // call ggridsd … … 198 218 Float *conv_p = convFunc.getStorage( deleteConv ) ; 199 219 // Extend grid plane with convSupport_ 200 //IPosition gshape( 4, nx_, ny_, npol, nchan ) ; 201 Int gnx = nx_+convSupport_*2 ; 202 Int gny = ny_+convSupport_*2 ; 220 Int gnx = nx_ ; 221 Int gny = ny_ ; 222 // Int gnx = nx_+convSupport_*2 ; 223 // Int gny = ny_+convSupport_*2 ; 203 224 IPosition gshape( 4, gnx, gny, npol_, nchan_ ) ; 204 225 Array<Complex> gdataArrC( gshape, 0.0 ) ; … … 207 228 Float *wdata_p = gwgtArr.getStorage( deleteWgtG ) ; 208 229 Int idopsf = 0 ; 209 Int irow = -1 ;210 230 Int *chanMap = new Int[nchan_] ; 211 231 { … … 232 252 } 233 253 } 254 t0 = mathutil::gettimeofday_sec() ; 255 Int irow = -1 ; 234 256 ggridsd( xypos_p, 235 257 data_p, … … 254 276 polMap, 255 277 sumw_p ) ; 278 t1 = mathutil::gettimeofday_sec() ; 279 os << "ggridsd: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; 256 280 xypos.putStorage( xypos_p, deletePos ) ; 257 281 dataC.freeStorage( data_p, deleteData ) ; … … 265 289 gwgtArr.putStorage( wdata_p, deleteWgtG ) ; 266 290 Array<Float> gdataArr = real( gdataArrC ) ; 291 t0 = mathutil::gettimeofday_sec() ; 267 292 data_.resize( gdataArr.shape() ) ; 268 293 data_ = 0.0 ; … … 272 297 for ( Int ic = 0 ; ic < nchan_ ; ic++ ) { 273 298 IPosition pos( 4, ix, iy, ip, ic ) ; 274 IPosition gpos( 4, ix+convSupport_, iy+convSupport_, ip, ic ) ; 299 IPosition gpos( 4, ix, iy, ip, ic ) ; 300 // IPosition gpos( 4, ix+convSupport_, iy+convSupport_, ip, ic ) ; 275 301 if ( gwgtArr( gpos ) > 0.0 ) 276 302 data_( pos ) = gdataArr( gpos ) / gwgtArr( gpos ) ; … … 279 305 } 280 306 } 307 t1 = mathutil::gettimeofday_sec() ; 308 os << "set data: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; 281 309 //Matrix<Double> sumWeight( IPosition( 2, npol_, nchan_ ), sumw_p, TAKE_OVER ) ; 282 310 delete sumw_p ; 283 311 //cout << "sumWeight = " << sumWeight << endl ; 284 //cout << "gdataArr = " << gdataArr << endl;285 //cout << "gwgtArr = " << gwgtArr << endl;286 //cout << "data_ " << data_ << endl;312 // os << "gdataArr = " << gdataArr << LogIO::POST ; 313 // os << "gwgtArr = " << gwgtArr << LogIO::POST ; 314 // os << "data_ " << data_ << LogIO::POST ; 287 315 } 288 316 … … 400 428 << "IFNO is not given. Using default IFNO: " << ifno << LogIO::POST ; 401 429 } 402 tab = taborg( taborg.col("IFNO") == ifno ) ; 430 // tab = taborg( taborg.col("IFNO") == ifno ) ; 431 TableExprNode node ; 432 node = taborg.col("IFNO") == ifno ; 433 if ( scanlist_.size() > 0 ) { 434 node = node && taborg.col("SCANNO").in( scanlist_ ) ; 435 } 436 tab = taborg( node ) ; 403 437 if ( tab.nrow() == 0 ) { 404 438 LogIO os( LogOrigin("STGrid","getData",WHERE) ) ; 405 439 os << LogIO::SEVERE 406 << "No corresponding rows for given IFNO: " << ifno 440 << "No corresponding rows for given selection: IFNO" << ifno 441 << "SCANNO " << scanlist_ 407 442 << LogIO::EXCEPTION ; 408 443 } … … 575 610 // grid plane to avoid unexpected behavior on grid edge 576 611 Vector<Double> pixc( 2 ) ; 577 //pixc(0) = Double( nx_-1 ) * 0.5 ;578 //pixc(1) = Double( ny_-1 ) * 0.5 ;579 pixc(0) = Double( nx_+2*convSupport_-1 ) * 0.5 ;580 pixc(1) = Double( ny_+2*convSupport_-1 ) * 0.5 ;612 pixc(0) = Double( nx_-1 ) * 0.5 ; 613 pixc(1) = Double( ny_-1 ) * 0.5 ; 614 // pixc(0) = Double( nx_+2*convSupport_-1 ) * 0.5 ; 615 // pixc(1) = Double( ny_+2*convSupport_-1 ) * 0.5 ; 581 616 uInt nrow = world.shape()[1] ; 582 617 Vector<Double> cell( 2 ) ; 583 618 cell(0) = cellx_ ; 584 619 cell(1) = celly_ ; 585 //ofstream ofs( "grid.dat", ios::out ) ;586 620 for ( uInt irow = 0 ; irow < nrow ; irow++ ) { 587 //ofs << irow ;588 621 for ( uInt i = 0 ; i < 2 ; i++ ) { 589 622 pixel( i, irow ) = pixc(i) + ( world(i, irow) - center_(i) ) / cell(i) ; 590 //ofs << " " << world(i, irow) << " " << pixel(i, irow) ; 591 } 592 //ofs << endl ; 593 } 594 //ofs.close() ; 623 } 624 } 625 // String gridfile = "grid."+convType_+"."+String::toString(convSupport_)+".dat" ; 626 // ofstream ofs( gridfile.c_str(), ios::out ) ; 627 // ofs << "center " << center_(0) << " " << pixc(0) 628 // << " " << center_(1) << " " << pixc(1) << endl ; 629 // for ( uInt irow = 0 ; irow < nrow ; irow++ ) { 630 // ofs << irow ; 631 // for ( uInt i = 0 ; i < 2 ; i++ ) { 632 // ofs << " " << world(i, irow) << " " << pixel(i, irow) ; 633 // } 634 // ofs << endl ; 635 // } 636 // ofs.close() ; 595 637 } 596 638 -
trunk/src/STGrid.h
r2362 r2364 53 53 void setPolList( vector<unsigned int> pols ) ; 54 54 55 void setScanList( vector<unsigned int> scans ) ; 56 55 57 void defineImage( int nx=-1, 56 58 int ny=-1, … … 58 60 string scelly="", 59 61 string scenter="" ) ; 60 void set Option( string convtype="box",61 62 void setFunc( string convtype="box", 63 int convsupport=-1 ) ; 62 64 63 65 void setWeight( const string wType="uniform" ) ; … … 118 120 Array<Float> data_ ; 119 121 Vector<uInt> pollist_ ; 122 Vector<uInt> scanlist_ ; 120 123 String wtype_ ; 121 124 -
trunk/src/python_STGrid.cpp
r2362 r2364 23 23 .def("_setif", &STGrid::setIF) 24 24 .def("_setpollist", &STGrid::setPolList) 25 .def("_setscanlist", &STGrid::setScanList) 25 26 .def("_defineimage", &STGrid::defineImage) 26 .def("_set option", &STGrid::setOption)27 .def("_setfunc", &STGrid::setFunc) 27 28 .def("_grid", &STGrid::grid) 28 29 .def("_setin", &STGrid::setFileIn)
Note:
See TracChangeset
for help on using the changeset viewer.