Changeset 2374
- Timestamp:
- 12/16/11 19:55:23 (13 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STGrid.cpp
r2371 r2374 155 155 156 156 // retrieve data 157 Cube< Float> spectra ;157 Cube<Complex> spectra ; 158 158 Matrix<Double> direction ; 159 159 Cube<uChar> flagtra ; … … 209 209 Bool deletePos, deleteData, deleteWgt, deleteFlag, deleteFlagR, deleteConv, deleteDataG, deleteWgtG ; 210 210 Double *xypos_p = xypos.getStorage( deletePos ) ; 211 Cube<Complex> dataC( spectra.shape(), 0.0 ) ; 212 setReal( dataC, spectra ) ; 213 const Complex *data_p = dataC.getStorage( deleteData ) ; 211 const Complex *data_p = spectra.getStorage( deleteData ) ; 214 212 const Float *wgt_p = weight.getStorage( deleteWgt ) ; 215 213 const Int *flag_p = flagI.getStorage( deleteFlag ) ; … … 278 276 os << "ggridsd: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; 279 277 xypos.putStorage( xypos_p, deletePos ) ; 280 dataC.freeStorage( data_p, deleteData ) ;278 spectra.freeStorage( data_p, deleteData ) ; 281 279 weight.freeStorage( wgt_p, deleteWgt ) ; 282 280 flagI.freeStorage( flag_p, deleteFlag ) ; … … 287 285 gdataArrC.putStorage( gdata_p, deleteDataG ) ; 288 286 gwgtArr.putStorage( wdata_p, deleteWgtG ) ; 289 Array<Float> gdataArr = real( gdataArrC ) ; 290 setData( data_, gdataArr, gwgtArr ) ; 287 setData( data_, gdataArrC, gwgtArr ) ; 291 288 //Matrix<Double> sumWeight( IPosition( 2, npol_, nchan_ ), sumw_p, TAKE_OVER ) ; 292 289 delete sumw_p ; … … 298 295 299 296 void STGrid::setData( Array<Float> &data, 300 Array< Float> &gdata,297 Array<Complex> &gdata, 301 298 Array<Float> &gwgt ) 302 299 { … … 307 304 uInt len = data.nelements() ; 308 305 Float *w0_p ; 309 const Float *w1_p, *w2_p ; 306 const Complex *w1_p ; 307 const Float *w2_p ; 310 308 Bool b0, b1, b2 ; 311 309 Float *data_p = data.getStorage( b0 ) ; 312 const Float*gdata_p = gdata.getStorage( b1 ) ;310 const Complex *gdata_p = gdata.getStorage( b1 ) ; 313 311 const Float *gwgt_p = gwgt.getStorage( b2 ) ; 314 312 w0_p = data_p ; … … 316 314 w2_p = gwgt_p ; 317 315 for ( uInt i = 0 ; i < len ; i++ ) { 318 *w0_p = (*w2_p > 0.0) ? ( *w1_p/ *w2_p) : 0.0 ;316 *w0_p = (*w2_p > 0.0) ? ((*w1_p).real() / *w2_p) : 0.0 ; 319 317 w0_p++ ; 320 318 w1_p++ ; … … 457 455 } 458 456 459 void STGrid::getData( Cube< Float> &spectra,457 void STGrid::getData( Cube<Complex> &spectra, 460 458 Matrix<Double> &direction, 461 459 Cube<uChar> &flagtra, … … 463 461 Matrix<Float> &weight ) 464 462 { 463 // LogIO os( LogOrigin("STGrid","getData",WHERE) ) ; 464 // os << "start" << LogIO::POST ; 465 465 Table tab ; 466 466 selectData( tab ) ; 467 467 updatePolList( tab ) ; 468 // cout << "npol_ = " << npol_ << endl;469 // cout << "nchan_ = " << nchan_ << endl;470 // cout << "nrow_ = " << nrow_ << endl;468 // os << "npol_ = " << npol_ << LogIO::POST ; 469 // os << "nchan_ = " << nchan_ << LogIO::POST ; 470 // os << "nrow_ = " << nrow_ << LogIO::POST ; 471 471 spectra.resize( npol_, nchan_, nrow_ ) ; 472 472 flagtra.resize( npol_, nchan_, nrow_ ) ; … … 475 475 Matrix<Double> tint( npol_, nrow_ ) ; 476 476 // boolean for pointer access 477 Bool bsp, bfl, bfr, bts, bti ;477 Bool bsp, bfl, bfr, bts, bti, bsps ; 478 478 // pointer to the data 479 Float*sp_p = spectra.getStorage( bsp ) ;479 Complex *sp_p = spectra.getStorage( bsp ) ; 480 480 uChar *fl_p = flagtra.getStorage( bfl ) ; 481 481 uInt *fr_p = rflag.getStorage( bfr ) ; … … 483 483 Double *ti_p = tint.getStorage( bti ) ; 484 484 // working pointer 485 Float*wsp_p = sp_p ;485 Complex *wsp_p = sp_p ; 486 486 uChar *wfl_p = fl_p ; 487 487 uInt *wfr_p = fr_p ; … … 491 491 IPosition mshape( 2, nchan_, nrow_ ) ; 492 492 IPosition vshape( 1, nrow_ ) ; 493 Vector<Float> spSlice( nchan_ ) ; 494 const Float *sps_p = spSlice.getStorage( bsps ) ; 495 long cincr = npol_ ; 496 long rincr = npol_ * nchan_ ; 493 497 for ( Int ipol = 0 ; ipol < npol_ ; ipol++ ) { 494 498 Table subt = tab( tab.col("POLNO") == pollist_[ipol] ) ; … … 499 503 ROArrayColumn<Float> tsysCol( subt, "TSYS" ) ; 500 504 ROScalarColumn<Double> tintCol( subt, "INTERVAL" ) ; 501 Matrix<Float> spSlice( mshape, wsp_p, SHARE ) ; 505 for ( Int irow = 0 ; irow < nrow_ ; irow++ ) { 506 spectraCol.get( irow, spSlice ) ; 507 const Float *wsps_p = sps_p ; 508 wsp_p = sp_p + (long)ipol + rincr * (long)irow ; 509 for ( Int ichan = 0 ; ichan < nchan_ ; ichan++ ) { 510 *wsp_p = *wsps_p ; 511 wsps_p++ ; 512 wsp_p += cincr ; 513 } 514 } 502 515 Matrix<uChar> flSlice( mshape, wfl_p, SHARE ) ; 503 516 Vector<uInt> frSlice( vshape, wfr_p, SHARE ) ; 504 spectraCol.getColumn( spSlice ) ;505 517 flagtraCol.getColumn( flSlice ) ; 506 518 rflagCol.getColumn( frSlice ) ; … … 524 536 wti_p += nrow_ ; 525 537 } 538 spSlice.freeStorage( sps_p, bsps ) ; 526 539 spectra.putStorage( sp_p, bsp ) ; 527 540 flagtra.putStorage( fl_p, bfl ) ; … … 898 911 t1 = mathutil::gettimeofday_sec() ; 899 912 os << "saveData: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; 900 913 901 914 return outfile_ ; 902 915 } -
trunk/src/STGrid.h
r2371 r2374 83 83 84 84 void setData( Array<Float> &data, 85 Array< Float> &gdata,85 Array<Complex> &gdata, 86 86 Array<Float> &gwgt ) ; 87 87 88 void getData( Cube< Float> &spectra,88 void getData( Cube<Complex> &spectra, 89 89 Matrix<Double> &direction, 90 90 Cube<uChar> &flagtra,
Note:
See TracChangeset
for help on using the changeset viewer.