Changeset 2925


Ignore:
Timestamp:
04/09/14 12:51:32 (11 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: Yes/No

What Interface Changed: Please list interface changes

Test Programs: test_tsdcal2

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Improve performance by reconsidering array element order.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STApplyCal.cpp

    r2916 r2925  
    227227  cols[2] = "IFNO" ;
    228228  CountedPtr<STIdxIter2> iter = new STIdxIter2(work_, cols) ;
     229  double start = mathutil::gettimeofday_sec();
     230  os_ << LogIO::DEBUGGING << "start iterative doapply: " << start << LogIO::POST;
    229231  while (!iter->pastEnd()) {
    230232    Record ids = iter->currentValue();
     
    234236    iter->next();
    235237  }
     238  double end = mathutil::gettimeofday_sec();
     239  os_ << LogIO::DEBUGGING << "end iterative doapply: " << end << LogIO::POST;
     240  os_ << LogIO::DEBUGGING << "elapsed time for doapply: " << end - start << " sec" << LogIO::POST;
    236241
    237242  target_->unsetSelection();
     
    299304  uInt nchanSp = skytable_[skylist[0]]->nchan(ifno);
    300305  Vector<Double> timeSky(nrowSky);
    301   Matrix<Float> spoff(nchanSp, nrowSky);
     306  Matrix<Float> spoff(nrowSky, nchanSp);
    302307  Vector<Float> iOff(nchanSp);
    303308  nrowSky = 0;
     
    308313    for (uInt j = 0; j < t.nelements(); j++) {
    309314      timeSky[nrowSky] = t[j];
    310       spoff.column(nrowSky) = sp.column(j);
     315      spoff.row(nrowSky) = sp.column(j);
    311316      nrowSky++;
    312317    }
     
    334339    //os_ << "doTsys" << LogIO::POST;
    335340    timeTsys.resize(nrowTsys);
    336     tsys.resize(nchanTsys, nrowTsys);
     341    tsys.resize(nrowTsys, nchanTsys);
    337342    nrowTsys = 0;
    338343    for (uInt i = 0 ; i < tsystable_.size(); i++) {
     
    342347      for (uInt j = 0; j < t.nelements(); j++) {
    343348        timeTsys[nrowTsys] = t[j];
    344         tsys.column(nrowTsys) = ts.column(j);
     349        tsys.row(nrowTsys) = ts.column(j);
    345350        nrowTsys++;
    346351      }
     
    364369  ScalarColumn<Double> timeCol(tab, "TIME");
    365370  Vector<Float> on;
     371
     372  // Array for scaling factor (aka Tsys)
     373  Vector<Float> iTsys(IPosition(1,nchanSp), new Float[nchanSp], TAKE_OVER);
     374 
    366375  for (uInt i = 0; i < rows.nelements(); i++) {
    367376    //os_ << "start i = " << i << " (row = " << rows[i] << ")" << LogIO::POST;
     
    376385    Double t0 = timeCol(irow);
    377386    for (uInt ichan = 0; ichan < nchanSp; ichan++) {
    378       Vector<Float> spOffSlice = spoff.row(ichan);
    379       //os_ << "spOffSlice = " << spOffSlice << LogIO::POST;
    380387      for (uInt j = 0; j < skyIdx.nelements(); j++) {
    381         tmpOff[j] = spOffSlice[skyIdx[j]];
     388        tmpOff[j] = spoff(skyIdx[j], ichan);
    382389      }
    383390      interpolatorS_->setY(ya, skyIdx.nelements());
     
    387394    calibrator_->setReference(iOff);
    388395   
    389     Float *Y = new Float[nchanSp];
    390     Vector<Float> iTsys(IPosition(1,nchanSp), Y, TAKE_OVER);
    391396    if (doTsys) {
    392397      // Tsys correction
     
    395400      Float *yb = tmpTsys.data();
    396401      for (uInt ichan = 0; ichan < nchanTsys; ichan++) {
    397         Vector<Float> tsysSlice = tsys.row(ichan);
    398402        for (uInt j = 0; j < tsysIdx.nelements(); j++) {
    399           tmpTsys[j] = tsysSlice[tsysIdx[j]];
     403          tmpTsys[j] = tsys(tsysIdx[j], ichan);
    400404        }
    401405        interpolatorT_->setY(yb, tsysIdx.nelements());
Note: See TracChangeset for help on using the changeset viewer.