[2728] | 1 | //
|
---|
| 2 | // C++ Implementation: STBaselineParamTable
|
---|
| 3 | //
|
---|
| 4 | // Description:
|
---|
| 5 | //
|
---|
| 6 | //
|
---|
| 7 | // Author: Wataru Kawasaki <wataru.kawasaki@nao.ac.jp> (C) 2013
|
---|
| 8 | //
|
---|
| 9 | // Copyright: See COPYING file that comes with this distribution
|
---|
| 10 | //
|
---|
| 11 | //
|
---|
| 12 | #include <assert.h>
|
---|
| 13 |
|
---|
| 14 | #include <casa/Exceptions/Error.h>
|
---|
| 15 | #include <tables/Tables/TableDesc.h>
|
---|
| 16 | #include <tables/Tables/SetupNewTab.h>
|
---|
| 17 | #include <tables/Tables/ArrColDesc.h>
|
---|
| 18 | #include <tables/Tables/ScaColDesc.h>
|
---|
| 19 | #include <tables/Tables/TableRecord.h>
|
---|
| 20 | #include <measures/TableMeasures/TableMeasDesc.h>
|
---|
| 21 | #include <measures/TableMeasures/TableMeasRefDesc.h>
|
---|
| 22 | #include <measures/TableMeasures/TableMeasValueDesc.h>
|
---|
| 23 |
|
---|
| 24 | #include "Scantable.h"
|
---|
| 25 | #include "STBaselineParamTable.h"
|
---|
| 26 |
|
---|
| 27 |
|
---|
| 28 | using namespace casa;
|
---|
| 29 |
|
---|
| 30 | namespace asap {
|
---|
| 31 |
|
---|
| 32 | const String STBaselineParamTable::name_ = "APPLY_BASELINE";
|
---|
| 33 |
|
---|
| 34 | STBaselineParamTable::STBaselineParamTable(const Scantable& parent)
|
---|
| 35 | : STApplyTable(parent, name_)
|
---|
| 36 | {
|
---|
| 37 | setup();
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | STBaselineParamTable::STBaselineParamTable(const String &name)
|
---|
| 41 | : STApplyTable(name)
|
---|
| 42 | {
|
---|
| 43 | attachOptionalColumns();
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | STBaselineParamTable::~STBaselineParamTable()
|
---|
| 47 | {
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | void STBaselineParamTable::setup()
|
---|
| 51 | {
|
---|
| 52 | table_.addColumn(ScalarColumnDesc<uInt>("BLFUNC"));
|
---|
| 53 | table_.addColumn(ScalarColumnDesc<uInt>("ORDER"));
|
---|
| 54 | table_.addColumn(ArrayColumnDesc<Float>("BOUNDARY"));
|
---|
| 55 | table_.addColumn(ArrayColumnDesc<Float>("PARAMETER"));
|
---|
| 56 |
|
---|
| 57 | table_.rwKeywordSet().define("ApplyType", "BASELINE");
|
---|
| 58 |
|
---|
| 59 | attachOptionalColumns();
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | void STBaselineParamTable::attachOptionalColumns()
|
---|
| 63 | {
|
---|
| 64 | blfuncCol_.attach(table_, "BLFUNC");
|
---|
| 65 | orderCol_.attach(table_, "ORDER");
|
---|
| 66 | boundaryCol_.attach(table_, "BOUNDARY");
|
---|
| 67 | paramCol_.attach(table_, "PARAMETER");
|
---|
| 68 |
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | void STBaselineParamTable::setdata(uInt irow, uInt scanno, uInt cycleno,
|
---|
| 72 | uInt beamno, uInt ifno, uInt polno, uInt freqid,
|
---|
| 73 | Double time, uInt blfunc, uInt order,
|
---|
| 74 | Vector<Float> boundary, Vector<Float> param)
|
---|
| 75 | {
|
---|
| 76 | if (irow >= (uInt)nrow()) {
|
---|
| 77 | throw AipsError("row index out of range");
|
---|
| 78 | }
|
---|
| 79 |
|
---|
| 80 | if (!sel_.empty()) {
|
---|
| 81 | os_.origin(LogOrigin("STBaselineParamTable","setdata",WHERE));
|
---|
| 82 | os_ << LogIO::WARN << "Data selection is effective. Specified row index may be wrong." << LogIO::POST;
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | setbasedata(irow, scanno, cycleno, beamno, ifno, polno, freqid, time);
|
---|
| 86 | blfuncCol_.put(irow, blfunc);
|
---|
| 87 | orderCol_.put(irow, order);
|
---|
| 88 | boundaryCol_.put(irow, boundary);
|
---|
| 89 | paramCol_.put(irow, param);
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | void STBaselineParamTable::appenddata(uInt scanno, uInt cycleno,
|
---|
| 93 | uInt beamno, uInt ifno, uInt polno, uInt freqid,
|
---|
| 94 | Double time, uInt blfunc, uInt order,
|
---|
| 95 | Vector<Float> boundary, Vector<Float> param)
|
---|
| 96 | {
|
---|
| 97 | uInt irow = nrow();
|
---|
| 98 | table_.addRow(1, True);
|
---|
| 99 | setdata(irow, scanno, cycleno, beamno, ifno, polno, freqid, time, blfunc, order, boundary, param);
|
---|
| 100 | }
|
---|
| 101 |
|
---|
| 102 | /*
|
---|
| 103 | Vector<STBaselineEnum::BaselineType> getBlfunc()
|
---|
| 104 | {
|
---|
| 105 | Vector<uInt> rawBlfuncColumn = blfuncCol_.getColumn();
|
---|
| 106 | Vector<STBaselineEnum::BaselineType> blfuncColumn;
|
---|
| 107 | for (uInt i = 0; i < rawBlfuncColumn.size(); ++i) {
|
---|
| 108 | blfuncColumn.append(STBaselineEnum::BaselineType(rawBlfuncColumn.get(i)));
|
---|
| 109 | }
|
---|
| 110 | return blfuncColumn;
|
---|
| 111 | }
|
---|
| 112 | */
|
---|
| 113 |
|
---|
| 114 | }
|
---|