source: branches/polybatch/src/ScantableWrapper.h@ 2332

Last change on this file since 2332 was 1924, checked in by Malte Marquarding, 14 years ago

Ticket #206: use STFitEntry as return objetc instead of pointer wrnagling.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.3 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"
[1924]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
[896]86 std::string getTime(int whichrow=0) const
87 { return table_->getTime(whichrow); }
[207]88
[1350]89 double getIntTime(int whichrow=0) const
90 { return table_->getIntTime(whichrow); }
91
[1068]92 std::string getDirectionString(int whichrow=0) const
93 { return table_->getDirectionString(whichrow); }
94
[864]95 std::string getFluxUnit() const { return table_->getFluxUnit(); }
96
97 void setFluxUnit(const std::string& unit) { table_->setFluxUnit(unit); }
98
[238]99 void setInstrument(const std::string& name) {table_->setInstrument(name);}
[1189]100 void setFeedType(const std::string& ftype) {table_->setFeedType(ftype);}
[238]101
[896]102 std::vector<bool> getMask(int whichrow=0) const
103 { return table_->getMask(whichrow); }
[2]104
[1430]105 /**
[1000]106 void flag(const std::vector<bool>& msk=std::vector<bool>())
107 { table_->flag(msk); }
[1430]108 **/
109 void flag(const std::vector<bool>& msk=std::vector<bool>(), bool unflag=false)
110 { table_->flag(msk, unflag); }
[2]111
[1819]112 void flagRow(const std::vector<casa::uInt>& rows=std::vector<casa::uInt>(), bool unflag=false)
113 { table_->flagRow(rows, unflag); }
114
115 bool getFlagRow(int whichrow=0) const
116 { return table_->getFlagRow(whichrow); }
117
118 void clip(const casa::Float uthres, const casa::Float dthres, bool clipoutside=true, bool unflag=false)
119 { table_->clip(uthres, dthres, clipoutside, unflag); }
120
121 std::vector<bool> getClipMask(int whichrow, const casa::Float uthres, const casa::Float dthres, bool clipoutside, bool unflag) const
122 { return table_->getClipMask(whichrow, uthres, dthres, clipoutside, unflag); }
123
[896]124 std::string getSourceName(int whichrow=0) const
125 { return table_->getSourceName(whichrow); }
[794]126
[896]127 float getElevation(int whichrow=0) const
128 { return table_->getElevation(whichrow); }
[90]129
[896]130 float getAzimuth(int whichrow=0) const
131 { return table_->getAzimuth(whichrow); }
[2]132
[896]133 float getParAngle(int whichrow=0) const
134 { return table_->getParAngle(whichrow); }
[2]135
[864]136
[884]137 void setSpectrum(std::vector<float> spectrum, int whichrow=0)
138 { table_->setSpectrum(spectrum, whichrow); }
[868]139
[1111]140 std::vector<uint> getIFNos() { return table_->getIFNos(); }
[864]141 int getIF(int whichrow) const {return table_->getIF(whichrow);}
[1111]142 std::vector<uint> getBeamNos() { return table_->getBeamNos(); }
[864]143 int getBeam(int whichrow) const {return table_->getBeam(whichrow);}
[1111]144 std::vector<uint> getPolNos() { return table_->getPolNos(); }
[864]145 int getPol(int whichrow) const {return table_->getPol(whichrow);}
[868]146 int getCycle(int whichrow) const {return table_->getCycle(whichrow);}
[1111]147 std::vector<uint> getScanNos() { return table_->getScanNos(); }
[868]148 int getScan(int whichrow) const {return table_->getScan(whichrow);}
[1819]149 std::vector<uint> getMolNos() { return table_->getMolNos();}
[864]150
151 STSelector getSelection() const { return table_->getSelection(); }
[868]152 void setSelection(const STSelector& sts)
153 { return table_->setSelection(sts);}
[864]154
[896]155 std::string getPolType() const { return table_->getPolType(); }
156
[864]157 int nif(int scanno=-1) const {return table_->nif(scanno);}
158 int nbeam(int scanno=-1) const {return table_->nbeam(scanno);}
159 int npol(int scanno=-1) const {return table_->npol(scanno);}
160 int nchan(int ifno=-1) const {return table_->nchan(ifno);}
161 int nscan() const {return table_->nscan();}
162 int nrow() const {return table_->nrow();}
[902]163 int ncycle(int scanno) const {return table_->ncycle(scanno);}
[2]164
[864]165 void makePersistent(const std::string& fname)
166 { table_->makePersistent(fname); }
[90]167
[1068]168 void setSourceType(int stype)
169 { table_->setSourceType(stype); }
170
[1360]171 void shift(int npix)
172 { table_->shift(npix); }
173
[1819]174/**
175 commented out by TT
[1170]176 void setRestFrequencies(double rf, const std::string& name,
177 const std::string& unit)
178 { table_->setRestFrequencies(rf, name, unit); }
[1819]179**/
180 void setRestFrequencies(vector<double> rf, const vector<std::string>& name,
181 const std::string& unit)
182 { table_->setRestFrequencies(rf, name, unit); }
183
[925]184/*
[868]185 void setRestFrequencies(const std::string& name) {
186 table_->setRestFrequencies(name);
[847]187 }
[925]188*/
[745]189
[1819]190/*
[864]191 std::vector<double> getRestFrequencies() const
192 { return table_->getRestFrequencies(); }
[1819]193*/
194 std::vector<double> getRestFrequency(int id) const
195 { return table_->getRestFrequency(id); }
[251]196
[105]197 void setCoordInfo(std::vector<string> theinfo) {
198 table_->setCoordInfo(theinfo);
199 }
200 std::vector<string> getCoordInfo() const {
201 return table_->getCoordInfo();
202 }
[90]203
[987]204 void setDirection(const std::string& refstr="")
205 { table_->setDirectionRefString(refstr); }
206
[847]207 casa::CountedPtr<Scantable> getCP() const {return table_;}
208 Scantable* getPtr() {return &(*table_);}
[380]209
[745]210 std::string summary(bool verbose=false) const {
211 return table_->summary(verbose);
[380]212 }
[745]213
[864]214 std::vector<std::string> getHistory()const
215 { return table_->getHistory(); }
[207]216
[864]217 void addHistory(const std::string& hist)
218 { table_->addHistory(hist); }
[745]219
[972]220 void addFit(const STFitEntry& fit, int row)
221 { table_->addFit(fit, row); }
222
223 STFitEntry getFit(int whichrow) const
224 { return table_->getFit(whichrow); }
225
[777]226 void calculateAZEL() { table_->calculateAZEL(); };
[465]227
[1003]228 std::vector<std::string> columnNames() const
229 { return table_->columnNames(); }
230
[1391]231 std::string getAntennaName() const
232 { return table_->getAntennaName(); }
233
234 int checkScanInfo(const vector<int>& scanlist) const
235 { return table_->checkScanInfo(scanlist); }
[1819]236
[1730]237 std::vector<double> getDirectionVector(int whichrow) const
[1391]238 { return table_->getDirectionVector(whichrow); }
239
[1586]240 void parallactify(bool flag)
241 { table_->parallactify(flag); }
242
[1598]243 STCoordinate getCoordinate(int row) {
244 return STCoordinate(table_->getSpectralCoordinate(row));
245 }
246
[1730]247 std::vector<float> getWeather(int whichrow) const
248 { return table_->getWeather(whichrow); }
249
[1819]250 void reshapeSpectrum( int nmin, int nmax )
251 { table_->reshapeSpectrum( nmin, nmax ); }
252
[1924]253 STFitEntry polyBaseline(const std::vector<bool>& mask, int order, int rowno)
254 { return table_->polyBaseline(mask, order, rowno); }
[1907]255
[1924]256 void polyBaselineBatch(const std::vector<bool>& mask, int order)
257 { table_->polyBaselineBatch(mask, order); }
[1907]258
259 bool getFlagtraFast(int whichrow=0) const
260 { return table_->getFlagtraFast(whichrow); }
261
262
[2]263private:
[847]264 casa::CountedPtr<Scantable> table_;
[2]265};
266
267} // namespace
268#endif
[1819]269
Note: See TracBrowser for help on using the repository browser.