source: trunk/src/ScantableWrapper.h@ 1966

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

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed:
+ An optional parameter 'prec (unsigned int)' is added to

scantable.get_time, python_Scantable::_gettime, ScantableWrapper::getTime and Scantable::getTime.

+ Also Scantable::fromatTime accepts 'prec' as a parameter.
+ scantable._get_column accepts args which will be passed to callback function.

Test Programs:

Put in Release Notes: No

Module(s): scantable

Description:

Add a parameter prec to scantable.get_time which specifies the precision of time returned.
The default value is prec=0.

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