source: trunk/src/ScantableWrapper.h@ 1948

Last change on this file since 1948 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
RevLine 
[847]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
[2]14
15#include <vector>
16#include <string>
[380]17#include <casa/Arrays/Vector.h>
[2]18
[465]19#include "MathUtils.h"
[901]20#include "STFit.h"
[1931]21#include "STFitEntry.h"
[847]22#include "Scantable.h"
[1598]23#include "STCoordinate.h"
[2]24
[83]25namespace asap {
[847]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 {
[2]38
39public:
[1385]40 explicit ScantableWrapper( const std::string& name,
[1077]41 int type=0)
[864]42 {
43 casa::Table::TableType tp = casa::Table::Memory;
[1077]44 if ( type == 1 ) tp = casa::Table::Plain;
[864]45 table_ = new Scantable(name, tp);
46 }
[90]47
[1350]48 explicit ScantableWrapper(int type=0)
[864]49 {
50 casa::Table::TableType tp = casa::Table::Memory;
[1077]51 if ( type == 1) tp = casa::Table::Plain;
[864]52 table_= new Scantable(tp);
53 }
[90]54
[1350]55 explicit ScantableWrapper(casa::CountedPtr<Scantable> cp) : table_(cp) {;}
[90]56
[847]57 ScantableWrapper(const ScantableWrapper& mt) :
58 table_(mt.getCP()) {;}
[90]59
[868]60 void assign(const ScantableWrapper& mt)
61 { table_= mt.getCP(); }
62
[847]63 ScantableWrapper copy() {
64 return ScantableWrapper(new Scantable(*(this->getCP()), false));
[80]65 }
[868]66
[896]67 std::vector<float> getSpectrum( int whichrow=0,
[905]68 const std::string& poltype="" ) const {
[896]69 return table_->getSpectrum(whichrow, poltype);
[2]70 }
[527]71 // std::string getPolarizationLabel(bool linear, bool stokes, bool linPol, int polIdx) const {
72 // Boost fails with 4 arguments.
[902]73 std::string getPolarizationLabel(int index, const std::string& ptype) const {
74 return table_->getPolarizationLabel(index, ptype);
[494]75 }
[527]76
[896]77 std::vector<double> getAbcissa(int whichrow=0) const
78 { return table_->getAbcissa(whichrow); }
[41]79
[896]80 std::string getAbcissaLabel(int whichrow=0) const
81 { return table_->getAbcissaLabel(whichrow); }
[157]82
[896]83 float getTsys(int whichrow=0) const
84 { return table_->getTsys(whichrow); }
[2]85
[1947]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)); }
[207]90
[1350]91 double getIntTime(int whichrow=0) const
92 { return table_->getIntTime(whichrow); }
93
[1068]94 std::string getDirectionString(int whichrow=0) const
95 { return table_->getDirectionString(whichrow); }
96
[864]97 std::string getFluxUnit() const { return table_->getFluxUnit(); }
98
99 void setFluxUnit(const std::string& unit) { table_->setFluxUnit(unit); }
100
[238]101 void setInstrument(const std::string& name) {table_->setInstrument(name);}
[1189]102 void setFeedType(const std::string& ftype) {table_->setFeedType(ftype);}
[238]103
[896]104 std::vector<bool> getMask(int whichrow=0) const
105 { return table_->getMask(whichrow); }
[2]106
[1430]107 /**
[1000]108 void flag(const std::vector<bool>& msk=std::vector<bool>())
109 { table_->flag(msk); }
[1430]110 **/
111 void flag(const std::vector<bool>& msk=std::vector<bool>(), bool unflag=false)
112 { table_->flag(msk, unflag); }
[2]113
[1819]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
[896]126 std::string getSourceName(int whichrow=0) const
127 { return table_->getSourceName(whichrow); }
[794]128
[896]129 float getElevation(int whichrow=0) const
130 { return table_->getElevation(whichrow); }
[90]131
[896]132 float getAzimuth(int whichrow=0) const
133 { return table_->getAzimuth(whichrow); }
[2]134
[896]135 float getParAngle(int whichrow=0) const
136 { return table_->getParAngle(whichrow); }
[2]137
[864]138
[884]139 void setSpectrum(std::vector<float> spectrum, int whichrow=0)
140 { table_->setSpectrum(spectrum, whichrow); }
[868]141
[1111]142 std::vector<uint> getIFNos() { return table_->getIFNos(); }
[864]143 int getIF(int whichrow) const {return table_->getIF(whichrow);}
[1111]144 std::vector<uint> getBeamNos() { return table_->getBeamNos(); }
[864]145 int getBeam(int whichrow) const {return table_->getBeam(whichrow);}
[1111]146 std::vector<uint> getPolNos() { return table_->getPolNos(); }
[864]147 int getPol(int whichrow) const {return table_->getPol(whichrow);}
[868]148 int getCycle(int whichrow) const {return table_->getCycle(whichrow);}
[1111]149 std::vector<uint> getScanNos() { return table_->getScanNos(); }
[868]150 int getScan(int whichrow) const {return table_->getScan(whichrow);}
[1819]151 std::vector<uint> getMolNos() { return table_->getMolNos();}
[864]152
153 STSelector getSelection() const { return table_->getSelection(); }
[868]154 void setSelection(const STSelector& sts)
155 { return table_->setSelection(sts);}
[864]156
[896]157 std::string getPolType() const { return table_->getPolType(); }
158
[864]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();}
[902]165 int ncycle(int scanno) const {return table_->ncycle(scanno);}
[2]166
[864]167 void makePersistent(const std::string& fname)
168 { table_->makePersistent(fname); }
[90]169
[1068]170 void setSourceType(int stype)
171 { table_->setSourceType(stype); }
172
[1360]173 void shift(int npix)
174 { table_->shift(npix); }
175
[1819]176/**
177 commented out by TT
[1170]178 void setRestFrequencies(double rf, const std::string& name,
179 const std::string& unit)
180 { table_->setRestFrequencies(rf, name, unit); }
[1819]181**/
182 void setRestFrequencies(vector<double> rf, const vector<std::string>& name,
183 const std::string& unit)
184 { table_->setRestFrequencies(rf, name, unit); }
185
[925]186/*
[868]187 void setRestFrequencies(const std::string& name) {
188 table_->setRestFrequencies(name);
[847]189 }
[925]190*/
[745]191
[1819]192/*
[864]193 std::vector<double> getRestFrequencies() const
194 { return table_->getRestFrequencies(); }
[1819]195*/
196 std::vector<double> getRestFrequency(int id) const
197 { return table_->getRestFrequency(id); }
[251]198
[105]199 void setCoordInfo(std::vector<string> theinfo) {
200 table_->setCoordInfo(theinfo);
201 }
202 std::vector<string> getCoordInfo() const {
203 return table_->getCoordInfo();
204 }
[90]205
[987]206 void setDirection(const std::string& refstr="")
207 { table_->setDirectionRefString(refstr); }
208
[847]209 casa::CountedPtr<Scantable> getCP() const {return table_;}
210 Scantable* getPtr() {return &(*table_);}
[380]211
[745]212 std::string summary(bool verbose=false) const {
213 return table_->summary(verbose);
[380]214 }
[745]215
[864]216 std::vector<std::string> getHistory()const
217 { return table_->getHistory(); }
[207]218
[864]219 void addHistory(const std::string& hist)
220 { table_->addHistory(hist); }
[745]221
[972]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
[777]228 void calculateAZEL() { table_->calculateAZEL(); };
[465]229
[1003]230 std::vector<std::string> columnNames() const
231 { return table_->columnNames(); }
232
[1391]233 std::string getAntennaName() const
234 { return table_->getAntennaName(); }
235
236 int checkScanInfo(const vector<int>& scanlist) const
237 { return table_->checkScanInfo(scanlist); }
[1819]238
[1730]239 std::vector<double> getDirectionVector(int whichrow) const
[1391]240 { return table_->getDirectionVector(whichrow); }
241
[1586]242 void parallactify(bool flag)
243 { table_->parallactify(flag); }
244
[1598]245 STCoordinate getCoordinate(int row) {
246 return STCoordinate(table_->getSpectralCoordinate(row));
247 }
248
[1730]249 std::vector<float> getWeather(int whichrow) const
250 { return table_->getWeather(whichrow); }
251
[1819]252 void reshapeSpectrum( int nmin, int nmax )
253 { table_->reshapeSpectrum( nmin, nmax ); }
254
[1931]255 STFitEntry polyBaseline(const std::vector<bool>& mask, int order, int rowno)
256 { return table_->polyBaseline(mask, order, rowno); }
[1907]257
[1931]258 void polyBaselineBatch(const std::vector<bool>& mask, int order)
259 { table_->polyBaselineBatch(mask, order); }
[1907]260
261 bool getFlagtraFast(int whichrow=0) const
262 { return table_->getFlagtraFast(whichrow); }
263
264
[2]265private:
[847]266 casa::CountedPtr<Scantable> table_;
[2]267};
268
269} // namespace
270#endif
[1819]271
Note: See TracBrowser for help on using the repository browser.