- Timestamp:
- 12/21/11 16:30:13 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STGrid.cpp
r2379 r2380 196 196 // data storage 197 197 Int irow = -1 ; 198 IPosition mshape( 3, npol_, nchan_, nchunk_ ) ; 199 IPosition vshape( 2, npol_, nchunk_ ) ; 198 IPosition cshape( 3, npol_, nchan_, nchunk_ ) ; 199 IPosition mshape( 2, npol_, nchunk_ ) ; 200 IPosition vshape( 1, nchunk_ ) ; 200 201 IPosition dshape( 2, 2, nchunk_ ) ; 201 Array<Complex> spectra( mshape ) ; 202 IPosition wshape( 2, nchan_, nchunk_ ) ; 203 Array<Complex> spectra( cshape ) ; 202 204 Array<Double> direction( dshape ) ; 203 Array<Int> flagtra( mshape ) ; 205 Array<Int> flagtra( cshape ) ; 206 //Array<Int> rflag( mshape ) ; 204 207 Array<Int> rflag( vshape ) ; 205 Array<Float> weight( vshape ) ;208 Array<Float> weight( wshape ) ; 206 209 Array<Double> xypos( dshape ) ; 207 210 … … 237 240 double eToPixel = 0.0 ; 238 241 double eGGridSD = 0.0 ; 242 243 // prepare pointer 244 Float *conv_p = convFunc.getStorage( deleteConv ) ; 245 Complex *gdata_p = gdataArrC.getStorage( deleteDataG ) ; 246 Float *wdata_p = gwgtArr.getStorage( deleteWgtG ) ; 247 const Complex *data_p = spectra.getStorage( deleteData ) ; 248 const Float *wgt_p = weight.getStorage( deleteWgt ) ; 249 const Int *flag_p = flagtra.getStorage( deleteFlag ) ; 250 const Int *rflag_p = rflag.getStorage( deleteFlagR ) ; 251 Double *xypos_p = xypos.getStorage( deletePos ) ; 239 252 240 253 while( !pastEnd() ) { … … 252 265 eToPixel += t1-t0 ; 253 266 254 // prepare pointer255 Float *conv_p = convFunc.getStorage( deleteConv ) ;256 Complex *gdata_p = gdataArrC.getStorage( deleteDataG ) ;257 Float *wdata_p = gwgtArr.getStorage( deleteWgtG ) ;258 const Complex *data_p = spectra.getStorage( deleteData ) ;259 const Float *wgt_p = weight.getStorage( deleteWgt ) ;260 const Int *flag_p = flagtra.getStorage( deleteFlag ) ;261 const Int *rflag_p = rflag.getStorage( deleteFlagR ) ;262 Double *xypos_p = xypos.getStorage( deletePos ) ;263 264 267 // call ggridsd 265 268 irow = -1 ; … … 290 293 eGGridSD += t1-t0 ; 291 294 292 // finalization293 convFunc.putStorage( conv_p, deleteConv ) ;294 gdataArrC.putStorage( gdata_p, deleteDataG ) ;295 gwgtArr.putStorage( wdata_p, deleteWgtG ) ;296 xypos.putStorage( xypos_p, deletePos ) ;297 spectra.freeStorage( data_p, deleteData ) ;298 weight.freeStorage( wgt_p, deleteWgt ) ;299 flagtra.freeStorage( flag_p, deleteFlag ) ;300 rflag.freeStorage( rflag_p, deleteFlagR ) ;301 295 } 302 296 os << "getDataChunk: elapsed time is " << eGetDataChunk << " sec." << LogIO::POST ; … … 306 300 307 301 // finalization 302 convFunc.putStorage( conv_p, deleteConv ) ; 303 gdataArrC.putStorage( gdata_p, deleteDataG ) ; 304 gwgtArr.putStorage( wdata_p, deleteWgtG ) ; 305 xypos.putStorage( xypos_p, deletePos ) ; 306 spectra.freeStorage( data_p, deleteData ) ; 307 weight.freeStorage( wgt_p, deleteWgt ) ; 308 flagtra.freeStorage( flag_p, deleteFlag ) ; 309 rflag.freeStorage( rflag_p, deleteFlagR ) ; 308 310 delete polMap ; 309 311 delete chanMap ; … … 702 704 IPosition cshape( 3, npol_, nchan_, nrow_ ) ; 703 705 IPosition mshape( 2, npol_, nrow_ ) ; 706 IPosition vshape( 1, nrow_ ) ; 704 707 spectra.resize( cshape ) ; 705 708 flagtra.resize( cshape ) ; 706 rflag.resize( mshape ) ; 709 rflag.resize( vshape ) ; 710 Vector<uInt> rflagPerPol( rflag ) ; 707 711 direction.resize( IPosition(2,2,nrow_) ) ; 708 712 Array<Float> tsys( cshape ) ; … … 710 714 711 715 ArrayIterator<uChar> fli( flagtra, IPosition(2,1,2) ) ; 712 ArrayIterator<uInt> fri( rflag, IPosition(1,1) ) ;713 716 ArrayIterator<Float> tsi( tsys, IPosition(2,1,2) ) ; 714 717 ArrayIterator<Double> tii( tint, IPosition(1,1) ) ; … … 722 725 uInt len = nchan_ * nrow_ ; 723 726 IPosition mshape2( 2, nchan_, nrow_ ) ; 724 IPosition vshape( 1, nrow_ ) ;725 727 Vector<Float> spSlice( nchan_ ) ; 726 728 const Float *sps_p = spSlice.getStorage( bsps ) ; … … 746 748 } 747 749 Array<uChar> flSlice = fli.array() ; 748 Vector<uInt> frSlice = fri.array() ;749 750 flagtraCol.getColumn( flSlice ) ; 750 rflagCol.getColumn( frSlice ) ; 751 if ( ipol == 0 ) 751 if ( ipol == 0 ) { 752 752 directionCol.getColumn( direction ) ; 753 rflagCol.getColumn( rflagPerPol ) ; 754 } 755 else { 756 rflagPerPol += rflagCol.getColumn() ; 757 } 753 758 Vector<Float> tmpF = tsysCol( 0 ) ; 754 759 Array<Float> tsSlice = tsi.array() ; … … 765 770 766 771 fli.next() ; 767 fri.next() ;768 772 tsi.next() ; 769 773 tii.next() ; … … 777 781 // os << "direction=" << direction << LogIO::POST ; 778 782 783 weight.resize( IPosition(2,nchan_,nrow_) ) ; 779 784 getWeight( weight, tsys, tint ) ; 780 785 } … … 826 831 Int nrow = min( spectra.shape()[2], nrow_-nprocessed_ ) ; 827 832 Array<Float> tsys( spectra.shape() ) ; 828 Array<Double> tint( rflag.shape() ) ; 833 //Array<Double> tint( rflag.shape() ) ; 834 Array<Double> tint( IPosition(2,spectra.shape()[0],spectra.shape()[2]) ) ; 829 835 IPosition m( 2, 0, 2 ) ; 830 836 IPosition v( 1, 0 ) ; … … 832 838 ArrayIterator<uChar> fli( flagtra, m, False ) ; 833 839 ArrayIterator<Float> tsi( tsys, m, False ) ; 834 ArrayIterator<Double> di( direction, v ) ; 840 ArrayIterator<Double> di( direction, v ) ; 835 841 Bool bfr, bti ; 836 842 uInt *fr_p = rflag.getStorage( bfr ) ; … … 855 861 tsSlice = tmpF[0] ; 856 862 } 857 *wfr_p = flagRowCol_( idx ) ;858 863 *wti_p = intervalCol_( idx ) ; 859 864 … … 861 866 fli.next() ; 862 867 tsi.next() ; 863 wfr_p++ ;864 868 wti_p++ ; 865 869 } 866 rflag.putStorage( fr_p, bfr ) ;867 870 tint.putStorage( ti_p, bti ) ; 868 871 … … 871 874 directionCol_.get( idx, di.array() ) ; 872 875 di.next() ; 873 } 876 877 *wfr_p = flagRowCol_( idx ) ; 878 for ( Int ipol = 1 ; ipol < npol_ ; ipol++ ) { 879 *wfr_p = max( *wfr_p, flagRowCol_( rows_[offset+irow+ipol] ) ) ; 880 } 881 wfr_p++ ; 882 } 883 rflag.putStorage( fr_p, bfr ) ; 874 884 875 885 getWeight( weight, tsys, tint ) ; … … 935 945 Int nchan = refShape[1] ; 936 946 Int nrow = refShape[2] ; 937 w.resize( IPosition(2,nchan,nrow) ) ;938 947 939 948 // set weight 940 Bool warn = False ;941 949 if ( wtype_.compare( "UNIFORM" ) == 0 ) { 942 950 w = 1.0 ; 943 951 } 944 952 else if ( wtype_.compare( "TINT" ) == 0 ) { 945 if ( npol_ > 1 ) warn = True ;946 953 Bool b0, b1 ; 947 954 Float *w_p = w.getStorage( b0 ) ; … … 960 967 } 961 968 else if ( wtype_.compare( "TSYS" ) == 0 ) { 962 if ( npol_ > 1 ) warn = True ;963 969 Bool b0, b1 ; 964 970 Float *w_p = w.getStorage( b0 ) ; … … 977 983 } 978 984 else if ( wtype_.compare( "TINTSYS" ) == 0 ) { 979 if ( npol_ > 1 ) warn = True ;980 985 Bool b0, b1, b2 ; 981 986 Float *w_p = w.getStorage( b0 ) ;
Note:
See TracChangeset
for help on using the changeset viewer.