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 | const std::string& type="")
|
---|
40 | {
|
---|
41 | casa::Table::TableType tp = casa::Table::Memory;
|
---|
42 | if ( type == "disk") tp = casa::Table::Plain;
|
---|
43 | table_ = new Scantable(name, tp);
|
---|
44 | }
|
---|
45 |
|
---|
46 | ScantableWrapper(const std::string& type="")
|
---|
47 | {
|
---|
48 | casa::Table::TableType tp = casa::Table::Memory;
|
---|
49 | if ( type == "disk") tp = casa::Table::Plain;
|
---|
50 | table_= new Scantable(tp);
|
---|
51 | }
|
---|
52 |
|
---|
53 | ScantableWrapper(casa::CountedPtr<Scantable> cp) : table_(cp) {;}
|
---|
54 |
|
---|
55 | ScantableWrapper(const ScantableWrapper& mt) :
|
---|
56 | table_(mt.getCP()) {;}
|
---|
57 |
|
---|
58 | ScantableWrapper copy() {
|
---|
59 | return ScantableWrapper(new Scantable(*(this->getCP()), false));
|
---|
60 | }
|
---|
61 | /*
|
---|
62 | std::vector<float> getSpectrum(int whichRow=0) const {
|
---|
63 | return table_->getSpectrum(whichRow);
|
---|
64 | }
|
---|
65 |
|
---|
66 | std::vector<float> getStokesSpectrum(int whichRow=0,
|
---|
67 | bool linPol=false) const {
|
---|
68 | return table_->getStokesSpectrum(whichRow, linPol);
|
---|
69 | }
|
---|
70 |
|
---|
71 | std::vector<float> stokesToPolSpectrum(int whichRow=0, bool linear=false,
|
---|
72 | int polIdx=-1) const {
|
---|
73 | return table_->stokesToPolSpectrum(whichRow, linear, polIdx);
|
---|
74 | }
|
---|
75 | */
|
---|
76 | // std::string getPolarizationLabel(bool linear, bool stokes, bool linPol, int polIdx) const {
|
---|
77 | // Boost fails with 4 arguments.
|
---|
78 | std::string getPolarizationLabel(bool linear, bool stokes,
|
---|
79 | bool linPol) const {
|
---|
80 | int polIdx = -1;
|
---|
81 | return table_->getPolarizationLabel(linear, stokes, linPol, polIdx);
|
---|
82 | }
|
---|
83 |
|
---|
84 | std::vector<double> getAbcissa(int whichRow=0) const
|
---|
85 | { return table_->getAbcissa(whichRow); }
|
---|
86 |
|
---|
87 | std::string getAbcissaString(int whichRow=0) const
|
---|
88 | { return table_->getAbcissaString(whichRow); }
|
---|
89 |
|
---|
90 | float getTsys(int whichRow=0) const
|
---|
91 | { return table_->getTsys(whichRow); }
|
---|
92 |
|
---|
93 | std::string getTime(int whichRow=0) const
|
---|
94 | { return table_->getTime(whichRow); }
|
---|
95 |
|
---|
96 | std::string getFluxUnit() const { return table_->getFluxUnit(); }
|
---|
97 |
|
---|
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 | void flag() { table_->flag(); }
|
---|
106 |
|
---|
107 | std::string getSourceName(int whichRow=0) const
|
---|
108 | { return table_->getSourceName(whichRow); }
|
---|
109 |
|
---|
110 | float getElevation(int whichRow=0) const
|
---|
111 | { return table_->getElevation(whichRow); }
|
---|
112 |
|
---|
113 | float getAzimuth(int whichRow=0) const
|
---|
114 | { return table_->getAzimuth(whichRow); }
|
---|
115 |
|
---|
116 | float getParAngle(int whichRow=0) const
|
---|
117 | { return table_->getParAngle(whichRow); }
|
---|
118 |
|
---|
119 | void setSpectrum(std::vector<float> spectrum, int whichrow=0)
|
---|
120 | { table_->setSpectrum(spectrum, whichrow); }
|
---|
121 |
|
---|
122 | int getIF(int whichrow) const {return table_->getIF(whichrow);}
|
---|
123 | int getBeam(int whichrow) const {return table_->getBeam(whichrow);}
|
---|
124 | int getPol(int whichrow) const {return table_->getPol(whichrow);}
|
---|
125 |
|
---|
126 | STSelector getSelection() const { return table_->getSelection(); }
|
---|
127 |
|
---|
128 | int nif(int scanno=-1) const {return table_->nif(scanno);}
|
---|
129 | int nbeam(int scanno=-1) const {return table_->nbeam(scanno);}
|
---|
130 | int npol(int scanno=-1) const {return table_->npol(scanno);}
|
---|
131 | int nchan(int ifno=-1) const {return table_->nchan(ifno);}
|
---|
132 | int nscan() const {return table_->nscan();}
|
---|
133 | int nrow() const {return table_->nrow();}
|
---|
134 | ///@todo int nstokes() {return table_->nStokes();}
|
---|
135 |
|
---|
136 | void makePersistent(const std::string& fname)
|
---|
137 | { table_->makePersistent(fname); }
|
---|
138 |
|
---|
139 | void setRestFreqs(double rf, const std::string& unit)
|
---|
140 | { table_->setRestFreqs(rf, unit); }
|
---|
141 |
|
---|
142 | void setRestFreqs(const std::string& name) {
|
---|
143 | table_->setRestFreqs(name);
|
---|
144 | }
|
---|
145 |
|
---|
146 | std::vector<double> getRestFrequencies() const
|
---|
147 | { return table_->getRestFrequencies(); }
|
---|
148 |
|
---|
149 | void setCoordInfo(std::vector<string> theinfo) {
|
---|
150 | table_->setCoordInfo(theinfo);
|
---|
151 | }
|
---|
152 | std::vector<string> getCoordInfo() const {
|
---|
153 | return table_->getCoordInfo();
|
---|
154 | }
|
---|
155 |
|
---|
156 | casa::CountedPtr<Scantable> getCP() const {return table_;}
|
---|
157 | Scantable* getPtr() {return &(*table_);}
|
---|
158 |
|
---|
159 | std::string summary(bool verbose=false) const {
|
---|
160 | return table_->summary(verbose);
|
---|
161 | }
|
---|
162 |
|
---|
163 | std::vector<std::string> getHistory()const
|
---|
164 | { return table_->getHistory(); }
|
---|
165 |
|
---|
166 | void addHistory(const std::string& hist)
|
---|
167 | { table_->addHistory(hist); }
|
---|
168 | /*
|
---|
169 | void addFit(int whichRow, const std::vector<double>& p,
|
---|
170 | const std::vector<bool>& m, const std::vector<string>& f,
|
---|
171 | const std::vector<int>& c) {
|
---|
172 |
|
---|
173 | casa::Vector<casa::Double> p2(p);
|
---|
174 | casa::Vector<casa::Bool> m2(m);
|
---|
175 | casa::Vector<casa::String> f2 = mathutil::toVectorString(f);
|
---|
176 | casa::Vector<casa::Int> c2(c);
|
---|
177 | table_->addFit(casa::uInt(whichRow), p2,m2,f2,c2);
|
---|
178 | }
|
---|
179 | SDFitTable getSDFitTable(int whichRow) {
|
---|
180 | return table_->getSDFitTable(casa::uInt(whichRow));
|
---|
181 | }
|
---|
182 | */
|
---|
183 | void calculateAZEL() { table_->calculateAZEL(); };
|
---|
184 |
|
---|
185 | private:
|
---|
186 | casa::CountedPtr<Scantable> table_;
|
---|
187 | };
|
---|
188 |
|
---|
189 | } // namespace
|
---|
190 | #endif
|
---|
191 |
|
---|