- Timestamp:
- 12/21/11 20:07:23 (13 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STGrid.cpp
r2380 r2381 153 153 Double*); 154 154 } 155 void STGrid::call_ggridsd( Double* xy, 156 const Complex* values, 157 Int* nvispol, 158 Int* nvischan, 159 const Int* flag, 160 const Int* rflag, 161 const Float* weight, 162 Int* nrow, 163 Int* irow, 164 Complex* grid, 165 Float* wgrid, 166 Int* nx, 167 Int* ny, 168 Int * npol, 169 Int * nchan, 170 Int* support, 171 Int* sampling, 172 Float* convFunc, 173 Int *chanMap, 174 Int *polMap ) 175 { 176 // parameters for gridding 177 Int idopsf = 0 ; 178 Int len = (*npol)*(*nchan) ; 179 Double *sumw_p = new Double[len] ; 180 { 181 Double *work_p = sumw_p ; 182 for ( Int i = 0 ; i < len ; i++ ) { 183 *work_p = 0.0 ; 184 work_p++ ; 185 } 186 } 187 188 // call ggridsd 189 ggridsd( xy, 190 values, 191 nvispol, 192 nvischan, 193 &idopsf, 194 flag, 195 rflag, 196 weight, 197 nrow, 198 irow, 199 grid, 200 wgrid, 201 nx, 202 ny, 203 npol, 204 nchan, 205 support, 206 sampling, 207 convFunc, 208 chanMap, 209 polMap, 210 sumw_p ) ; 211 212 // finalization 213 delete sumw_p ; 214 } 215 155 216 void STGrid::gridPerRow() 156 217 { … … 204 265 Array<Double> direction( dshape ) ; 205 266 Array<Int> flagtra( cshape ) ; 206 //Array<Int> rflag( mshape ) ;207 267 Array<Int> rflag( vshape ) ; 208 268 Array<Float> weight( wshape ) ; 209 269 Array<Double> xypos( dshape ) ; 210 270 271 spectraF_.resize( cshape ) ; 272 flagtraUC_.resize( cshape ) ; 273 rflagUI_.resize( vshape ) ; 274 211 275 // parameters for gridding 212 Int idopsf = 0 ;213 276 Int *chanMap = new Int[nchan_] ; 214 277 { … … 227 290 } 228 291 } 229 Double *sumw_p = new Double[npol_*nchan_] ;230 {231 Double *work_p = sumw_p ;232 for ( Int i = 0 ; i < npol_*nchan_ ; i++ ) {233 *work_p = 0.0 ;234 work_p++ ;235 }236 }237 292 238 293 // for performance check … … 240 295 double eToPixel = 0.0 ; 241 296 double eGGridSD = 0.0 ; 297 double eToInt = 0.0 ; 242 298 243 299 // prepare pointer … … 258 314 t1 = mathutil::gettimeofday_sec() ; 259 315 eGetDataChunk += t1-t0 ; 316 eToInt += subtime_ ; 260 317 261 318 // world -> pixel … … 268 325 irow = -1 ; 269 326 t0 = mathutil::gettimeofday_sec() ; 270 ggridsd( xypos_p, 271 data_p, 272 &npol_, 273 &nchan_, 274 &idopsf, 275 flag_p, 276 rflag_p, 277 wgt_p, 278 &nrow, 279 &irow, 280 gdata_p, 281 wdata_p, 282 &gnx, 283 &gny, 284 &npol_, 285 &nchan_, 286 &convSupport_, 287 &convSampling_, 288 conv_p, 289 chanMap, 290 polMap, 291 sumw_p ) ; 327 call_ggridsd( xypos_p, 328 data_p, 329 &npol_, 330 &nchan_, 331 flag_p, 332 rflag_p, 333 wgt_p, 334 &nrow, 335 &irow, 336 gdata_p, 337 wdata_p, 338 &gnx, 339 &gny, 340 &npol_, 341 &nchan_, 342 &convSupport_, 343 &convSampling_, 344 conv_p, 345 chanMap, 346 polMap ) ; 292 347 t1 = mathutil::gettimeofday_sec() ; 293 348 eGGridSD += t1-t0 ; … … 297 352 os << "toPixel: elapsed time is " << eToPixel << " sec." << LogIO::POST ; 298 353 os << "ggridsd: elapsed time is " << eGGridSD << " sec." << LogIO::POST ; 299 354 os << "toInt: elapsed time is " << eToInt << " sec." << LogIO::POST ; 300 355 301 356 // finalization … … 310 365 delete polMap ; 311 366 delete chanMap ; 312 delete sumw_p ;313 367 314 368 // set data … … 358 412 nchunk_ = 100 ; 359 413 Bool b = nchunk_ >= nrow_ ; 414 nchunk_ = min( nchunk_, nrow_ ) ; 360 415 return b ; 361 416 } … … 363 418 void STGrid::gridAll() 364 419 { 365 LogIO os( LogOrigin("STGrid", "grid ", WHERE) ) ;420 LogIO os( LogOrigin("STGrid", "gridAll", WHERE) ) ; 366 421 367 422 // retrieve data … … 433 488 Complex *gdata_p = gdataArrC.getStorage( deleteDataG ) ; 434 489 Float *wdata_p = gwgtArr.getStorage( deleteWgtG ) ; 435 Int idopsf = 0 ;436 490 Int *chanMap = new Int[nchan_] ; 437 491 { … … 450 504 } 451 505 } 452 Double *sumw_p = new Double[npol_*nchan_] ;453 {454 Double *work_p = sumw_p ;455 for ( Int i = 0 ; i < npol_*nchan_ ; i++ ) {456 *work_p = 0.0 ;457 work_p++ ;458 }459 }460 506 t0 = mathutil::gettimeofday_sec() ; 461 507 Int irow = -1 ; 462 ggridsd( xypos_p, 463 data_p, 464 &npol_, 465 &nchan_, 466 &idopsf, 467 flag_p, 468 rflag_p, 469 wgt_p, 470 &nrow_, 471 &irow, 472 gdata_p, 473 wdata_p, 474 &gnx, 475 &gny, 476 &npol_, 477 &nchan_, 478 &convSupport_, 479 &convSampling_, 480 conv_p, 481 chanMap, 482 polMap, 483 sumw_p ) ; 508 call_ggridsd( xypos_p, 509 data_p, 510 &npol_, 511 &nchan_, 512 flag_p, 513 rflag_p, 514 wgt_p, 515 &nrow_, 516 &irow, 517 gdata_p, 518 wdata_p, 519 &gnx, 520 &gny, 521 &npol_, 522 &nchan_, 523 &convSupport_, 524 &convSampling_, 525 conv_p, 526 chanMap, 527 polMap ) ; 484 528 t1 = mathutil::gettimeofday_sec() ; 485 529 os << "ggridsd: elapsed time is " << t1-t0 << " sec." << LogIO::POST ; … … 496 540 setData( gdataArrC, gwgtArr ) ; 497 541 //Matrix<Double> sumWeight( IPosition( 2, npol_, nchan_ ), sumw_p, TAKE_OVER ) ; 498 delete sumw_p ;499 542 //cout << "sumWeight = " << sumWeight << endl ; 500 543 // os << "gdataArr = " << gdataArr << LogIO::POST ; … … 689 732 tsysCol_.attach( tab_, "TSYS" ) ; 690 733 intervalCol_.attach( tab_, "INTERVAL" ) ; 734 // Vector<String> colnames( 6 ) ; 735 // colnames[0] = "SPECTRA" ; 736 // colnames[1] = "FLAGTRA" ; 737 // colnames[2] = "DIRECTION" ; 738 // colnames[3] = "FLAGROW" ; 739 // colnames[4] = "TSYS" ; 740 // colnames[5] = "INTERVAL" ; 741 // row_ = ROTableRow( tab_, colnames ) ; 742 // const TableRecord &rec = row_.record() ; 743 // spectraRF_.attachToRecord( rec, colnames[0] ) ; 744 // flagtraRF_.attachToRecord( rec, colnames[1] ) ; 745 // directionRF_.attachToRecord( rec, colnames[2] ) ; 746 // flagRowRF_.attachToRecord( rec, colnames[3] ) ; 747 // tsysRF_.attachToRecord( rec, colnames[4] ) ; 748 // intervalRF_.attachToRecord( rec, colnames[5] ) ; 691 749 } 692 750 … … 811 869 Array<Float> &weight ) 812 870 { 813 Array<Float> spFloat( spectra.shape() ) ; 814 Array<uChar> fluChar( flagtra.shape() ) ; 815 Array<uInt> fruInt( rflag.shape() ) ; 816 Int nrow = getDataChunk( spFloat, direction, fluChar, fruInt, weight ) ; 817 convertArray( spectra, spFloat ) ; 818 convertArray( flagtra, fluChar ) ; 819 convertArray( rflag, fruInt ) ; 820 871 Int nrow = getDataChunk( spectraF_, direction, flagtraUC_, rflagUI_, weight ) ; 872 double t0, t1 ; 873 t0 = mathutil::gettimeofday_sec() ; 874 convertArray( spectra, spectraF_ ) ; 875 convertArray( flagtra, flagtraUC_ ) ; 876 convertArray( rflag, rflagUI_ ) ; 877 t1 = mathutil::gettimeofday_sec() ; 878 subtime_ = t1 - t0 ; 879 821 880 return nrow ; 822 881 } … … 831 890 Int nrow = min( spectra.shape()[2], nrow_-nprocessed_ ) ; 832 891 Array<Float> tsys( spectra.shape() ) ; 833 //Array<Double> tint( rflag.shape() ) ;834 892 Array<Double> tint( IPosition(2,spectra.shape()[0],spectra.shape()[2]) ) ; 835 893 IPosition m( 2, 0, 2 ) ; … … 845 903 Double *wti_p = ti_p ; 846 904 Int offset = nprocessed_ * npol_ ; 905 Int start = offset ; 906 Int end = start + nrow * npol_ ; 847 907 for ( Int irow = 0 ; irow < npol_ * nrow ; irow++ ) { 848 908 Array<Float> spSlice = spi.array() ; … … 869 929 } 870 930 tint.putStorage( ti_p, bti ) ; 871 872 931 for ( Int irow = 0 ; irow < nrow ; irow += npol_ ) { 873 932 uInt idx = rows_[offset+irow] ; … … 882 941 } 883 942 rflag.putStorage( fr_p, bfr ) ; 943 // Bool bti, bfr ; 944 // Double *ti_p = tint.getStorage( bti ) ; 945 // Double *wti_p = ti_p ; 946 // uInt *fr_p = rflag.getStorage( bfr ) ; 947 // uInt *wfr_p = fr_p - 1 ; 948 // Int start = nprocessed_ * npol_ ; 949 // Int end = start + nrow * npol_ ; 950 // for ( Int irow = start ; irow < end ; irow++ ) { 951 // uInt idx = rows_[irow] ; 952 // row_.get( idx ) ; 953 // // SPECTRA 954 // // os << "spi.array().shape()=" << spi.array().shape() << LogIO::POST ; 955 // // os << "(*spectraRF_).shape()=" << (*spectraRF_).shape() << LogIO::POST ; 956 // spi.array() = *spectraRF_ ; 957 958 // // FLAGTRA 959 // fli.array() = *flagtraRF_ ; 960 961 // // INTERVAL 962 // *wti_p = *intervalRF_ ; 963 964 // // TSYS 965 // // os << "tsi.array().shape()=" << tsi.array().shape() << LogIO::POST ; 966 // // os << "(*tsysRF_).shape()=" << (*tsysRF_).shape() << LogIO::POST ; 967 // // os << "(*tsysRF_).nelements()=" << (*tsysRF_).nelements() << LogIO::POST ; 968 // if ( (*tsysRF_).nelements() == (uInt)nchan_ ) 969 // tsi.array() = *tsysRF_ ; 970 // else 971 // tsi.array() = *((*tsysRF_).data()) ; 972 973 // // DIRECTION and FLAGROW 974 // Int mod = irow % npol_ ; 975 // if ( mod == 0 ) { 976 // // os << "di.array().shape()=" << di.array().shape() << LogIO::POST ; 977 // // os << "(*directionRF_).shape()=" << (*directionRF_).shape() << LogIO::POST ; 978 // di.array() = *directionRF_ ; 979 // wfr_p++ ; 980 // *wfr_p = *flagRowRF_ ; 981 // } 982 // else { 983 // *wfr_p += *flagRowRF_ ; 984 // } 985 986 // // increment 987 // spi.next() ; 988 // fli.next() ; 989 // tsi.next() ; 990 // di.next() ; 991 // *wti_p++ ; 992 // } 993 // tint.putStorage( ti_p, bti ) ; 994 // rflag.putStorage( fr_p, bfr ) ; 884 995 885 996 getWeight( weight, tsys, tint ) ; -
trunk/src/STGrid.h
r2379 r2381 19 19 20 20 #include <casa/BasicSL/String.h> 21 #include <casa/Arrays/Array.h> 21 22 #include <casa/Arrays/Vector.h> 22 #include <casa/Arrays/Matrix.h> 23 #include <casa/Arrays/Cube.h> 24 // #include <casa/Arrays/ArrayMath.h> 25 // #include <casa/Inputs/Input.h> 26 // #include <casa/Quanta/Quantum.h> 27 // #include <casa/Quanta/QuantumHolder.h> 28 // #include <casa/Utilities/CountedPtr.h> 23 #include <casa/Containers/RecordField.h> 29 24 30 25 #include <tables/Tables/Table.h> 31 26 #include <tables/Tables/ScalarColumn.h> 32 27 #include <tables/Tables/ArrayColumn.h> 28 //#include <tables/Tables/TableRow.h> 33 29 34 30 // #include <measures/Measures/MDirection.h> … … 137 133 void attach() ; 138 134 135 void call_ggridsd( Double* xy, 136 const Complex* values, 137 Int* nvispol, 138 Int* nvischan, 139 const Int* flag, 140 const Int* rflag, 141 const Float* weight, 142 Int* nrow, 143 Int* irow, 144 Complex* grid, 145 Float* wgrid, 146 Int* nx, 147 Int* ny, 148 Int * npol, 149 Int * nchan, 150 Int* support, 151 Int* sampling, 152 Float* convFunc, 153 Int *chanMap, 154 Int *polMap ) ; 155 139 156 140 157 String infile_ ; … … 164 181 ROArrayColumn<Float> tsysCol_ ; 165 182 ROScalarColumn<Double> intervalCol_ ; 183 // ROTableRow row_ ; 184 // RORecordFieldPtr< Array<Float> > spectraRF_ ; 185 // RORecordFieldPtr< Array<uChar> > flagtraRF_ ; 186 // RORecordFieldPtr< Array<Double> > directionRF_ ; 187 // RORecordFieldPtr<uInt> flagRowRF_ ; 188 // RORecordFieldPtr< Array<Float> > tsysRF_ ; 189 // RORecordFieldPtr<Double> intervalRF_ ; 166 190 Int nprocessed_ ; 167 191 Vector<uInt> rows_ ; 168 192 Int nchunk_ ; 193 194 Array<Float> spectraF_ ; 195 Array<uChar> flagtraUC_ ; 196 Array<uInt> rflagUI_ ; 197 198 double subtime_ ; 169 199 }; 170 200 }
Note:
See TracChangeset
for help on using the changeset viewer.