Changeset 2544 for branches/hpc33/src


Ignore:
Timestamp:
05/22/12 13:07:47 (13 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...

Updated STMath::almacal to use STMath::copyRows instead of TableCopy::copyRows


Location:
branches/hpc33/src
Files:
2 edited

Legend:

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

    r2543 r2544  
    39403940  }
    39413941  else {
    3942     //    double t0, t1 ;
     3942//     double t0, t1 ;
    39433943    //    t0 = mathutil::gettimeofday_sec() ;
    39443944    vector<bool> masks = s->getMask( 0 ) ;
     
    40104010   
    40114011    // on scan
    4012     //    t0 = mathutil::gettimeofday_sec() ;
     4012//     t0 = mathutil::gettimeofday_sec() ;
    40134013    bool insitu = insitu_ ;
    40144014    insitu_ = false ;
     
    40184018    sel.setTypes( types ) ;
    40194019    s->setSelection( sel ) ;
    4020     TableCopy::copyRows( out->table(), s->table() ) ;
    4021     s->unsetSelection() ;
     4020    //TableCopy::copyRows( out->table(), s->table() ) ;
     4021    out->table().addRow( s->nrow() ) ;
     4022    copyRows( out->table(), s->table(), 0, 0, s->nrow(), False ) ;
     4023    //s->unsetSelection() ;
    40224024    sel.reset() ;
    4023     //    t1 = mathutil::gettimeofday_sec() ;
    4024     //    cout << "elapsed time for preparing output table: " << t1-t0 << " sec" << endl ;
     4025//     t1 = mathutil::gettimeofday_sec() ;
     4026//     cout << "elapsed time for preparing output table: " << t1-t0 << " sec" << endl ;
    40254027
    40264028    // process each on scan
     
    40444046         << "POLNO==" << ids[1] << "&&"
    40454047         << "IFNO==" << ids[2] ;
     4048      //cout << "TaQL string: " << ss.str() << endl ;
    40464049      sel.setTaQL( ss.str() ) ;
    40474050      aoff->setSelection( sel ) ;
    40484051      Vector<uInt> rows = iter->getRows( SHARE ) ;
    4049       calibrateALMA( out, aoff, rows ) ;
     4052      // out should be an exact copy of s except that SPECTRA column is empty
     4053      calibrateALMA( out, s, aoff, rows ) ;
    40504054      aoff->unsetSelection() ;
    40514055      sel.reset() ;
     
    40534057    }
    40544058    delete iter ;
     4059    s->unsetSelection() ;
    40554060
    40564061    //    t1 = mathutil::gettimeofday_sec() ;
     
    45924597vector<float> STMath::getSpectrumFromTime( double reftime,
    45934598                                           Vector<Double> &timeVec,
    4594                                            CountedPtr<Scantable>& s,
     4599                                           const CountedPtr<Scantable>& s,
    45954600                                           string mode )
    45964601{
     
    52735278}
    52745279
     5280void STMath::calibrateALMA( CountedPtr<Scantable>& out,
     5281                            const CountedPtr<Scantable>& on,
     5282                            const CountedPtr<Scantable>& off,
     5283                            Vector<uInt>& rows )
     5284{
     5285  // 2012/05/22 TN
     5286  // Assume that out has empty SPECTRA column
     5287
     5288  // if rows is empty, just return
     5289  if ( rows.nelements() == 0 )
     5290    return ;
     5291//   string reftime = on->getTime( index ) ;
     5292  ROScalarColumn<Double> timeCol( off->table(), "TIME" ) ;
     5293  Vector<Double> timeVec = timeCol.getColumn() ;
     5294  //ROTableColumn timeCol( on->table(), "TIME" ) ;
     5295  timeCol.attach( on->table(), "TIME" ) ;
     5296  ROArrayColumn<Float> tsysCol( on->table(), "TSYS" ) ;
     5297  //vector<float> sp( on->nchan( on->getIF(rows[0]) ) ) ;
     5298  Vector<Float> sp( on->nchan( on->getIF(rows[0]) ) ) ;
     5299  unsigned int spsize = sp.size() ;
     5300  // I know that the data is contiguous
     5301  const uInt *p = rows.data() ;
     5302  for ( int irow = 0 ; irow < rows.nelements() ; irow++ ) {
     5303    //int index = rows[irow] ;
     5304    //double reftime = timeCol.asdouble(index) ;
     5305    double reftime = timeCol.asdouble(*p) ;
     5306    vector<float> spoff = getSpectrumFromTime( reftime, timeVec, off, "linear" ) ;
     5307    //vector<float> spec = on->getSpectrum( index ) ;
     5308    //Vector<Float> tsys = tsysCol( index ) ;
     5309    vector<float> spec = on->getSpectrum( *p ) ;
     5310    Vector<Float> tsys = tsysCol( *p ) ;
     5311    // ALMA Calibration
     5312    //
     5313    // Ta* = Tsys * ( ON - OFF ) / OFF
     5314    //
     5315    // 2010/01/07 Takeshi Nakazato
     5316    unsigned int tsyssize = tsys.nelements() ;
     5317    for ( unsigned int j = 0 ; j < sp.size() ; j++ ) {
     5318      float tscale = 0.0 ;
     5319      if ( tsyssize == spsize )
     5320        tscale = tsys[j] ;
     5321      else
     5322        tscale = tsys[0] ;
     5323      float v = tscale * ( spec[j] - spoff[j] ) / spoff[j] ;
     5324      sp[j] = v ;
     5325    }
     5326    //on->setSpectrum( sp, index ) ;
     5327    //on->setSpectrum( sp, *p ) ;
     5328    // no check for nchan
     5329    //Vector<Float> spv( sp ) ;
     5330    out->specCol_.put( *p, sp ) ;
     5331    p++ ;
     5332  }
     5333}
     5334
    52755335vector<float> STMath::getFSCalibratedSpectra( CountedPtr<Scantable>& sig,
    52765336                                              CountedPtr<Scantable>& ref,
  • branches/hpc33/src/STMath.h

    r2543 r2544  
    403403
    404404  vector<float> getSpectrumFromTime( string reftime, casa::CountedPtr<Scantable>& s, string mode = "before" ) ;
    405   vector<float> getSpectrumFromTime( double reftime, casa::Vector<casa::Double> &v, casa::CountedPtr<Scantable>& s, string mode = "before" ) ;
     405  vector<float> getSpectrumFromTime( double reftime, casa::Vector<casa::Double> &v, const casa::CountedPtr<Scantable>& s, string mode = "before" ) ;
    406406  vector<float> getTcalFromTime( string reftime, casa::CountedPtr<Scantable>& s, string mode="before" ) ;
    407407  vector<float> getTsysFromTime( string reftime, casa::CountedPtr<Scantable>& s, string mode="before" ) ;
     
    425425  void calibrateALMA( casa::CountedPtr<Scantable>& on,
    426426                      casa::CountedPtr<Scantable>& off,
     427                      casa::Vector<casa::uInt>& rows ) ;
     428  void calibrateALMA( casa::CountedPtr<Scantable>& out,
     429                      const casa::CountedPtr<Scantable>& on,
     430                      const casa::CountedPtr<Scantable>& off,
    427431                      casa::Vector<casa::uInt>& rows ) ;
    428432  vector<float> getFSCalibratedSpectra( casa::CountedPtr<Scantable>& sig,
Note: See TracChangeset for help on using the changeset viewer.