1 | //
|
---|
2 | // C++ Implementation: STCalSky
|
---|
3 | //
|
---|
4 | // Description:
|
---|
5 | //
|
---|
6 | //
|
---|
7 | // Author: Takeshi Nakazato
|
---|
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 "STCalSky.h"
|
---|
25 |
|
---|
26 |
|
---|
27 | using namespace casa;
|
---|
28 |
|
---|
29 | namespace asap {
|
---|
30 |
|
---|
31 | const String STCalSky::name_ = "APPLY_SKY";
|
---|
32 |
|
---|
33 | STCalSky::STCalSky(const Scantable& parent)
|
---|
34 | : STApplyTable(parent, name_)
|
---|
35 | {
|
---|
36 | setup();
|
---|
37 | }
|
---|
38 |
|
---|
39 | STCalSky::~STCalSky()
|
---|
40 | {
|
---|
41 | }
|
---|
42 |
|
---|
43 | void STCalSky::setup()
|
---|
44 | {
|
---|
45 | table_.addColumn(ArrayColumnDesc<Float>("SPECTRA"));
|
---|
46 | table_.addColumn(ScalarColumnDesc<Float>("ELEVATION"));
|
---|
47 |
|
---|
48 | table_.rwKeywordSet().define("ApplyType", "SKY");
|
---|
49 |
|
---|
50 | attachOptionalColumns();
|
---|
51 | }
|
---|
52 |
|
---|
53 | void STCalSky::attachOptionalColumns()
|
---|
54 | {
|
---|
55 | spectraCol_.attach(table_, "SPECTRA");
|
---|
56 | elCol_.attach(table_,"ELEVATION");
|
---|
57 |
|
---|
58 | }
|
---|
59 |
|
---|
60 | void STCalSky::setdata(uInt irow, uInt scanno, uInt cycleno,
|
---|
61 | uInt beamno, uInt ifno, uInt polno,
|
---|
62 | Double time, Float elevation, Vector<Float> spectra)
|
---|
63 | {
|
---|
64 | if (irow >= (uInt)nrow()) {
|
---|
65 | throw AipsError("row index out of range");
|
---|
66 | }
|
---|
67 |
|
---|
68 | if (!sel_.empty()) {
|
---|
69 | os_.origin(LogOrigin("STCalSky","setdata",WHERE));
|
---|
70 | os_ << LogIO::WARN << "Data selection is effective. Specified row index may be wrong." << LogIO::POST;
|
---|
71 | }
|
---|
72 |
|
---|
73 | setbasedata(irow, scanno, cycleno, beamno, ifno, polno, time);
|
---|
74 | elCol_.put(irow, elevation);
|
---|
75 | spectraCol_.put(irow, spectra);
|
---|
76 | }
|
---|
77 |
|
---|
78 | void STCalSky::appenddata(uInt scanno, uInt cycleno,
|
---|
79 | uInt beamno, uInt ifno, uInt polno,
|
---|
80 | Double time, Float elevation, Vector<Float> spectra)
|
---|
81 | {
|
---|
82 | uInt irow = nrow();
|
---|
83 | table_.addRow(1, True);
|
---|
84 | setdata(irow, scanno, cycleno, beamno, ifno, polno, time, elevation, spectra);
|
---|
85 | }
|
---|
86 | }
|
---|