Changeset 2960 for trunk


Ignore:
Timestamp:
06/27/14 19:39:09 (10 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-6585, CAS-6571

Ready for Test: Yes

Interface Changes: Yes/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...

Channel flag in sky caltable is properly handled in applycal stage.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STApplyCal.cpp

    r2928 r2960  
    304304  Vector<Double> timeSkySorted;
    305305  Matrix<Float> spoffSorted;
     306  Matrix<uChar> flagoffSorted;
    306307  {
    307308    Vector<Double> timeSky(nrowSky);
    308309    Matrix<Float> spoff(nrowSky, nchanSp);
     310    Matrix<uChar> flagoff(nrowSky, nchanSp);
    309311    nrowSky = 0;
    310312    for (uInt i = 0 ; i < skylist.nelements(); i++) {
     
    312314      Vector<Double> t = p->getTime();
    313315      Matrix<Float> sp = p->getSpectra();
     316      Matrix<uChar> fl = p->getFlagtra();
    314317      for (uInt j = 0; j < t.nelements(); j++) {
    315318        timeSky[nrowSky] = t[j];
    316319        spoff.row(nrowSky) = sp.column(j);
     320        flagoff.row(nrowSky) = fl.column(j);
    317321        nrowSky++;
    318322      }
     
    333337                            new Float[nrowSky * nchanSp],
    334338                            TAKE_OVER);
     339    flagoffSorted.takeStorage(IPosition(2, nrowSkySorted, nchanSp),
     340                              new uChar[nrowSkySorted * nchanSp],
     341                              TAKE_OVER);
    335342    for (uInt i = 0 ; i < nrowSky; i++) {
    336343      spoffSorted.row(i) = spoff.row(skyIdx[i]);
     344      flagoffSorted.row(i) = flagoff.row(skyIdx[i]);
    337345    }
    338346  }
     
    340348  uInt nrowTsysSorted = nrowTsys;
    341349  Matrix<Float> tsysSorted;
     350  Matrix<uChar> flagtsysSorted;
    342351  Vector<Double> timeTsysSorted;
    343352  if (doTsys) {
     
    345354    Vector<Double> timeTsys(nrowTsys);
    346355    Matrix<Float> tsys(nrowTsys, nchanTsys);
     356    Matrix<uChar> flagtsys(nrowTsys, nchanTsys);
    347357    tsysSorted.takeStorage(IPosition(2, nrowTsys, nchanTsys),
    348358                           new Float[nrowTsys * nchanTsys],
     
    353363      Vector<Double> t = p->getTime();
    354364      Matrix<Float> ts = p->getTsys();
     365      Matrix<uChar> fl = p->getFlagtra();
    355366      for (uInt j = 0; j < t.nelements(); j++) {
    356367        timeTsys[nrowTsys] = t[j];
    357368        tsys.row(nrowTsys) = ts.column(j);
     369        flagtsys.row(nrowTsys) = fl.column(j);
    358370        nrowTsys++;
    359371      }
     
    365377                               new Double[nrowTsysSorted],
    366378                               TAKE_OVER);
     379    flagtsysSorted.takeStorage(IPosition(2, nrowTsysSorted, nchanTsys),
     380                               new uChar[nrowTsysSorted * nchanTsys],
     381                               TAKE_OVER);
    367382    for (uInt i = 0 ; i < nrowTsysSorted; i++) {
    368383      timeTsysSorted[i] = timeTsys[tsysIdx[i]];
     
    372387    for (uInt i = 0; i < nrowTsys; ++i) {
    373388      tsysSorted.row(i) = tsys.row(tsysIdx[i]);
     389      flagtsysSorted.row(i) = flagtsys.row(tsysIdx[i]);
    374390    }
    375391  }
     
    377393  Table tab = work_->table();
    378394  ArrayColumn<Float> spCol(tab, "SPECTRA");
     395  ArrayColumn<uChar> flCol(tab, "FLAGTRA");
    379396  ArrayColumn<Float> tsysCol(tab, "TSYS");
    380397  ScalarColumn<Double> timeCol(tab, "TIME");
    381   Vector<Float> on;
     398  //Vector<Float> on;
    382399
    383400  // Array for scaling factor (aka Tsys)
     
    396413
    397414    // target spectral data
    398     on = spCol(irow);
     415    Vector<Float> on = spCol(irow);
     416    Vector<uChar> flag = flCol(irow);
    399417    //os_ << "on=" << on[0] << LogIO::POST;
    400418    calibrator_->setSource(on);
     
    403421    Double t0 = timeCol(irow);
    404422    for (uInt ichan = 0; ichan < nchanSp; ichan++) {
    405       Float *tmpY = &(spoffSorted.data()[ichan * nrowSkySorted]);
     423      Float *tmpY = &(spoffSorted.data()[ichan * nrowSkySorted]);
     424      if (allNE(flagoffSorted.column(ichan), (uChar)0)) {
     425        flag[ichan] = 1 << 7; // user flag
     426      }
    406427      interpolatorS_->setY(tmpY, nrowSkySorted);
    407428      iOff[ichan] = interpolatorS_->interpolate(t0);
     
    450471    //os_ << "calibrated=" << calibrator_->getCalibrated()[0] << LogIO::POST;
    451472    spCol.put(irow, calibrator_->getCalibrated());
     473    flCol.put(irow, flag);
    452474    if (filltsys)
    453475      tsysCol.put(irow, iTsys);
Note: See TracChangeset for help on using the changeset viewer.