1 | //
|
---|
2 | // C++ Interface: Scantable
|
---|
3 | //
|
---|
4 | // Description:
|
---|
5 | //
|
---|
6 | //
|
---|
7 | // Author: Malte Marquarding <asap@atnf.csiro.au>, (C) 2006
|
---|
8 | //
|
---|
9 | // Copyright: See COPYING file that comes with this distribution
|
---|
10 | //
|
---|
11 | //
|
---|
12 | #ifndef ASAPSCANTABLEWRAPPER_H
|
---|
13 | #define ASAPSCANTABLEWRAPPER_H
|
---|
14 |
|
---|
15 | #include <vector>
|
---|
16 | #include <string>
|
---|
17 | #include <casa/Arrays/Vector.h>
|
---|
18 |
|
---|
19 | #include "MathUtils.h"
|
---|
20 | #include "SDFitTable.h"
|
---|
21 | #include "Scantable.h"
|
---|
22 |
|
---|
23 | namespace asap {
|
---|
24 | /**
|
---|
25 | * This class contains and wraps a CountedPtr<Scantable>, as the CountedPtr
|
---|
26 | * class does not provide the dor operator which is need for references
|
---|
27 | * in boost::python
|
---|
28 | * see Scantable for interfce description
|
---|
29 | *
|
---|
30 | * @brief The main ASAP data container wrapper
|
---|
31 | * @author Malte Marquarding
|
---|
32 | * @date 2006-02-23
|
---|
33 | * @version 2.0a
|
---|
34 | */
|
---|
35 | class ScantableWrapper {
|
---|
36 |
|
---|
37 | public:
|
---|
38 | ScantableWrapper(const std::string& name) :
|
---|
39 | table_(new Scantable(name)) {;}
|
---|
40 |
|
---|
41 | ScantableWrapper() :
|
---|
42 | table_(new Scantable()) {;}
|
---|
43 |
|
---|
44 | ScantableWrapper(casa::CountedPtr<Scantable> cp) : table_(cp) {;}
|
---|
45 |
|
---|
46 | ScantableWrapper(const ScantableWrapper& mt) :
|
---|
47 | table_(mt.getCP()) {;}
|
---|
48 |
|
---|
49 | ScantableWrapper(const ScantableWrapper& mt, const std::string& expr) :
|
---|
50 | table_(new Scantable(mt.getCP()->table(), expr)) {;}
|
---|
51 |
|
---|
52 | ScantableWrapper copy() {
|
---|
53 | return ScantableWrapper(new Scantable(*(this->getCP()), false));
|
---|
54 | }
|
---|
55 |
|
---|
56 |
|
---|
57 | std::vector<float> getSpectrum(int whichRow=0) const {
|
---|
58 | return table_->getSpectrum(whichRow);
|
---|
59 | }
|
---|
60 |
|
---|
61 | std::vector<float> getStokesSpectrum(int whichRow=0,
|
---|
62 | bool linPol=false) const {
|
---|
63 | return table_->getStokesSpectrum(whichRow, linPol);
|
---|
64 | }
|
---|
65 |
|
---|
66 | std::vector<float> stokesToPolSpectrum(int whichRow=0, bool linear=false,
|
---|
67 | int polIdx=-1) const {
|
---|
68 | return table_->stokesToPolSpectrum(whichRow, linear, polIdx);
|
---|
69 | }
|
---|
70 |
|
---|
71 | // std::string getPolarizationLabel(bool linear, bool stokes, bool linPol, int polIdx) const {
|
---|
72 | // Boost fails with 4 arguments.
|
---|
73 | std::string getPolarizationLabel(bool linear, bool stokes,
|
---|
74 | bool linPol) const {
|
---|
75 | int polIdx = -1;
|
---|
76 | return table_->getPolarizationLabel(linear, stokes, linPol, polIdx);
|
---|
77 | }
|
---|
78 |
|
---|
79 | std::vector<double> getAbcissa(int whichRow=0) const {
|
---|
80 | return table_->getAbcissa(whichRow);
|
---|
81 | }
|
---|
82 | std::string getAbcissaString(int whichRow=0) const {
|
---|
83 | return table_->getAbcissaString(whichRow);
|
---|
84 | }
|
---|
85 |
|
---|
86 | std::vector<float> getTsys() {
|
---|
87 | int nRow = table_->nRow();
|
---|
88 | std::vector<float> result(nRow);
|
---|
89 | for (uint i=0; i<nRow; i++) {
|
---|
90 | result[i] = table_->getTsys(i);
|
---|
91 | }
|
---|
92 | return result;
|
---|
93 | }
|
---|
94 |
|
---|
95 | std::string getTime(int whichRow=0) {return table_->getTime(whichRow);}
|
---|
96 |
|
---|
97 | std::string getFluxUnit() const {return table_->getFluxUnit();}
|
---|
98 | void setFluxUnit(const std::string& unit) {table_->setFluxUnit(unit);}
|
---|
99 |
|
---|
100 | void setInstrument(const std::string& name) {table_->setInstrument(name);}
|
---|
101 |
|
---|
102 | std::vector<bool> getMask(int whichRow=0) const {
|
---|
103 | return table_->getMask(whichRow);
|
---|
104 | }
|
---|
105 |
|
---|
106 | void flag(int whichRow=-1) {
|
---|
107 | table_->flag(whichRow);
|
---|
108 | }
|
---|
109 | std::string getSourceName(int whichRow=0) {
|
---|
110 | return table_->getSourceName(whichRow);
|
---|
111 | }
|
---|
112 |
|
---|
113 | float getElevation(int whichRow=0) {
|
---|
114 | return table_->getElevation(whichRow);
|
---|
115 | }
|
---|
116 | float getAzimuth(int whichRow=0) {
|
---|
117 | return table_->getAzimuth(whichRow);
|
---|
118 | }
|
---|
119 | float getParAngle(int whichRow=0) {
|
---|
120 | return table_->getParAngle(whichRow);
|
---|
121 | }
|
---|
122 |
|
---|
123 | void setSpectrum(std::vector<float> spectrum, int whichrow=0) {
|
---|
124 | table_->setSpectrum(spectrum, whichrow);
|
---|
125 | }
|
---|
126 |
|
---|
127 | int getIF(int whichrow) {return table_->getIF(whichrow);}
|
---|
128 | int getBeam(int whichrow) {return table_->getBeam(whichrow);}
|
---|
129 | int getPol(int whichrow) {return table_->getPol(whichrow);}
|
---|
130 |
|
---|
131 | STSelector getSelection() { return table_->getSelection(); }
|
---|
132 |
|
---|
133 | int nif(int scanno=-1) {return table_->nif(scanno);}
|
---|
134 | int nbeam(int scanno=-1) {return table_->nbeam(scanno);}
|
---|
135 | int npol(int scanno=-1) {return table_->npol(scanno);}
|
---|
136 | int nchan(int ifno=-1) {return table_->nchan(ifno);}
|
---|
137 | int nscan() {return table_->nscan();}
|
---|
138 | int nrow() {return table_->nrow();}
|
---|
139 | ///@todo int nstokes() {return table_->nStokes();}
|
---|
140 |
|
---|
141 | void makePersistent(const std::string& fname) {
|
---|
142 | table_->makePersistent(fname);
|
---|
143 | }
|
---|
144 |
|
---|
145 | void setRestFreqs(double rf, const std::string& unit) {
|
---|
146 | table_->setRestFreqs(rf, unit);
|
---|
147 | }
|
---|
148 |
|
---|
149 | void setRestFreqs(const std::string& name) {
|
---|
150 | table_->setRestFreqs(name);
|
---|
151 | }
|
---|
152 |
|
---|
153 | std::vector<double> getRestFrequencies() {
|
---|
154 | return table_->getRestFrequencies();
|
---|
155 | }
|
---|
156 |
|
---|
157 | void setCoordInfo(std::vector<string> theinfo) {
|
---|
158 | table_->setCoordInfo(theinfo);
|
---|
159 | }
|
---|
160 | std::vector<string> getCoordInfo() const {
|
---|
161 | return table_->getCoordInfo();
|
---|
162 | }
|
---|
163 |
|
---|
164 | casa::CountedPtr<Scantable> getCP() const {return table_;}
|
---|
165 | Scantable* getPtr() {return &(*table_);}
|
---|
166 |
|
---|
167 | std::string summary(bool verbose=false) const {
|
---|
168 | return table_->summary(verbose);
|
---|
169 | }
|
---|
170 |
|
---|
171 | std::vector<std::string> getHistory() {
|
---|
172 | return table_->getHistory();
|
---|
173 | }
|
---|
174 | void addHistory(const std::string& hist) {
|
---|
175 | table_->addHistory(hist);
|
---|
176 | }
|
---|
177 |
|
---|
178 | void addFit(int whichRow, const std::vector<double>& p,
|
---|
179 | const std::vector<bool>& m, const std::vector<string>& f,
|
---|
180 | const std::vector<int>& c) {
|
---|
181 |
|
---|
182 | casa::Vector<casa::Double> p2(p);
|
---|
183 | casa::Vector<casa::Bool> m2(m);
|
---|
184 | casa::Vector<casa::String> f2 = mathutil::toVectorString(f);
|
---|
185 | casa::Vector<casa::Int> c2(c);
|
---|
186 | table_->addFit(casa::uInt(whichRow), p2,m2,f2,c2);
|
---|
187 | }
|
---|
188 | SDFitTable getSDFitTable(int whichRow) {
|
---|
189 | return table_->getSDFitTable(casa::uInt(whichRow));
|
---|
190 | }
|
---|
191 |
|
---|
192 | void calculateAZEL() { table_->calculateAZEL(); };
|
---|
193 |
|
---|
194 | private:
|
---|
195 | casa::CountedPtr<Scantable> table_;
|
---|
196 | };
|
---|
197 |
|
---|
198 | } // namespace
|
---|
199 | #endif
|
---|
200 |
|
---|