1 | //
|
---|
2 | // C++ Implementation: STCalSkyTable
|
---|
3 | //
|
---|
4 | // Description:
|
---|
5 | //
|
---|
6 | //
|
---|
7 | // Author: Takeshi Nakazato <takeshi.nakazato@nao.ac.jp> (C) 2012
|
---|
8 | //
|
---|
9 | // Copyright: See COPYING file that comes with this distribution
|
---|
10 | //
|
---|
11 | //
|
---|
12 | #include <casa/Exceptions/Error.h>
|
---|
13 | #include <casa/Logging/LogIO.h>
|
---|
14 | #include <tables/Tables/TableDesc.h>
|
---|
15 | #include <tables/Tables/SetupNewTab.h>
|
---|
16 | #include <tables/Tables/ArrColDesc.h>
|
---|
17 | #include <tables/Tables/ScaColDesc.h>
|
---|
18 | #include <tables/Tables/TableRecord.h>
|
---|
19 | #include <measures/TableMeasures/TableMeasDesc.h>
|
---|
20 | #include <measures/TableMeasures/TableMeasRefDesc.h>
|
---|
21 | #include <measures/TableMeasures/TableMeasValueDesc.h>
|
---|
22 |
|
---|
23 | #include "Scantable.h"
|
---|
24 | #include "STCalSkyTable.h"
|
---|
25 |
|
---|
26 |
|
---|
27 | using namespace casa;
|
---|
28 |
|
---|
29 | namespace asap {
|
---|
30 |
|
---|
31 | const String STCalSkyTable::name_ = "APPLY_SKY";
|
---|
32 |
|
---|
33 | STCalSkyTable::STCalSkyTable(const Scantable& parent, const String &caltype)
|
---|
34 | : STApplyTable(parent, name_),
|
---|
35 | caltype_(caltype)
|
---|
36 | {
|
---|
37 | setup();
|
---|
38 | }
|
---|
39 |
|
---|
40 | STCalSkyTable::~STCalSkyTable()
|
---|
41 | {
|
---|
42 | }
|
---|
43 |
|
---|
44 | void STCalSkyTable::setup()
|
---|
45 | {
|
---|
46 | table_.addColumn(ArrayColumnDesc<Float>("SPECTRA"));
|
---|
47 | table_.addColumn(ScalarColumnDesc<Float>("ELEVATION"));
|
---|
48 |
|
---|
49 | //table_.rwKeywordSet().define("ApplyType", "SKY");
|
---|
50 | String caltype = "CALSKY_" + caltype_;
|
---|
51 | caltype.upcase();
|
---|
52 | table_.rwKeywordSet().define("ApplyType", caltype);
|
---|
53 |
|
---|
54 | attachOptionalColumns();
|
---|
55 | }
|
---|
56 |
|
---|
57 | void STCalSkyTable::attachOptionalColumns()
|
---|
58 | {
|
---|
59 | spectraCol_.attach(table_, "SPECTRA");
|
---|
60 | elCol_.attach(table_,"ELEVATION");
|
---|
61 |
|
---|
62 | }
|
---|
63 |
|
---|
64 | void STCalSkyTable::setdata(uInt irow, uInt scanno, uInt cycleno,
|
---|
65 | uInt beamno, uInt ifno, uInt polno,
|
---|
66 | Double time, Float elevation, Vector<Float> spectra)
|
---|
67 | {
|
---|
68 | if (irow >= (uInt)nrow()) {
|
---|
69 | throw AipsError("row index out of range");
|
---|
70 | }
|
---|
71 |
|
---|
72 | if (!sel_.empty()) {
|
---|
73 | os_.origin(LogOrigin("STCalSkyTable","setdata",WHERE));
|
---|
74 | os_ << LogIO::WARN << "Data selection is effective. Specified row index may be wrong." << LogIO::POST;
|
---|
75 | }
|
---|
76 |
|
---|
77 | setbasedata(irow, scanno, cycleno, beamno, ifno, polno, time);
|
---|
78 | elCol_.put(irow, elevation);
|
---|
79 | spectraCol_.put(irow, spectra);
|
---|
80 | }
|
---|
81 |
|
---|
82 | void STCalSkyTable::appenddata(uInt scanno, uInt cycleno,
|
---|
83 | uInt beamno, uInt ifno, uInt polno,
|
---|
84 | Double time, Float elevation, Vector<Float> spectra)
|
---|
85 | {
|
---|
86 | uInt irow = nrow();
|
---|
87 | table_.addRow(1, True);
|
---|
88 | setdata(irow, scanno, cycleno, beamno, ifno, polno, time, elevation, spectra);
|
---|
89 | }
|
---|
90 | }
|
---|