Changeset 2437 for trunk/src


Ignore:
Timestamp:
03/16/12 17:53:28 (13 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: Yes

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs: unit test of sdsmooth

Put in Release Notes: No

Module(s):

Description:

Changed the equation to calculate regridded spectral coordinate in
scantable.regrid_channel() so that it would have the same values as
the result of scantable.bin().
scantable.bin() now rebins Tsys arrays if necessary.


Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STMath.cpp

    r2429 r2437  
    19301930  ArrayColumn<Float> specCol(tout, "SPECTRA");
    19311931  ArrayColumn<uChar> flagCol(tout, "FLAGTRA");
     1932  ArrayColumn<Float> tsysCol(tout, "TSYS");
     1933
    19321934  for (uInt i=0; i < tout.nrow(); ++i ) {
    19331935    MaskedArray<Float> main  = maskedArray(specCol(i), flagCol(i));
    19341936    MaskedArray<Float> maout;
    19351937    LatticeUtilities::bin(maout, main, 0, Int(width));
    1936     /// @todo implement channel based tsys binning
    19371938    specCol.put(i, maout.getArray());
    19381939    flagCol.put(i, flagsFromMA(maout));
     1940    if (tsysCol(i).nelements() == specCol(i).nelements()) {
     1941      MaskedArray<Float> matsysin = maskedArray(tsysCol(i), flagCol(i));
     1942      MaskedArray<Float> matsysout;
     1943      LatticeUtilities::bin(matsysout, matsysin, 0, Int(width));
     1944      tsysCol.put(i, matsysout.getArray());
     1945    }
    19391946    // take only the first binned spectrum's length for the deprecated
    19401947    // global header item nChan
  • trunk/src/Scantable.cpp

    r2435 r2437  
    19171917       * need to shift refpix to 0
    19181918       ***/
    1919       refval = refval - ( refpix + 0.5 * (1 - factor) ) * increment ;
    1920       refpix = 0 ;
     1919      //refval = refval - ( refpix + 0.5 * (1 - factor) ) * increment ;
     1920      refpix = (refpix + 0.5)/factor - 0.5;
    19211921      freqTable_.setEntry( refpix, refval, increment*factor, currId ) ;
    19221922      os << "ID" << currId << ": channel width (Orig) = " << oldincr << " [" << freqTable_.getUnitString() << "], scale factor = " << factor << LogIO::POST ;
     
    19741974  Vector<Float> oldtsys = tsysCol_( irow ) ;
    19751975  Vector<Float> newspec( nChan, 0 ) ;
    1976   //Vector<uChar> newflag( nChan, false ) ;
    19771976  Vector<uChar> newflag( nChan, true ) ;
    19781977  Vector<Float> newtsys ;
     
    19881987  int oldsize = abcissa.size() ;
    19891988  double olddnu = abcissa[1] - abcissa[0] ;
    1990   //int refChan = 0 ;
    1991   //double frac = 0.0 ;
    1992   //double wedge = 0.0 ;
    1993   //double pile = 0.0 ;
    19941989  int ichan = 0 ;
    19951990  double wsum = 0.0 ;
     
    19971992  Vector<double> yi( oldsize + 1 ) ;
    19981993  zi[0] = abcissa[0] - 0.5 * olddnu ;
    1999   //zi[1] = zi[1] + dnu ;
    20001994  for ( int ii = 1 ; ii < nChan ; ii++ )
    20011995    zi[ii] = zi[0] + dnu * ii ;
    20021996  zi[nChan] = zi[nChan-1] + dnu ;
    20031997  yi[0] = abcissa[0] - 0.5 * olddnu ;
    2004   //yi[1] = abcissa[1] + 0.5 * olddnu ;
    20051998  for ( int ii = 1 ; ii < oldsize ; ii++ )
    2006     //yi[ii] = abcissa[ii-1] + olddnu ;
    20071999    yi[ii] = 0.5* (abcissa[ii-1] + abcissa[ii]) ;
    20082000  yi[oldsize] = abcissa[oldsize-1] \
     
    20252017              wsum += ( yr - zl ) ;
    20262018            }
    2027             //newflag[ii] = newflag[ii] || oldflag[j] ;
    20282019            newflag[ii] = newflag[ii] && oldflag[j] ;
    20292020          }
     
    20342025              wsum += dnu ;
    20352026            }
    2036             //newflag[ii] = newflag[ii] || oldflag[j] ;
    20372027            newflag[ii] = newflag[ii] && oldflag[j] ;
    20382028            ichan = j ;
     
    20472037              wsum += ( yr - yl ) ;
    20482038            }
    2049             //newflag[ii] = newflag[ii] || oldflag[j] ;
    20502039            newflag[ii] = newflag[ii] && oldflag[j] ;
    20512040          }
     
    20562045              wsum += ( zr - yl ) ;
    20572046            }
    2058             //newflag[ii] = newflag[ii] || oldflag[j] ;
    20592047            newflag[ii] = newflag[ii] && oldflag[j] ;
    20602048            ichan = j ;
     
    20912079              wsum += abs( yr - zl ) ;
    20922080            }
    2093             //newflag[ii] = newflag[ii] || oldflag[j] ;
    20942081            newflag[ii] = newflag[ii] && oldflag[j] ;
    20952082          }
     
    21002087              wsum += abs( dnu ) ;
    21012088            }
    2102             //newflag[ii] = newflag[ii] || oldflag[j] ;
    21032089            newflag[ii] = newflag[ii] && oldflag[j] ;
    21042090            ichan = j ;
     
    21132099              wsum += abs( yr - yl ) ;
    21142100            }
    2115             //newflag[ii] = newflag[ii] || oldflag[j] ;
    21162101            newflag[ii] = newflag[ii] && oldflag[j] ;
    21172102          }
     
    21222107              wsum += abs( zr - yl ) ;
    21232108            }
    2124             //newflag[ii] = newflag[ii] || oldflag[j] ;
    21252109            newflag[ii] = newflag[ii] && oldflag[j] ;
    21262110            ichan = j ;
     
    21402124    }
    21412125  }
    2142 //    * ichan = 0
    2143 //    ***/
    21442126//   //ofs << "olddnu = " << olddnu << ", dnu = " << dnu << endl ;
    21452127//   pile += dnu ;
Note: See TracChangeset for help on using the changeset viewer.