Ignore:
Timestamp:
05/29/12 11:24:15 (12 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: List test programs

Put in Release Notes: Yes/No?

Module(s): Module Names change impacts.

Description: Describe your changes here...

Clean up code.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/hpc33/src/STMath.cpp

    r2546 r2550  
    184184    tout.addRow();
    185185//     t4 = mathutil::gettimeofday_sec() ;
    186     //TableCopy::copyRows(tout, subt, outrowCount, 0, 1);
    187     //TableCopy::copyRows(tout, baset, outrowCount, rows[0], 1);
    188186    // skip to copy SPECTRA, FLAGTRA, and TSYS since those heavy columns are
    189187    // overwritten in the following process
     
    235233//     outrowCount += rowNum ;
    236234
    237 // merge loop
     235    // merge loop
    238236    uInt i = outrowCount ;
    239 //  for (uInt i=0; i < tout.nrow(); ++i) {
    240 
    241     // in[0] is already selected by TableItertor
     237    // in[0] is already selected by iterator
    242238    specCol.attach(baset,"SPECTRA");
    243239    flagCol.attach(baset,"FLAGTRA");
     
    248244    Vector<uChar> flag;
    249245    Double inter,time;
    250 //     for (uInt k = 0; k < subt.nrow(); ++k ) {
     246
    251247    for (uInt l = 0; l < rows.nelements(); ++l ) {
    252248      uInt k = rows[l] ;
     
    273269    // in[0] is already selected by TableIterator so that index is
    274270    // started from 1
    275     //for ( int j=0; j < int(in.size()); ++j ) {
    276271    for ( int j=1; j < int(in.size()); ++j ) {
    277272      const Table& tin = in[j]->table();
     
    362357    const Vector<Bool>& msk = acc.getMask();
    363358    if ( allEQ(msk, False) ) {
    364       //uint n = rowstodelete.nelements();
    365       //rowstodelete.resize(n+1, True);
    366       //rowstodelete[n] = i;
    367359      rowstodelB[nrowdel] = i ;
    368360      nrowdel++ ;
     
    408400  }
    409401
    410   //if (rowstodelete.nelements() > 0) {
    411402  if ( nrowdel > 0 ) {
    412403    Vector<uInt> rowstodelete( IPosition(1,nrowdel), rowstodelB.storage(), SHARE ) ;
     
    53155306}
    53165307
    5317 void STMath::calibrateALMA( CountedPtr<Scantable>& on,
    5318                             CountedPtr<Scantable>& off )
    5319 {
    5320   if ( on->nrow() == 0 )
    5321     return ;
    5322   //   string reftime = on->getTime( index ) ;
    5323   ROScalarColumn<Double> timeCol( off->table(), "TIME" ) ;
    5324   Vector<Double> timeVec = timeCol.getColumn() ;
    5325   //ROTableColumn timeCol( on->table(), "TIME" ) ;
    5326   timeCol.attach( on->table(), "TIME" ) ;
    5327   ArrayColumn<Float> tsysCol( on->table(), "TSYS" ) ;
    5328   vector<float> sp( on->nchan( on->getIF(0) ) ) ;
    5329   unsigned int spsize = sp.size() ;
    5330   for ( int index = 0 ; index < on->nrow() ; index++ ) {
    5331     double reftime = timeCol.asdouble(index) ;
    5332     Vector<Float> spoff = getSpectrumFromTime( reftime, timeVec, off, "linear" ) ;
    5333     vector<float> spec = on->getSpectrum( index ) ;
    5334     Vector<Float> tsys = tsysCol( index ) ;
    5335     // ALMA Calibration
    5336     //
    5337     // Ta* = Tsys * ( ON - OFF ) / OFF
    5338     //
    5339     // 2010/01/07 Takeshi Nakazato
    5340     unsigned int tsyssize = tsys.nelements() ;
    5341     for ( unsigned int j = 0 ; j < sp.size() ; j++ ) {
    5342       float tscale = 0.0 ;
    5343       if ( tsyssize == spsize )
    5344         tscale = tsys[j] ;
    5345       else
    5346         tscale = tsys[0] ;
    5347       float v = tscale * ( spec[j] - spoff[j] ) / spoff[j] ;
    5348       sp[j] = v ;
    5349     }
    5350     on->setSpectrum( sp, index ) ;
    5351   }
    5352 }
    5353 
    5354 void STMath::calibrateALMA( CountedPtr<Scantable>& on,
    5355                             CountedPtr<Scantable>& off,
    5356                             Vector<uInt>& rows )
    5357 {
    5358   // if rows is empty, just return
    5359   if ( rows.nelements() == 0 )
    5360     return ;
    5361 //   string reftime = on->getTime( index ) ;
    5362   ROScalarColumn<Double> timeCol( off->table(), "TIME" ) ;
    5363   Vector<Double> timeVec = timeCol.getColumn() ;
    5364   timeCol.attach( on->table(), "TIME" ) ;
    5365   ArrayColumn<Float> tsysCol( on->table(), "TSYS" ) ;
    5366   vector<float> sp( on->nchan( on->getIF(rows[0]) ) ) ;
    5367   unsigned int spsize = sp.size() ;
    5368   // I know that the data is contiguous
    5369   const uInt *p = rows.data() ;
    5370   for ( int irow = 0 ; irow < rows.nelements() ; irow++ ) {
    5371     double reftime = timeCol.asdouble(*p) ;
    5372     Vector<Float> spoff = getSpectrumFromTime( reftime, timeVec, off, "linear" ) ;
    5373     vector<float> spec = on->getSpectrum( *p ) ;
    5374     Vector<Float> tsys = tsysCol( *p ) ;
    5375     // ALMA Calibration
    5376     //
    5377     // Ta* = Tsys * ( ON - OFF ) / OFF
    5378     //
    5379     // 2010/01/07 Takeshi Nakazato
    5380     unsigned int tsyssize = tsys.nelements() ;
    5381     for ( unsigned int j = 0 ; j < sp.size() ; j++ ) {
    5382       float tscale = 0.0 ;
    5383       if ( tsyssize == spsize )
    5384         tscale = tsys[j] ;
    5385       else
    5386         tscale = tsys[0] ;
    5387       float v = tscale * ( spec[j] - spoff[j] ) / spoff[j] ;
    5388       sp[j] = v ;
    5389     }
    5390     on->setSpectrum( sp, *p ) ;
    5391     p++ ;
    5392   }
    5393 }
    5394 
    53955308void STMath::calibrateALMA( CountedPtr<Scantable>& out,
    53965309                            const CountedPtr<Scantable>& on,
     
    54095322  ROArrayColumn<Float> tsysCol( on->table(), "TSYS" ) ;
    54105323  unsigned int spsize = on->nchan( on->getIF(rows[0]) ) ;
    5411   //Vector<Float> spoff( spsize ) ;
    5412   //Vector<Float> spec( spsize ) ;
    54135324  // I know that the data is contiguous
    54145325  const uInt *p = rows.data() ;
     
    54175328    Vector<Float> spoff = getSpectrumFromTime( reftime, timeVec, off, "linear" ) ;
    54185329    Vector<Float> spec = on->specCol_( *p ) ;
    5419     //getSpectrumFromTime2( spoff, reftime, timeVec, off, "linear" ) ;
    5420     //on->specCol_.get( *p, spec ) ;
    54215330    Vector<Float> tsys = tsysCol( *p ) ;
    54225331    // ALMA Calibration
Note: See TracChangeset for help on using the changeset viewer.