Changeset 2556 for branches


Ignore:
Timestamp:
06/11/12 12:50:34 (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...

More speed-up of almacal: skip unecessary data copy.


Location:
branches/hpc33
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/hpc33/python/asapmath.py

    r2366 r2556  
    935935    from asap._asap import stmath
    936936    stm = stmath()
    937     ssub = scantab.get_scan( scannos )
    938     scal = scantable( stm.almacal( ssub, calmode ) )
     937    selection=selector()
     938    selection.set_scans(scannos)
     939    orig = scantab.get_selection()
     940    scantab.set_selection(orig+selection)
     941##     ssub = scantab.get_scan( scannos )
     942##     scal = scantable( stm.almacal( ssub, calmode ) )
     943    scal = scantable( stm.almacal( scantab, calmode ) )
     944    scantab.set_selection(orig)
    939945    return scal
    940946
  • branches/hpc33/src/STMath.cpp

    r2553 r2556  
    39383938  else {
    39393939//     double t0, t1 ;
    3940     //    t0 = mathutil::gettimeofday_sec() ;
     3940//     t0 = mathutil::gettimeofday_sec() ;
    39413941    vector<bool> masks = s->getMask( 0 ) ;
    3942    
     3942
    39433943    // off scan
    3944     STSelector sel = STSelector() ;
    3945     vector<int> types( 1, SrcType::PSOFF ) ;
    3946     //types.push_back( SrcType::PSOFF ) ;
     3944    STSelector orig = s->getSelection() ;
     3945    STSelector sel = orig ;
     3946    vector<int> typesOrig = orig.getTypes() ;
     3947    vector<int> types = typesOrig ;
     3948    types.push_back( SrcType::PSOFF ) ;
    39473949    sel.setTypes( types ) ;
    39483950    s->setSelection( sel ) ;
     
    39513953    // Each group must have own unique SCANNO (should be renumbered).
    39523954    // See PIPELINE/SDCalibration.py
    3953     CountedPtr<Scantable> soff = getScantable( s, false ) ;
    3954     Table ttab = soff->table() ;
    3955 //     String tmpname = File::newUniqueName( "./", "temp" ).baseName() ;
    3956 //     Table ttab = s->table().copyToMemoryTable( tmpname, False ) ;
     3955    bool insitu = insitu_ ;
     3956    insitu_ = false ;
     3957    // share off scan before average with out
     3958    CountedPtr<Scantable> out = getScantable( s, false ) ;
     3959    insitu_ = insitu ;
     3960    Table ttab = out->table() ;
    39573961    ROScalarColumn<Double> *timeCol = new ROScalarColumn<Double>( ttab, "TIME" ) ;
    39583962    uInt nrow = timeCol->nrow() ;
     
    39623966      timeSep[i] -= timeSep[i-1] ;
    39633967    }
    3964     Vector<Double> interval = soff->integrCol_.getColumn() ;
     3968    Vector<Double> interval = out->integrCol_.getColumn() ;
    39653969    interval /= 86400.0 ;
    39663970    Block<uInt> gaplist( 100 ) ;
     
    39933997      scnslice = i ;
    39943998    }
    3995     soff->scanCol_.putColumn( newscanno ) ;
    3996 //     cout << "new scancol = " << soff->scanCol_.getColumn() << endl ;
    3997 //    double t2 = mathutil::gettimeofday_sec() ;
    3998     vector< CountedPtr<Scantable> > tmp( 1, soff ) ;
     3999    out->scanCol_.putColumn( newscanno ) ;
     4000//     double t2 = mathutil::gettimeofday_sec() ;
     4001    vector< CountedPtr<Scantable> > tmp( 1, out ) ;
    39994002    CountedPtr<Scantable> aoff = average( tmp, masks, "TINT", "SCAN" ) ;
    4000     //    double t3 = mathutil::gettimeofday_sec() ;
    4001     //cout << "aoff.nrow = " << aoff->nrow() << endl ;
    4002     s->unsetSelection() ;
    4003     sel.reset() ;
    4004     //    t1 = mathutil::gettimeofday_sec() ;
    4005     //    cout << "elapsed time for off averaging: " << t1-t0 << " sec" << endl ;
    4006     //    cout << "   elapsed time for average(): " << t3-t2 << " sec" << endl ;
     4003//     double t3 = mathutil::gettimeofday_sec() ;
     4004//     cout << "aoff.nrow = " << aoff->nrow() << endl ;
     4005    sel = orig ;
     4006//     t1 = mathutil::gettimeofday_sec() ;
     4007//     cout << "elapsed time for off averaging: " << t1-t0 << " sec" << endl ;
     4008//     cout << "   elapsed time for average(): " << t3-t2 << " sec" << endl ;
    40074009   
    40084010    // on scan
    40094011//     t0 = mathutil::gettimeofday_sec() ;
    4010     bool insitu = insitu_ ;
    4011     insitu_ = false ;
    4012     CountedPtr<Scantable> out = getScantable( s, true ) ;
    4013     insitu_ = insitu ;
    4014     types[0] = SrcType::PSON ;
     4012    types[types.size()-1] = SrcType::PSON ;
    40154013    sel.setTypes( types ) ;
    40164014    s->setSelection( sel ) ;
    4017     //TableCopy::copyRows( out->table(), s->table() ) ;
    4018     out->table().addRow( s->nrow() ) ;
     4015    out->table().addRow( s->nrow()-out->nrow() ) ;
    40194016    copyRows( out->table(), s->table(), 0, 0, s->nrow(), False ) ;
    4020     //s->unsetSelection() ;
    40214017    sel.reset() ;
    40224018//     t1 = mathutil::gettimeofday_sec() ;
     
    40244020
    40254021    // process each on scan
    4026     //    t0 = mathutil::gettimeofday_sec() ;
    4027 //     for ( int i = 0 ; i < out->nrow() ; i++ ) {
    4028 //       vector<float> sp = getCalibratedSpectra( out, aoff, i ) ;
    4029 //       out->setSpectrum( sp, i ) ;
    4030 //     }
     4022//     t0 = mathutil::gettimeofday_sec() ;
    40314023
    40324024    // using STIdxIterAcc
     
    40544046    }
    40554047    delete iter ;
    4056     s->unsetSelection() ;
    4057 
    4058     //    t1 = mathutil::gettimeofday_sec() ;
    4059     //    cout << "elapsed time for calibration: " << t1-t0 << " sec" << endl ;
     4048    s->setSelection( orig ) ;
     4049
     4050//     t1 = mathutil::gettimeofday_sec() ;
     4051//     cout << "elapsed time for calibration: " << t1-t0 << " sec" << endl ;
    40604052
    40614053    // flux unit
Note: See TracChangeset for help on using the changeset viewer.