Changeset 2380


Ignore:
Timestamp:
12/21/11 16:30:13 (12 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-2816

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No?

Module(s): Module Names change impacts.

Description: Describe your changes here...

Fixed a shape mismatch in row flag data which must have a shape (nrow)
while it was (npol,nrow).


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STGrid.cpp

    r2379 r2380  
    196196  // data storage
    197197  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_ ) ;
    200201  IPosition dshape( 2, 2, nchunk_ ) ;
    201   Array<Complex> spectra( mshape ) ;
     202  IPosition wshape( 2, nchan_, nchunk_ ) ;
     203  Array<Complex> spectra( cshape ) ;
    202204  Array<Double> direction( dshape ) ;
    203   Array<Int> flagtra( mshape ) ;
     205  Array<Int> flagtra( cshape ) ;
     206  //Array<Int> rflag( mshape ) ;
    204207  Array<Int> rflag( vshape ) ;
    205   Array<Float> weight( vshape ) ;
     208  Array<Float> weight( wshape ) ;
    206209  Array<Double> xypos( dshape ) ;
    207210
     
    237240  double eToPixel = 0.0 ;
    238241  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 ) ;
    239252
    240253  while( !pastEnd() ) {
     
    252265    eToPixel += t1-t0 ;
    253266   
    254     // prepare pointer
    255     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 
    264267    // call ggridsd
    265268    irow = -1 ;
     
    290293    eGGridSD += t1-t0 ;
    291294
    292     // finalization
    293     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 ) ;
    301295  }
    302296  os << "getDataChunk: elapsed time is " << eGetDataChunk << " sec." << LogIO::POST ;
     
    306300
    307301  // 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 ) ;
    308310  delete polMap ;
    309311  delete chanMap ;
     
    702704  IPosition cshape( 3, npol_, nchan_, nrow_ ) ;
    703705  IPosition mshape( 2, npol_, nrow_ ) ;
     706  IPosition vshape( 1, nrow_ ) ;
    704707  spectra.resize( cshape ) ;
    705708  flagtra.resize( cshape ) ;
    706   rflag.resize( mshape ) ;
     709  rflag.resize( vshape ) ;
     710  Vector<uInt> rflagPerPol( rflag ) ;
    707711  direction.resize( IPosition(2,2,nrow_) ) ;
    708712  Array<Float> tsys( cshape ) ;
     
    710714
    711715  ArrayIterator<uChar> fli( flagtra, IPosition(2,1,2) ) ;
    712   ArrayIterator<uInt> fri( rflag, IPosition(1,1) ) ;
    713716  ArrayIterator<Float> tsi( tsys, IPosition(2,1,2) ) ;
    714717  ArrayIterator<Double> tii( tint, IPosition(1,1) ) ;
     
    722725  uInt len = nchan_ * nrow_ ;
    723726  IPosition mshape2( 2, nchan_, nrow_ ) ;
    724   IPosition vshape( 1, nrow_ ) ;
    725727  Vector<Float> spSlice( nchan_ ) ;
    726728  const Float *sps_p = spSlice.getStorage( bsps ) ;
     
    746748    }
    747749    Array<uChar> flSlice = fli.array() ;
    748     Vector<uInt> frSlice = fri.array() ;
    749750    flagtraCol.getColumn( flSlice ) ;
    750     rflagCol.getColumn( frSlice ) ;
    751     if ( ipol == 0 )
     751    if ( ipol == 0 ) {
    752752      directionCol.getColumn( direction ) ;
     753      rflagCol.getColumn( rflagPerPol ) ;
     754    }
     755    else {
     756      rflagPerPol += rflagCol.getColumn() ;
     757    }
    753758    Vector<Float> tmpF = tsysCol( 0 ) ;
    754759    Array<Float> tsSlice = tsi.array() ;
     
    765770
    766771    fli.next() ;
    767     fri.next() ;
    768772    tsi.next() ;
    769773    tii.next() ;
     
    777781//   os << "direction=" << direction << LogIO::POST ;
    778782
     783  weight.resize( IPosition(2,nchan_,nrow_) ) ;
    779784  getWeight( weight, tsys, tint ) ;
    780785}
     
    826831  Int nrow = min( spectra.shape()[2], nrow_-nprocessed_ ) ;
    827832  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]) ) ;
    829835  IPosition m( 2, 0, 2 ) ;
    830836  IPosition v( 1, 0 ) ;
     
    832838  ArrayIterator<uChar> fli( flagtra, m, False ) ;
    833839  ArrayIterator<Float> tsi( tsys, m, False ) ;
    834   ArrayIterator<Double> di( direction, v ) ; 
     840  ArrayIterator<Double> di( direction, v ) ;
    835841  Bool bfr, bti ;
    836842  uInt *fr_p = rflag.getStorage( bfr ) ;
     
    855861      tsSlice = tmpF[0] ;
    856862    }
    857     *wfr_p = flagRowCol_( idx ) ;
    858863    *wti_p = intervalCol_( idx ) ;
    859864
     
    861866    fli.next() ;
    862867    tsi.next() ;
    863     wfr_p++ ;
    864868    wti_p++ ;
    865869  }
    866   rflag.putStorage( fr_p, bfr ) ;
    867870  tint.putStorage( ti_p, bti ) ;
    868871
     
    871874    directionCol_.get( idx, di.array() ) ;
    872875    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 ) ;
    874884
    875885  getWeight( weight, tsys, tint ) ;
     
    935945  Int nchan = refShape[1] ;
    936946  Int nrow = refShape[2] ;
    937   w.resize( IPosition(2,nchan,nrow) ) ;
    938947
    939948  // set weight
    940   Bool warn = False ;
    941949  if ( wtype_.compare( "UNIFORM" ) == 0 ) {
    942950    w = 1.0 ;
    943951  }
    944952  else if ( wtype_.compare( "TINT" ) == 0 ) {
    945     if ( npol_ > 1 ) warn = True ;
    946953    Bool b0, b1 ;
    947954    Float *w_p = w.getStorage( b0 ) ;
     
    960967  }
    961968  else if ( wtype_.compare( "TSYS" ) == 0 ) {
    962     if ( npol_ > 1 ) warn = True ;
    963969    Bool b0, b1 ;
    964970    Float *w_p = w.getStorage( b0 ) ;
     
    977983  }
    978984  else if ( wtype_.compare( "TINTSYS" ) == 0 ) {
    979     if ( npol_ > 1 ) warn = True ;
    980985    Bool b0, b1, b2 ;
    981986    Float *w_p = w.getStorage( b0 ) ;
Note: See TracChangeset for help on using the changeset viewer.