Changeset 2378
- Timestamp:
- 12/20/11 16:05:47 (13 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STGrid.cpp
r2377 r2378 60 60 userSupport_ = -1 ; 61 61 convSampling_ = 100 ; 62 irow_ = 0 ; 62 63 } 63 64 … … 150 151 Double*); 151 152 } 153 void STGrid::gridPerRow() 154 { 155 LogIO os( LogOrigin("STGrid", "gridPerRow", WHERE) ) ; 156 double t0, t1 ; 157 158 // grid parameter 159 os << LogIO::DEBUGGING ; 160 os << "----------" << endl ; 161 os << "Grid parameter summary" << endl ; 162 os << " (nx,ny) = (" << nx_ << "," << ny_ << ")" << endl ; 163 os << " (cellx,celly) = (" << cellx_ << "," << celly_ << ")" << endl ; 164 os << " center = " << center_ << endl ; 165 os << "----------" << LogIO::POST ; 166 os << LogIO::NORMAL ; 167 168 // boolean for getStorage 169 Bool deletePos, deleteData, deleteWgt, deleteFlag, deleteFlagR, deleteConv, deleteDataG, deleteWgtG ; 170 171 // convolution kernel 172 Vector<Float> convFunc ; 173 t0 = mathutil::gettimeofday_sec() ; 174 setConvFunc( convFunc ) ; 175 t1 = mathutil::gettimeofday_sec() ; 176 os << "setConvFunc: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; 177 //cout << "convSupport=" << convSupport_ << endl ; 178 //cout << "convFunc=" << convFunc << endl ; 179 Float *conv_p = convFunc.getStorage( deleteConv ) ; 180 181 // Extend grid plane with convSupport_ 182 Int gnx = nx_ ; 183 Int gny = ny_ ; 184 // Int gnx = nx_+convSupport_*2 ; 185 // Int gny = ny_+convSupport_*2 ; 186 IPosition gshape( 4, gnx, gny, npol_, nchan_ ) ; 187 Array<Complex> gdataArrC( gshape, 0.0 ) ; 188 // 2011/12/20 TN 189 // data_ and gwgtArr share storage 190 data_.resize( gshape ) ; 191 data_ = 0.0 ; 192 Array<Float> gwgtArr( data_ ) ; 193 //Array<Float> gwgtArr( gshape, 0.0 ) ; 194 Complex *gdata_p = gdataArrC.getStorage( deleteDataG ) ; 195 Float *wdata_p = gwgtArr.getStorage( deleteWgtG ) ; 196 197 // data selection 198 selectData( tab_ ) ; 199 setupArray( tab_ ) ; 200 201 // data storage 202 IPosition mshape( 3, npol_, nchan_, 1 ) ; 203 IPosition vshape( 2, npol_, 1 ) ; 204 IPosition dshape( 2, 2, 1 ) ; 205 Array<Complex> spectra( mshape ) ; 206 Array<Double> direction( dshape ) ; 207 Array<Int> flagtra( mshape ) ; 208 Array<Int> rflag( vshape ) ; 209 Array<Float> weight( vshape ) ; 210 Array<Double> xypos( dshape ) ; 211 212 while( !pastEnd() ) { 213 // retrieve data 214 getDataChunk( spectra, direction, flagtra, rflag, weight ) ; 215 216 // world -> pixel 217 toPixel( direction, xypos ) ; 218 219 // call ggridsd 220 } 221 222 // set data 223 setData( gdataArrC, gwgtArr ) ; 224 } 225 226 Bool STGrid::pastEnd() 227 { 228 Bool b = irow_ >= nrow_ ; 229 return b ; 230 } 231 152 232 void STGrid::grid() 153 233 { … … 214 294 IPosition gshape( 4, gnx, gny, npol_, nchan_ ) ; 215 295 Array<Complex> gdataArrC( gshape, 0.0 ) ; 216 Array<Float> gwgtArr( gshape, 0.0 ) ; 296 //Array<Float> gwgtArr( gshape, 0.0 ) ; 297 // 2011/12/20 TN 298 // data_ and weight array shares storage 299 data_.resize( gshape ) ; 300 data_ = 0.0 ; 301 Array<Float> gwgtArr( data_ ) ; 217 302 Complex *gdata_p = gdataArrC.getStorage( deleteDataG ) ; 218 303 Float *wdata_p = gwgtArr.getStorage( deleteWgtG ) ; … … 278 363 gdataArrC.putStorage( gdata_p, deleteDataG ) ; 279 364 gwgtArr.putStorage( wdata_p, deleteWgtG ) ; 280 setData( data_,gdataArrC, gwgtArr ) ;365 setData( gdataArrC, gwgtArr ) ; 281 366 //Matrix<Double> sumWeight( IPosition( 2, npol_, nchan_ ), sumw_p, TAKE_OVER ) ; 282 367 delete sumw_p ; … … 287 372 } 288 373 289 void STGrid::setData( Array<Float> &data, 290 Array<Complex> &gdata, 374 void STGrid::setData( Array<Complex> &gdata, 291 375 Array<Float> &gwgt ) 292 376 { 377 // 2011/12/20 TN 378 // gwgt and data_ share storage 293 379 LogIO os( LogOrigin("STGrid","setData",WHERE) ) ; 294 380 double t0, t1 ; 295 381 t0 = mathutil::gettimeofday_sec() ; 296 data.resize( gdata.shape() ) ; 297 uInt len = data.nelements() ; 298 Float *w0_p ; 382 //data.resize( gdata.shape() ) ; 383 uInt len = data_.nelements() ; 299 384 const Complex *w1_p ; 300 constFloat *w2_p ;385 Float *w2_p ; 301 386 Bool b0, b1, b2 ; 302 Float *data_p = data.getStorage( b0 ) ;303 387 const Complex *gdata_p = gdata.getStorage( b1 ) ; 304 const Float *gwgt_p = gwgt.getStorage( b2 ) ; 305 w0_p = data_p ; 388 Float *gwgt_p = data_.getStorage( b2 ) ; 306 389 w1_p = gdata_p ; 307 390 w2_p = gwgt_p ; 308 391 for ( uInt i = 0 ; i < len ; i++ ) { 309 *w0_p = (*w2_p > 0.0) ? ((*w1_p).real() / *w2_p) : 0.0 ;310 w0_p++;392 //*w2_p = (*w2_p > 0.0) ? ((*w1_p).real() / *w2_p) : 0.0 ; 393 if ( *w2_p > 0.0 ) *w2_p = (*w1_p).real() / *w2_p ; 311 394 w1_p++ ; 312 395 w2_p++ ; 313 396 } 314 data.putStorage( data_p, b0 ) ;315 397 gdata.freeStorage( gdata_p, b1 ) ; 316 gwgt.freeStorage( gwgt_p, b2 ) ;398 data_.putStorage( gwgt_p, b2 ) ; 317 399 t1 = mathutil::gettimeofday_sec() ; 318 400 os << "setData: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; … … 586 668 t1 = mathutil::gettimeofday_sec() ; 587 669 os << "toInt: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; 670 } 671 672 void STGrid::getDataChunk( Array<Complex> &spectra, 673 Array<Double> &direction, 674 Array<Int> &flagtra, 675 Array<Int> &rflag, 676 Array<Float> &weight ) 677 { 588 678 } 589 679 -
trunk/src/STGrid.h
r2375 r2378 66 66 67 67 void grid() ; 68 void gridPerRow() ; 68 69 69 70 string saveData( string outfile="" ) ; … … 82 83 String ¢er ) ; 83 84 84 void setData( Array<Float> &data, 85 Array<Complex> &gdata, 85 void setData( Array<Complex> &gdata, 86 86 Array<Float> &gwgt ) ; 87 87 88 void getData( Array<Complex> &spectra, 89 Array<Double> &direction, 90 Array<Int> &flagtra, 91 Array<Int> &rflag, 92 Array<Float> &weight ) ; 88 93 void getData( Array<Complex> &spectra, 89 94 Array<Double> &direction, … … 91 96 Array<uInt> &rflag, 92 97 Array<Float> &weight ) ; 93 void getData ( Array<Complex> &spectra,94 Array<Double> &direction,95 Array<Int> &flagtra,96 Array<Int> &rflag,97 Array<Float> &weight ) ;98 void getDataChunk( Array<Complex> &spectra, 99 Array<Double> &direction, 100 Array<Int> &flagtra, 101 Array<Int> &rflag, 102 Array<Float> &weight ) ; 98 103 99 104 void getWeight( Array<Float> &w, … … 120 125 void prepareTable( Table &tab, String &name ) ; 121 126 127 Bool pastEnd() ; 128 129 122 130 String infile_ ; 123 131 Int ifno_ ; … … 140 148 141 149 Table tab_ ; 150 Int irow_ ; 142 151 }; 143 152 }
Note:
See TracChangeset
for help on using the changeset viewer.