source: branches/mergetest/src/ScantableWrapper.h@ 1846

Last change on this file since 1846 was 1819, checked in by Kana Sugimoto, 14 years ago

New Development: No

JIRA Issue: No (merge alma branch to trunk)

Ready for Test: Yes

Interface Changes: No

Test Programs: regressions may work

Module(s): all single dish modules

Description:

Merged all changes in alma (r1386:1818) and newfiller (r1774:1818) branch.


  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.9 KB
Line 
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 "STFit.h"
21#include "Scantable.h"
22#include "STCoordinate.h"
23
24namespace asap {
25/**
26 * This class contains and wraps a CountedPtr<Scantable>, as the CountedPtr
27 * class does not provide the dor operator which is need for references
28 * in boost::python
29 * see Scantable for interfce description
30 *
31 * @brief The main ASAP data container wrapper
32 * @author Malte Marquarding
33 * @date 2006-02-23
34 * @version 2.0a
35*/
36class ScantableWrapper {
37
38public:
39 explicit ScantableWrapper( const std::string& name,
40 int type=0)
41 {
42 casa::Table::TableType tp = casa::Table::Memory;
43 if ( type == 1 ) tp = casa::Table::Plain;
44 table_ = new Scantable(name, tp);
45 }
46
47 explicit ScantableWrapper(int type=0)
48 {
49 casa::Table::TableType tp = casa::Table::Memory;
50 if ( type == 1) tp = casa::Table::Plain;
51 table_= new Scantable(tp);
52 }
53
54 explicit ScantableWrapper(casa::CountedPtr<Scantable> cp) : table_(cp) {;}
55
56 ScantableWrapper(const ScantableWrapper& mt) :
57 table_(mt.getCP()) {;}
58
59 void assign(const ScantableWrapper& mt)
60 { table_= mt.getCP(); }
61
62 ScantableWrapper copy() {
63 return ScantableWrapper(new Scantable(*(this->getCP()), false));
64 }
65
66 std::vector<float> getSpectrum( int whichrow=0,
67 const std::string& poltype="" ) const {
68 return table_->getSpectrum(whichrow, poltype);
69 }
70 // std::string getPolarizationLabel(bool linear, bool stokes, bool linPol, int polIdx) const {
71 // Boost fails with 4 arguments.
72 std::string getPolarizationLabel(int index, const std::string& ptype) const {
73 return table_->getPolarizationLabel(index, ptype);
74 }
75
76 std::vector<double> getAbcissa(int whichrow=0) const
77 { return table_->getAbcissa(whichrow); }
78
79 std::string getAbcissaLabel(int whichrow=0) const
80 { return table_->getAbcissaLabel(whichrow); }
81
82 float getTsys(int whichrow=0) const
83 { return table_->getTsys(whichrow); }
84
85 std::string getTime(int whichrow=0) const
86 { return table_->getTime(whichrow); }
87
88 double getIntTime(int whichrow=0) const
89 { return table_->getIntTime(whichrow); }
90
91 std::string getDirectionString(int whichrow=0) const
92 { return table_->getDirectionString(whichrow); }
93
94 std::string getFluxUnit() const { return table_->getFluxUnit(); }
95
96 void setFluxUnit(const std::string& unit) { table_->setFluxUnit(unit); }
97
98 void setInstrument(const std::string& name) {table_->setInstrument(name);}
99 void setFeedType(const std::string& ftype) {table_->setFeedType(ftype);}
100
101 std::vector<bool> getMask(int whichrow=0) const
102 { return table_->getMask(whichrow); }
103
104 /**
105 void flag(const std::vector<bool>& msk=std::vector<bool>())
106 { table_->flag(msk); }
107 **/
108 void flag(const std::vector<bool>& msk=std::vector<bool>(), bool unflag=false)
109 { table_->flag(msk, unflag); }
110
111 void flagRow(const std::vector<casa::uInt>& rows=std::vector<casa::uInt>(), bool unflag=false)
112 { table_->flagRow(rows, unflag); }
113
114 bool getFlagRow(int whichrow=0) const
115 { return table_->getFlagRow(whichrow); }
116
117 void clip(const casa::Float uthres, const casa::Float dthres, bool clipoutside=true, bool unflag=false)
118 { table_->clip(uthres, dthres, clipoutside, unflag); }
119
120 std::vector<bool> getClipMask(int whichrow, const casa::Float uthres, const casa::Float dthres, bool clipoutside, bool unflag) const
121 { return table_->getClipMask(whichrow, uthres, dthres, clipoutside, unflag); }
122
123 std::string getSourceName(int whichrow=0) const
124 { return table_->getSourceName(whichrow); }
125
126 float getElevation(int whichrow=0) const
127 { return table_->getElevation(whichrow); }
128
129 float getAzimuth(int whichrow=0) const
130 { return table_->getAzimuth(whichrow); }
131
132 float getParAngle(int whichrow=0) const
133 { return table_->getParAngle(whichrow); }
134
135
136 void setSpectrum(std::vector<float> spectrum, int whichrow=0)
137 { table_->setSpectrum(spectrum, whichrow); }
138
139 std::vector<uint> getIFNos() { return table_->getIFNos(); }
140 int getIF(int whichrow) const {return table_->getIF(whichrow);}
141 std::vector<uint> getBeamNos() { return table_->getBeamNos(); }
142 int getBeam(int whichrow) const {return table_->getBeam(whichrow);}
143 std::vector<uint> getPolNos() { return table_->getPolNos(); }
144 int getPol(int whichrow) const {return table_->getPol(whichrow);}
145 int getCycle(int whichrow) const {return table_->getCycle(whichrow);}
146 std::vector<uint> getScanNos() { return table_->getScanNos(); }
147 int getScan(int whichrow) const {return table_->getScan(whichrow);}
148 std::vector<uint> getMolNos() { return table_->getMolNos();}
149
150 STSelector getSelection() const { return table_->getSelection(); }
151 void setSelection(const STSelector& sts)
152 { return table_->setSelection(sts);}
153
154 std::string getPolType() const { return table_->getPolType(); }
155
156 int nif(int scanno=-1) const {return table_->nif(scanno);}
157 int nbeam(int scanno=-1) const {return table_->nbeam(scanno);}
158 int npol(int scanno=-1) const {return table_->npol(scanno);}
159 int nchan(int ifno=-1) const {return table_->nchan(ifno);}
160 int nscan() const {return table_->nscan();}
161 int nrow() const {return table_->nrow();}
162 int ncycle(int scanno) const {return table_->ncycle(scanno);}
163
164 void makePersistent(const std::string& fname)
165 { table_->makePersistent(fname); }
166
167 void setSourceType(int stype)
168 { table_->setSourceType(stype); }
169
170 void shift(int npix)
171 { table_->shift(npix); }
172
173/**
174 commented out by TT
175 void setRestFrequencies(double rf, const std::string& name,
176 const std::string& unit)
177 { table_->setRestFrequencies(rf, name, unit); }
178**/
179 void setRestFrequencies(vector<double> rf, const vector<std::string>& name,
180 const std::string& unit)
181 { table_->setRestFrequencies(rf, name, unit); }
182
183/*
184 void setRestFrequencies(const std::string& name) {
185 table_->setRestFrequencies(name);
186 }
187*/
188
189/*
190 std::vector<double> getRestFrequencies() const
191 { return table_->getRestFrequencies(); }
192*/
193 std::vector<double> getRestFrequency(int id) const
194 { return table_->getRestFrequency(id); }
195
196 void setCoordInfo(std::vector<string> theinfo) {
197 table_->setCoordInfo(theinfo);
198 }
199 std::vector<string> getCoordInfo() const {
200 return table_->getCoordInfo();
201 }
202
203 void setDirection(const std::string& refstr="")
204 { table_->setDirectionRefString(refstr); }
205
206 casa::CountedPtr<Scantable> getCP() const {return table_;}
207 Scantable* getPtr() {return &(*table_);}
208
209 std::string summary(bool verbose=false) const {
210 return table_->summary(verbose);
211 }
212
213 std::vector<std::string> getHistory()const
214 { return table_->getHistory(); }
215
216 void addHistory(const std::string& hist)
217 { table_->addHistory(hist); }
218
219 void addFit(const STFitEntry& fit, int row)
220 { table_->addFit(fit, row); }
221
222 STFitEntry getFit(int whichrow) const
223 { return table_->getFit(whichrow); }
224
225 void calculateAZEL() { table_->calculateAZEL(); };
226
227 std::vector<std::string> columnNames() const
228 { return table_->columnNames(); }
229
230 std::string getAntennaName() const
231 { return table_->getAntennaName(); }
232
233 int checkScanInfo(const vector<int>& scanlist) const
234 { return table_->checkScanInfo(scanlist); }
235
236 std::vector<double> getDirectionVector(int whichrow) const
237 { return table_->getDirectionVector(whichrow); }
238
239 void parallactify(bool flag)
240 { table_->parallactify(flag); }
241
242 STCoordinate getCoordinate(int row) {
243 return STCoordinate(table_->getSpectralCoordinate(row));
244 }
245
246 std::vector<float> getWeather(int whichrow) const
247 { return table_->getWeather(whichrow); }
248
249 void reshapeSpectrum( int nmin, int nmax )
250 { table_->reshapeSpectrum( nmin, nmax ); }
251
252private:
253 casa::CountedPtr<Scantable> table_;
254};
255
256} // namespace
257#endif
258
Note: See TracBrowser for help on using the repository browser.