Ignore:
Timestamp:
06/25/14 15:28:36 (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...

Added FLAGTRA column to sky and Tsys caltable.
To support previous versions of caltabls that don't have FLAGTRA
column, the code automatically add FLAGTRA column and initialize
it with initial value (uChar)0 if no FLAGTRA exists.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STCalSkyTable.cpp

    r2727 r2955  
    1919#include <tables/Tables/ScaColDesc.h>
    2020#include <tables/Tables/TableRecord.h>
     21#include <tables/Tables/TableIter.h>
    2122#include <measures/TableMeasures/TableMeasDesc.h>
    2223#include <measures/TableMeasures/TableMeasRefDesc.h>
     
    4344  : STApplyTable(name)
    4445{
     46  if (!table_.tableDesc().isColumn("FLAGTRA")) {
     47    LogIO os(LogOrigin("STCalSkyTable", "STCalSkyTable", WHERE));
     48    os << "Adding FLAGTRA column to " << name << " with initial value of 0 (all data valid)." << LogIO::POST;
     49    table_.addColumn(ArrayColumnDesc<uChar>("FLAGTRA"));
     50    TableIterator iter(table_, "IFNO");
     51    while (!iter.pastEnd()) {
     52      Table t = iter.table();
     53      ArrayColumn<Float> spectraCol(t, "SPECTRA");
     54      IPosition shape(2, spectraCol.shape(0)[0], t.nrow());
     55      ArrayColumn<uChar> flagtraCol(t, "FLAGTRA");
     56      Array<uChar> flagtra(shape, (uChar)0);
     57      flagtraCol.putColumn(flagtra);
     58      iter.next();
     59    }
     60  }
     61
    4562  attachOptionalColumns();
    4663}
     
    5370{
    5471  table_.addColumn(ArrayColumnDesc<Float>("SPECTRA"));
     72  table_.addColumn(ArrayColumnDesc<uChar>("FLAGTRA"));
    5573  table_.addColumn(ScalarColumnDesc<Float>("ELEVATION"));
    5674
     
    6684{
    6785  spectraCol_.attach(table_, "SPECTRA");
     86  flagtraCol_.attach(table_, "FLAGTRA");
    6887  elCol_.attach(table_,"ELEVATION");
    69  
    7088}
    7189
    7290void STCalSkyTable::setdata(uInt irow, uInt scanno, uInt cycleno,
    7391                            uInt beamno, uInt ifno, uInt polno, uInt freqid, 
    74                             Double time, Float elevation, Vector<Float> spectra)
     92                            Double time, Float elevation,
     93                            const Vector<Float> &spectra,
     94                            const Vector<uChar> &flagtra)
    7595{
    7696  if (irow >= (uInt)nrow()) {
     
    86106  elCol_.put(irow, elevation);
    87107  spectraCol_.put(irow, spectra);
     108  flagtraCol_.put(irow, flagtra);
    88109}
    89110
    90111void STCalSkyTable::appenddata(uInt scanno, uInt cycleno,
    91112                               uInt beamno, uInt ifno, uInt polno, uInt freqid,
    92                                Double time, Float elevation, Vector<Float> spectra)
     113                               Double time, Float elevation,
     114                               const Vector<Float> &spectra,
     115                               const Vector<uChar> &flagtra)
    93116{
    94117  uInt irow = nrow();
    95118  table_.addRow(1, True);
    96   setdata(irow, scanno, cycleno, beamno, ifno, polno, freqid, time, elevation, spectra);
     119  setdata(irow, scanno, cycleno, beamno, ifno, polno, freqid, time, elevation,
     120          spectra, flagtra);
    97121}
    98122
Note: See TracChangeset for help on using the changeset viewer.