Changeset 2851


Ignore:
Timestamp:
09/13/13 16:03:36 (11 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: test_sdgrid[sdgrid_flagging]

Put in Release Notes: No

Module(s): sd

Description: Describe your changes here...

Handle channel flags properly.


Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STGrid.cpp

    r2803 r2851  
    661661  data_.resize( gshape ) ;
    662662  data_ = 0.0 ;
     663  flag_.resize( gshape ) ;
     664  flag_ = (uChar)0;
    663665  STCommonData common = STCommonData(gshape, data_);
    664666  common.gnx = gnx ;
     
    809811  data_.resize( gshape ) ;
    810812  data_ = 0.0 ;
     813  flag_.resize( gshape ) ;
     814  flag_ = (uChar)0;
    811815  STCommonDataWithClipping common = STCommonDataWithClipping( gshape,
    812816                                                              pshape,
     
    10191023  const Complex *w1_p ;
    10201024  Float *w2_p ;
    1021   Bool b1, b2 ;
     1025  Bool b1, b2, b3 ;
    10221026  const Complex *gdata_p = gdata.getStorage( b1 ) ;
    10231027  Float *gwgt_p = data_.getStorage( b2 ) ;
    1024   w1_p = gdata_p ;
    1025   w2_p = gwgt_p ;
     1028  uChar *gflg_p = flag_.getStorage( b3 ) ;
    10261029  for ( uInt i = 0 ; i < len ; i++ ) {
    1027     if ( *w2_p > 0.0 ) *w2_p = (*w1_p).real() / *w2_p ;
    1028     w1_p++ ;
    1029     w2_p++ ;
     1030    if (gwgt_p[i] > 0.0) {
     1031      gwgt_p[i] = (gdata_p[i]).real() / gwgt_p[i];
     1032      gflg_p[i] = (uChar)0;
     1033    }
     1034    else {
     1035      gflg_p[i] = (uChar)1;
     1036    }
    10301037  }
    10311038  gdata.freeStorage( gdata_p, b1 ) ;
    10321039  data_.putStorage( gwgt_p, b2 ) ;
     1040  flag_.putStorage( gflg_p, b3 ) ;
    10331041  t1 = mathutil::gettimeofday_sec() ;
    10341042  os << LogIO::DEBUGGING << "setData: elapsed time is " << t1-t0 << " sec." << LogIO::POST ;
     
    19731981  Int irow = 0 ;
    19741982  Vector<Float> sp( nchan_ ) ;
    1975   Vector<uChar> flag( nchan_, (uChar)1 ) ;
    1976   Vector<uChar> unflag( nchan_, (uChar)0 ) ;
    1977   Bool bsp, bdata ;
     1983  Vector<uChar> flag( nchan_ ) ;
     1984  Bool bsp, bdata, bflag ;
    19781985  const Float *data_p = data_.getStorage( bdata ) ;
     1986  const uChar *flag_p = flag_.getStorage( bflag ) ;
    19791987  Float *wsp_p, *sp_p ;
    19801988  const Float *wdata_p = data_p ;
     1989  const uChar *wflag_p = flag_p ;
    19811990  long step = nx_ * ny_ * npol_ ;
    19821991  long offset ;
     
    19942003        wsp_p = sp_p ;
    19952004        wdata_p = data_p + offset ;
     2005        wflag_p = flag_p + offset ;
    19962006        for ( Int ichan = 0 ; ichan < nchan_ ; ichan++ ) {
    19972007          *wsp_p = *wdata_p ;
    19982008          wsp_p++ ;
    19992009          wdata_p += step ;
     2010          flag[ichan] = *wflag_p;
     2011          wflag_p += step ;
    20002012        }
    20012013        sp.putStorage( sp_p, bsp ) ;
    20022014        spectraCol.put( irow, sp ) ;
    2003         if ( allEQ( sp, (Float)0.0 ) ) {
    2004           flagtraCol.put( irow, flag ) ;
    2005         }
    2006         else {
    2007           flagtraCol.put( irow, unflag ) ;
    2008         }
     2015        flagtraCol.put( irow, flag ) ;
    20092016        directionCol.put( irow, dir ) ;
    20102017        polnoCol.put( irow, pollist_[ipol] ) ;
     
    20162023  }
    20172024  data_.freeStorage( data_p, bdata ) ;
     2025  flag_.freeStorage( flag_p, bflag ) ;
    20182026
    20192027  fillMainColumns( tab ) ;
  • trunk/src/STGrid.h

    r2686 r2851  
    262262  Int nrow_ ;
    263263  Array<Float> data_ ;
     264  Array<uChar> flag_ ;
    264265
    265266  Table tab_ ;
Note: See TracChangeset for help on using the changeset viewer.