Changeset 2916 for trunk/src/STMath.cpp


Ignore:
Timestamp:
04/03/14 13:45:09 (10 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...

Replaced STIdxIter classes with STIdxIter2 as much as possible.
Also disabled python interface for STIdxIter since the iterator has
a problem.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STMath.cpp

    r2911 r2916  
    35383538    cols[1] = "POLNO" ;
    35393539    cols[2] = "IFNO" ;
    3540     STIdxIter *iter = new STIdxIterAcc( out, cols ) ;
    3541     while ( !iter->pastEnd() ) {
    3542       Vector<uInt> ids = iter->current() ;
     3540    STIdxIter2 iter(out, cols);
     3541    while ( !iter.pastEnd() ) {
     3542      Record ids = iter.currentValue();
    35433543      stringstream ss ;
    35443544      ss << "SELECT FROM $1 WHERE "
    3545          << "BEAMNO==" << ids[0] << "&&"
    3546          << "POLNO==" << ids[1] << "&&"
    3547          << "IFNO==" << ids[2] ;
     3545         << "BEAMNO==" << ids.asuInt("BEAMNO") << "&&"
     3546         << "POLNO==" << ids.asuInt("POLNO") << "&&"
     3547         << "IFNO==" << ids.asuInt("IFNO") ;
    35483548      //cout << "TaQL string: " << ss.str() << endl ;
    35493549      sel.setTaQL( ss.str() ) ;
     
    35513551      ahot->setSelection( sel ) ;
    35523552      asky->setSelection( sel ) ;
    3553       Vector<uInt> rows = iter->getRows( SHARE ) ;
     3553      Vector<uInt> rows = iter.getRows( SHARE ) ;
    35543554      // out should be an exact copy of s except that SPECTRA column is empty
    35553555      calibrateCW( out, s, aoff, asky, ahot, acold, rows, antname ) ;
     
    35583558      asky->unsetSelection() ;
    35593559      sel.reset() ;
    3560       iter->next() ;
    3561     }
    3562     delete iter ;
     3560      iter.next() ;
     3561    }
    35633562    s->table_ = torg ;
    35643563    s->attach() ;
     
    36163615//     t0 = mathutil::gettimeofday_sec() ;
    36173616
    3618     // using STIdxIterAcc
     3617    // using STIdxIter2
    36193618    vector<string> cols( 3 ) ;
    36203619    cols[0] = "BEAMNO" ;
     
    37443743         
    37453744    if ( apexcalmode == 0 ) {
    3746       // using STIdxIterAcc
     3745      // using STIdxIter2
    37473746      vector<string> cols( 3 ) ;
    37483747      cols[0] = "BEAMNO" ;
    37493748      cols[1] = "POLNO" ;
    37503749      cols[2] = "IFNO" ;
    3751       STIdxIter *iter = new STIdxIterAcc( ssig, cols ) ;
     3750      STIdxIter2 iter(ssig, cols) ;
    37523751      STSelector sel ;
    37533752      vector< CountedPtr<Scantable> > on( 2 ) ;
     
    37613760      hot[1] = ahothi ;
    37623761      vector< CountedPtr<Scantable> > cold( 2 ) ;
    3763       while ( !iter->pastEnd() ) {
    3764         Vector<uInt> ids = iter->current() ;
     3762      while ( !iter.pastEnd() ) {
     3763        Record ids = iter.currentValue() ;
    37653764        stringstream ss ;
    37663765        ss << "SELECT FROM $1 WHERE "
    3767            << "BEAMNO==" << ids[0] << "&&"
    3768            << "POLNO==" << ids[1] << "&&"
    3769            << "IFNO==" << ids[2] ;
     3766           << "BEAMNO==" << ids.asuInt("BEAMNO") << "&&"
     3767           << "POLNO==" << ids.asuInt("POLNO") << "&&"
     3768           << "IFNO==" << ids.asuInt("IFNO") ;
    37703769        //cout << "TaQL string: " << ss.str() << endl ;
    37713770        sel.setTaQL( ss.str() ) ;
     
    37743773        hot[0]->setSelection( sel ) ;
    37753774        hot[1]->setSelection( sel ) ;
    3776         Vector<uInt> rows = iter->getRows( SHARE ) ;
     3775        Vector<uInt> rows = iter.getRows( SHARE ) ;
    37773776        calibrateAPEXFS( ssig, sref, on, sky, hot, cold, rows ) ;
    37783777        sky[0]->unsetSelection() ;
     
    37813780        hot[1]->unsetSelection() ;
    37823781        sel.reset() ;
    3783         iter->next() ;
    3784       }
    3785       delete iter ;
     3782        iter.next() ;
     3783      }
    37863784
    37873785    }
     
    38063804      cols[1] = "POLNO" ;
    38073805      cols[2] = "IFNO" ;
    3808       STIdxIter *iter = new STIdxIterAcc( ssig, cols ) ;
     3806      STIdxIter2 iter(ssig, cols);
    38093807      STSelector sel ;
    3810       while ( !iter->pastEnd() ) {
    3811         Vector<uInt> ids = iter->current() ;
     3808      while ( !iter.pastEnd() ) {
     3809        Record ids = iter.currentValue() ;
    38123810        stringstream ss ;
    38133811        ss << "SELECT FROM $1 WHERE "
    3814            << "BEAMNO==" << ids[0] << "&&"
    3815            << "POLNO==" << ids[1] << "&&"
    3816            << "IFNO==" << ids[2] ;
     3812           << "BEAMNO==" << ids.asuInt("BEAMNO") << "&&"
     3813           << "POLNO==" << ids.asuInt("POLNO") << "&&"
     3814           << "IFNO==" << ids.asuInt("IFNO") ;
    38173815        //cout << "TaQL string: " << ss.str() << endl ;
    38183816        sel.setTaQL( ss.str() ) ;
     
    38203818        ahotlo->setSelection( sel ) ;
    38213819        askylo->setSelection( sel ) ;
    3822         Vector<uInt> rows = iter->getRows( SHARE ) ;
     3820        Vector<uInt> rows = iter.getRows( SHARE ) ;
    38233821        calibrateCW( ssig, rsig, aofflo, askylo, ahotlo, acoldlo, rows, antname ) ;
    38243822        aofflo->unsetSelection() ;
     
    38263824        askylo->unsetSelection() ;
    38273825        sel.reset() ;
    3828         iter->next() ;
    3829       }
    3830       delete iter ;
    3831       iter = new STIdxIterAcc( sref, cols ) ;
    3832       while ( !iter->pastEnd() ) {
    3833         Vector<uInt> ids = iter->current() ;
     3826        iter.next() ;
     3827      }
     3828      iter = STIdxIter2(sref, cols);
     3829      while ( !iter.pastEnd() ) {
     3830        Record ids = iter.currentValue() ;
    38343831        stringstream ss ;
    38353832        ss << "SELECT FROM $1 WHERE "
    3836            << "BEAMNO==" << ids[0] << "&&"
    3837            << "POLNO==" << ids[1] << "&&"
    3838            << "IFNO==" << ids[2] ;
     3833           << "BEAMNO==" << ids.asuInt("BEAMNO") << "&&"
     3834           << "POLNO==" << ids.asuInt("POLNO") << "&&"
     3835           << "IFNO==" << ids.asuInt("IFNO") ;
    38393836        //cout << "TaQL string: " << ss.str() << endl ;
    38403837        sel.setTaQL( ss.str() ) ;
     
    38423839        ahothi->setSelection( sel ) ;
    38433840        askyhi->setSelection( sel ) ;
    3844         Vector<uInt> rows = iter->getRows( SHARE ) ;
     3841        Vector<uInt> rows = iter.getRows( SHARE ) ;
    38453842        calibrateCW( sref, rref, aoffhi, askyhi, ahothi, acoldhi, rows, antname ) ;
    38463843        aoffhi->unsetSelection() ;
     
    38483845        askyhi->unsetSelection() ;
    38493846        sel.reset() ;
    3850         iter->next() ;
    3851       }
    3852       delete iter ;
     3847        iter.next() ;
     3848      }
    38533849    }
    38543850  }
     
    39023898    cols[1] = "POLNO" ;
    39033899    cols[2] = "IFNO" ;
    3904     STIdxIter *iter = new STIdxIterAcc( ssig, cols ) ;
    3905     while ( !iter->pastEnd() ) {
    3906       Vector<uInt> ids = iter->current() ;
     3900    STIdxIter2 iter(ssig, cols);
     3901    while ( !iter.pastEnd() ) {
     3902      Record ids = iter.currentValue() ;
    39073903      stringstream ss ;
    39083904      ss << "SELECT FROM $1 WHERE "
    3909          << "BEAMNO==" << ids[0] << "&&"
    3910          << "POLNO==" << ids[1] << "&&"
    3911          << "IFNO==" << ids[2] ;
     3905         << "BEAMNO==" << ids.asuInt("BEAMNO") << "&&"
     3906         << "POLNO==" << ids.asuInt("POLNO") << "&&"
     3907         << "IFNO==" << ids.asuInt("IFNO") ;
    39123908      //cout << "TaQL string: " << ss.str() << endl ;
    39133909      sel.setTaQL( ss.str() ) ;
    39143910      ahot->setSelection( sel ) ;
    39153911      asky->setSelection( sel ) ;
    3916       Vector<uInt> rows = iter->getRows( SHARE ) ;
     3912      Vector<uInt> rows = iter.getRows( SHARE ) ;
    39173913      // out should be an exact copy of s except that SPECTRA column is empty
    39183914      calibrateFS( ssig, sref, rsig, rref, asky, ahot, acold, rows ) ;
     
    39203916      asky->unsetSelection() ;
    39213917      sel.reset() ;
    3922       iter->next() ;
    3923     }
    3924     delete iter ;
     3918      iter.next() ;
     3919    }
    39253920  }
    39263921
     
    47824777  cols[1] = "POLNO" ;
    47834778  cols[2] = "BEAMNO" ;
    4784   STIdxIterAcc iter( s, cols ) ;
     4779  STIdxIter2 iter( s, cols ) ;
    47854780
    47864781  Table ttab = s->table() ;
Note: See TracChangeset for help on using the changeset viewer.