Changeset 2502 for branches


Ignore:
Timestamp:
05/11/12 18:38:39 (12 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: No

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...

Re-write almacal to improve performance.
Changed data selection.


Location:
branches/hpc33/src
Files:
2 edited

Legend:

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

    r2473 r2502  
    39233923   
    39243924    // process each on scan
    3925     ArrayColumn<Float> tsysCol ;
    3926     tsysCol.attach( out->table(), "TSYS" ) ;
    3927     for ( int i = 0 ; i < out->nrow() ; i++ ) {
    3928       vector<float> sp = getCalibratedSpectra( out, aoff, i ) ;
    3929       out->setSpectrum( sp, i ) ;
     3925//     for ( int i = 0 ; i < out->nrow() ; i++ ) {
     3926//       vector<float> sp = getCalibratedSpectra( out, aoff, i ) ;
     3927//       out->setSpectrum( sp, i ) ;
     3928//     }
     3929
     3930    // selection first, then process
     3931    vector<unsigned int> ifs = out->getIFNos() ;
     3932    vector<unsigned int> beams = out->getBeamNos() ;
     3933    vector<unsigned int> pols = out->getPolNos() ;
     3934    vector<int> v( 1 ) ;
     3935    for ( vector<unsigned int>::iterator i = ifs.begin() ; \
     3936          i != ifs.end() ; i++ ) {
     3937      v[0] = *i ;
     3938      sel.setIFs( v ) ;
     3939      for ( vector<unsigned int>::iterator j = pols.begin() ; \
     3940            j != pols.end() ; j++ ) {
     3941        v[0] = *j ;
     3942        sel.setPolarizations( v ) ;
     3943        for ( vector<unsigned int>::iterator k = beams.begin() ; \
     3944              k != beams.end() ; k++ ) {
     3945          v[0] = *k ;
     3946          sel.setBeams( v ) ;
     3947          out->setSelection( sel ) ;
     3948          aoff->setSelection( sel ) ;
     3949
     3950          // calibrate data
     3951          calibrateALMA( out, aoff ) ;
     3952
     3953          out->unsetSelection() ;
     3954          aoff->unsetSelection() ;
     3955          sel.reset() ;
     3956        }
     3957      }
    39303958    }
    39313959
     
    45754603        vector<float> sp0 = s->getSpectrum( idx[0] ) ;
    45764604        vector<float> sp1 = s->getSpectrum( idx[1] ) ;
     4605        sp.resize( sp0.size() ) ;
    45774606        for ( unsigned int i = 0 ; i < sp0.size() ; i++ ) {
    4578           float v = ( sp1[i] - sp0[i] ) / ( t1 - t0 ) * ( tref - t0 ) + sp0[i] ;
    4579           sp.push_back( v ) ;
     4607          sp[i] = ( sp1[i] - sp0[i] ) / ( t1 - t0 ) * ( tref - t0 ) + sp0[i] ;
    45804608        }
    45814609      }
     
    49755003  vector<int> ib( 1, on->getBeam( index ) ) ;
    49765004  vector<int> ip( 1, on->getPol( index ) ) ;
    4977   vector<int> ic( 1, on->getScan( index ) ) ;
    49785005  STSelector sel = STSelector() ;
    49795006  sel.setIFs( ii ) ;
     
    50255052  vector<int> ib( 1, on->getBeam( index ) ) ;
    50265053  vector<int> ip( 1, on->getPol( index ) ) ;
    5027   vector<int> ic( 1, on->getScan( index ) ) ;
    50285054  STSelector sel = STSelector() ;
    50295055  sel.setIFs( ii ) ;
     
    50585084
    50595085  return sp ;
     5086}
     5087
     5088void STMath::calibrateALMA( CountedPtr<Scantable>& on,
     5089                                        CountedPtr<Scantable>& off )
     5090{
     5091//   string reftime = on->getTime( index ) ;
     5092  ROTableColumn timeCol( on->table(), "TIME" ) ;
     5093  ArrayColumn<Float> tsysCol( on->table(), "TSYS" ) ;
     5094  vector<float> sp( on->nchan( on->getIF(0) ) ) ;
     5095  unsigned int spsize = sp.size() ;
     5096  for ( int index = 0 ; index < on->nrow() ; index++ ) {
     5097    double reftime = timeCol.asdouble(index) ;
     5098    vector<float> spoff = getSpectrumFromTime( reftime, off, "linear" ) ;
     5099    vector<float> spec = on->getSpectrum( index ) ;
     5100    Vector<Float> tsys = tsysCol( index ) ;
     5101    // ALMA Calibration
     5102    //
     5103    // Ta* = Tsys * ( ON - OFF ) / OFF
     5104    //
     5105    // 2010/01/07 Takeshi Nakazato
     5106    unsigned int tsyssize = tsys.nelements() ;
     5107    for ( unsigned int j = 0 ; j < sp.size() ; j++ ) {
     5108      float tscale = 0.0 ;
     5109      if ( tsyssize == spsize )
     5110        tscale = tsys[j] ;
     5111      else
     5112        tscale = tsys[0] ;
     5113      float v = tscale * ( spec[j] - spoff[j] ) / spoff[j] ;
     5114      sp[j] = v ;
     5115    }
     5116    on->setSpectrum( sp, index ) ;
     5117  }
    50605118}
    50615119
  • branches/hpc33/src/STMath.h

    r2443 r2502  
    421421                                      casa::CountedPtr<Scantable>& off,
    422422                                      int index ) ;
     423  void calibrateALMA( casa::CountedPtr<Scantable>& on,
     424                      casa::CountedPtr<Scantable>& off ) ;
    423425  vector<float> getFSCalibratedSpectra( casa::CountedPtr<Scantable>& sig,
    424426                                        casa::CountedPtr<Scantable>& ref,
Note: See TracChangeset for help on using the changeset viewer.