source: trunk/src/ScantableWrapper.h@ 2811

Last change on this file since 2811 was 2811, checked in by WataruKawasaki, 12 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: parameter of tool functions

Test Programs:

Put in Release Notes: No

Module(s): sd.scantable

Description: add a new parameter 'retfitres' to sd.scantable.apply_bltable() and sd.scantable.sub_baseline().


  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 14.7 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
[2587]15#include <iostream>
16#include <string>
[2]17#include <vector>
[2587]18
[380]19#include <casa/Arrays/Vector.h>
[2]20
[465]21#include "MathUtils.h"
[2587]22#include "Scantable.h"
23#include "STCoordinate.h"
[901]24#include "STFit.h"
[1931]25#include "STFitEntry.h"
[2]26
[83]27namespace asap {
[847]28/**
29 * This class contains and wraps a CountedPtr<Scantable>, as the CountedPtr
30 * class does not provide the dor operator which is need for references
31 * in boost::python
32 * see Scantable for interfce description
33 *
34 * @brief The main ASAP data container wrapper
35 * @author Malte Marquarding
36 * @date 2006-02-23
37 * @version 2.0a
38*/
39class ScantableWrapper {
[2]40
41public:
[1385]42 explicit ScantableWrapper( const std::string& name,
[1077]43 int type=0)
[864]44 {
45 casa::Table::TableType tp = casa::Table::Memory;
[1077]46 if ( type == 1 ) tp = casa::Table::Plain;
[864]47 table_ = new Scantable(name, tp);
48 }
[90]49
[1350]50 explicit ScantableWrapper(int type=0)
[864]51 {
52 casa::Table::TableType tp = casa::Table::Memory;
[1077]53 if ( type == 1) tp = casa::Table::Plain;
[864]54 table_= new Scantable(tp);
55 }
[90]56
[1350]57 explicit ScantableWrapper(casa::CountedPtr<Scantable> cp) : table_(cp) {;}
[90]58
[847]59 ScantableWrapper(const ScantableWrapper& mt) :
60 table_(mt.getCP()) {;}
[90]61
[2587]62 ~ScantableWrapper()
63 {
64 }
65
[868]66 void assign(const ScantableWrapper& mt)
67 { table_= mt.getCP(); }
68
[847]69 ScantableWrapper copy() {
70 return ScantableWrapper(new Scantable(*(this->getCP()), false));
[80]71 }
[868]72
[896]73 std::vector<float> getSpectrum( int whichrow=0,
[905]74 const std::string& poltype="" ) const {
[896]75 return table_->getSpectrum(whichrow, poltype);
[2]76 }
[527]77 // std::string getPolarizationLabel(bool linear, bool stokes, bool linPol, int polIdx) const {
78 // Boost fails with 4 arguments.
[902]79 std::string getPolarizationLabel(int index, const std::string& ptype) const {
80 return table_->getPolarizationLabel(index, ptype);
[494]81 }
[527]82
[896]83 std::vector<double> getAbcissa(int whichrow=0) const
84 { return table_->getAbcissa(whichrow); }
[41]85
[896]86 std::string getAbcissaLabel(int whichrow=0) const
87 { return table_->getAbcissaLabel(whichrow); }
[157]88
[896]89 float getTsys(int whichrow=0) const
90 { return table_->getTsys(whichrow); }
[2]91
[2161]92 std::vector<float> getTsysSpectrum(int whichrow=0) const
93 { return table_->getTsysSpectrum(whichrow); }
94
[2791]95 void setTsys(const std::vector<float>& newvals, int whichrow=-1)
96 { return table_->setTsys(newvals, whichrow); }
97
[1947]98 //std::string getTime(int whichrow=0) const
99 // { return table_->getTime(whichrow); }
100 std::string getTime(int whichrow=0, int prec = 0) const
101 { return table_->getTime(whichrow, true, casa::uInt(prec)); }
[207]102
[1350]103 double getIntTime(int whichrow=0) const
104 { return table_->getIntTime(whichrow); }
105
[1068]106 std::string getDirectionString(int whichrow=0) const
107 { return table_->getDirectionString(whichrow); }
108
[864]109 std::string getFluxUnit() const { return table_->getFluxUnit(); }
110
111 void setFluxUnit(const std::string& unit) { table_->setFluxUnit(unit); }
112
[238]113 void setInstrument(const std::string& name) {table_->setInstrument(name);}
[1189]114 void setFeedType(const std::string& ftype) {table_->setFeedType(ftype);}
[238]115
[896]116 std::vector<bool> getMask(int whichrow=0) const
117 { return table_->getMask(whichrow); }
[2]118
[1430]119 /**
[1000]120 void flag(const std::vector<bool>& msk=std::vector<bool>())
121 { table_->flag(msk); }
[1430]122 **/
[1994]123 /**
[1430]124 void flag(const std::vector<bool>& msk=std::vector<bool>(), bool unflag=false)
125 { table_->flag(msk, unflag); }
[1994]126 **/
127 void flag(int whichrow=-1, const std::vector<bool>& msk=std::vector<bool>(), bool unflag=false)
128 { table_->flag(whichrow, msk, unflag); }
[2]129
[1819]130 void flagRow(const std::vector<casa::uInt>& rows=std::vector<casa::uInt>(), bool unflag=false)
131 { table_->flagRow(rows, unflag); }
132
133 bool getFlagRow(int whichrow=0) const
134 { return table_->getFlagRow(whichrow); }
135
136 void clip(const casa::Float uthres, const casa::Float dthres, bool clipoutside=true, bool unflag=false)
137 { table_->clip(uthres, dthres, clipoutside, unflag); }
138
139 std::vector<bool> getClipMask(int whichrow, const casa::Float uthres, const casa::Float dthres, bool clipoutside, bool unflag) const
140 { return table_->getClipMask(whichrow, uthres, dthres, clipoutside, unflag); }
141
[896]142 std::string getSourceName(int whichrow=0) const
143 { return table_->getSourceName(whichrow); }
[794]144
[896]145 float getElevation(int whichrow=0) const
146 { return table_->getElevation(whichrow); }
[90]147
[896]148 float getAzimuth(int whichrow=0) const
149 { return table_->getAzimuth(whichrow); }
[2]150
[896]151 float getParAngle(int whichrow=0) const
152 { return table_->getParAngle(whichrow); }
[2]153
[864]154
[884]155 void setSpectrum(std::vector<float> spectrum, int whichrow=0)
156 { table_->setSpectrum(spectrum, whichrow); }
[868]157
[1111]158 std::vector<uint> getIFNos() { return table_->getIFNos(); }
[864]159 int getIF(int whichrow) const {return table_->getIF(whichrow);}
[1111]160 std::vector<uint> getBeamNos() { return table_->getBeamNos(); }
[864]161 int getBeam(int whichrow) const {return table_->getBeam(whichrow);}
[1111]162 std::vector<uint> getPolNos() { return table_->getPolNos(); }
[864]163 int getPol(int whichrow) const {return table_->getPol(whichrow);}
[2667]164 std::vector<uint> getCycleNos() { return table_->getCycleNos(); }
[868]165 int getCycle(int whichrow) const {return table_->getCycle(whichrow);}
[1111]166 std::vector<uint> getScanNos() { return table_->getScanNos(); }
[868]167 int getScan(int whichrow) const {return table_->getScan(whichrow);}
[1819]168 std::vector<uint> getMolNos() { return table_->getMolNos();}
[864]169
170 STSelector getSelection() const { return table_->getSelection(); }
[868]171 void setSelection(const STSelector& sts)
172 { return table_->setSelection(sts);}
[864]173
[896]174 std::string getPolType() const { return table_->getPolType(); }
175
[864]176 int nif(int scanno=-1) const {return table_->nif(scanno);}
177 int nbeam(int scanno=-1) const {return table_->nbeam(scanno);}
178 int npol(int scanno=-1) const {return table_->npol(scanno);}
179 int nchan(int ifno=-1) const {return table_->nchan(ifno);}
180 int nscan() const {return table_->nscan();}
181 int nrow() const {return table_->nrow();}
[902]182 int ncycle(int scanno) const {return table_->ncycle(scanno);}
[2]183
[864]184 void makePersistent(const std::string& fname)
185 { table_->makePersistent(fname); }
[90]186
[1068]187 void setSourceType(int stype)
188 { table_->setSourceType(stype); }
189
[1360]190 void shift(int npix)
191 { table_->shift(npix); }
192
[1819]193/**
194 commented out by TT
[1170]195 void setRestFrequencies(double rf, const std::string& name,
196 const std::string& unit)
197 { table_->setRestFrequencies(rf, name, unit); }
[1819]198**/
199 void setRestFrequencies(vector<double> rf, const vector<std::string>& name,
200 const std::string& unit)
201 { table_->setRestFrequencies(rf, name, unit); }
202
[925]203/*
[868]204 void setRestFrequencies(const std::string& name) {
205 table_->setRestFrequencies(name);
[847]206 }
[925]207*/
[745]208
[1819]209/*
[864]210 std::vector<double> getRestFrequencies() const
211 { return table_->getRestFrequencies(); }
[1819]212*/
213 std::vector<double> getRestFrequency(int id) const
214 { return table_->getRestFrequency(id); }
[251]215
[105]216 void setCoordInfo(std::vector<string> theinfo) {
217 table_->setCoordInfo(theinfo);
218 }
219 std::vector<string> getCoordInfo() const {
220 return table_->getCoordInfo();
221 }
[90]222
[987]223 void setDirection(const std::string& refstr="")
224 { table_->setDirectionRefString(refstr); }
225
[847]226 casa::CountedPtr<Scantable> getCP() const {return table_;}
227 Scantable* getPtr() {return &(*table_);}
[380]228
[2286]229 // std::string summary() const {
230 // return table_->summary();
231 // }
232 void summary(const std::string& filename="") {
[2290]233 //std::string summary(const std::string& filename="") const {
234 table_->summary(filename);
[380]235 }
[745]236
[2178]237 std::string listHeader() const {
[2163]238 return table_->headerSummary();
[2111]239 }
240
[2163]241 std::vector<std::string> getHistory() const
[864]242 { return table_->getHistory(); }
[207]243
[864]244 void addHistory(const std::string& hist)
245 { table_->addHistory(hist); }
[745]246
[972]247 void addFit(const STFitEntry& fit, int row)
248 { table_->addFit(fit, row); }
249
250 STFitEntry getFit(int whichrow) const
251 { return table_->getFit(whichrow); }
252
[2012]253 void calculateAZEL() { table_->calculateAZEL(); }
[465]254
[1003]255 std::vector<std::string> columnNames() const
256 { return table_->columnNames(); }
257
[1391]258 std::string getAntennaName() const
259 { return table_->getAntennaName(); }
260
261 int checkScanInfo(const vector<int>& scanlist) const
262 { return table_->checkScanInfo(scanlist); }
[1819]263
[1730]264 std::vector<double> getDirectionVector(int whichrow) const
[1391]265 { return table_->getDirectionVector(whichrow); }
266
[1586]267 void parallactify(bool flag)
268 { table_->parallactify(flag); }
269
[1598]270 STCoordinate getCoordinate(int row) {
271 return STCoordinate(table_->getSpectralCoordinate(row));
272 }
273
[1730]274 std::vector<float> getWeather(int whichrow) const
275 { return table_->getWeather(whichrow); }
276
[1819]277 void reshapeSpectrum( int nmin, int nmax )
278 { table_->reshapeSpectrum( nmin, nmax ); }
279
[2435]280 void regridSpecChannel( double dnu, int nchan )
281 { table_->regridSpecChannel( dnu, nchan ); }
282
[2811]283 std::vector<std::string> applyBaselineTable(const std::string& bltable, const bool returnfitresult, const std::string& outbltable, const bool outbltableexists, const bool overwrite)
284 { return table_->applyBaselineTable(bltable, returnfitresult, outbltable, outbltableexists, overwrite); }
285 std::vector<std::string> subBaseline(const std::vector<std::string>& blinfo, const bool returnfitresult, const std::string& outbltable, const bool outbltableexists, const bool overwrite)
286 { return table_->subBaseline(blinfo, returnfitresult, outbltable, outbltableexists, overwrite); }
[2767]287 void polyBaseline(const std::vector<bool>& mask, int order, float clipthresh, int clipniter, bool getresidual=true, const std::string& showprogress="true,1000", const bool outlog=false, const std::string& blfile="", const std::string& bltable="")
288 { table_->polyBaseline(mask, order, clipthresh, clipniter, getresidual, showprogress, outlog, blfile, bltable); }
[1907]289
[2767]290 void autoPolyBaseline(const std::vector<bool>& mask, int order, float clipthresh, int clipniter, const std::vector<int>& edge, float threshold=5.0, int chan_avg_limit=1, bool getresidual=true, const std::string& showprogress="true,1000", const bool outlog=false, const std::string& blfile="", const std::string& bltable="")
291 { table_->autoPolyBaseline(mask, order, clipthresh, clipniter, edge, threshold, chan_avg_limit, getresidual, showprogress, outlog, blfile, bltable); }
[1907]292
[2767]293 void chebyshevBaseline(const std::vector<bool>& mask, int order, float clipthresh, int clipniter, bool getresidual=true, const std::string& showprogress="true,1000", const bool outlog=false, const std::string& blfile="", const std::string& bltable="")
294 { table_->chebyshevBaseline(mask, order, clipthresh, clipniter, getresidual, showprogress, outlog, blfile, bltable); }
[2645]295
[2767]296 void autoChebyshevBaseline(const std::vector<bool>& mask, int order, float clipthresh, int clipniter, const std::vector<int>& edge, float threshold=5.0, int chan_avg_limit=1, bool getresidual=true, const std::string& showprogress="true,1000", const bool outlog=false, const std::string& blfile="", const std::string& bltable="")
297 { table_->autoChebyshevBaseline(mask, order, clipthresh, clipniter, edge, threshold, chan_avg_limit, getresidual, showprogress, outlog, blfile, bltable); }
[2645]298
[2767]299 void cubicSplineBaseline(const std::vector<bool>& mask, int npiece, float clipthresh, int clipniter, bool getresidual=true, const std::string& showprogress="true,1000", const bool outlog=false, const std::string& blfile="", const std::string& bltable="")
300 { table_->cubicSplineBaseline(mask, npiece, clipthresh, clipniter, getresidual, showprogress, outlog, blfile, bltable); }
[2012]301
[2767]302 void autoCubicSplineBaseline(const std::vector<bool>& mask, int npiece, float clipthresh, int clipniter, const std::vector<int>& edge, float threshold=5.0, int chan_avg_limit=1, bool getresidual=true, const std::string& showprogress="true,1000", const bool outlog=false, const std::string& blfile="", const std::string& bltable="")
303 { table_->autoCubicSplineBaseline(mask, npiece, clipthresh, clipniter, edge, threshold, chan_avg_limit, getresidual, showprogress, outlog, blfile, bltable); }
[2012]304
[2767]305 void sinusoidBaseline(const std::vector<bool>& mask, const std::string& fftinfo, const std::vector<int>& addwn, const std::vector<int>& rejwn, float clipthresh, int clipniter, bool getresidual=true, const std::string& showprogress="true,1000", const bool outlog=false, const std::string& blfile="", const std::string& bltable="")
306 { table_->sinusoidBaseline(mask, fftinfo, addwn, rejwn, clipthresh, clipniter, getresidual, showprogress, outlog, blfile, bltable); }
[2047]307
[2767]308 void autoSinusoidBaseline(const std::vector<bool>& mask, const std::string& fftinfo, const std::vector<int>& addwn, const std::vector<int>& rejwn, float clipthresh, int clipniter, const std::vector<int>& edge, float threshold=5.0, int chan_avg_limit=1, bool getresidual=true, const std::string& showprogress="true,1000", const bool outlog=false, const std::string& blfile="", const std::string& bltable="")
309 { table_->autoSinusoidBaseline(mask, fftinfo, addwn, rejwn, clipthresh, clipniter, edge, threshold, chan_avg_limit, getresidual, showprogress, outlog, blfile, bltable); }
[2047]310
[2012]311 float getRms(const std::vector<bool>& mask, int whichrow)
312 { return table_->getRms(mask, whichrow); }
313
[2641]314 std::string formatBaselineParams(const std::vector<float>& params, const std::vector<bool>& fixed, float rms, const std::string& masklist, int whichrow, bool verbose=false, bool csvformat=false)
315 { return table_->formatBaselineParams(params, fixed, rms, -1, masklist, whichrow, verbose, csvformat); }
[2012]316
[2641]317 std::string formatPiecewiseBaselineParams(const std::vector<int>& ranges, const std::vector<float>& params, const std::vector<bool>& fixed, float rms, const std::string& masklist, int whichrow, bool verbose=false, bool csvformat=false)
318 { return table_->formatPiecewiseBaselineParams(ranges, params, fixed, rms, -1, masklist, whichrow, verbose, csvformat); }
[2012]319
[1907]320 bool getFlagtraFast(int whichrow=0) const
[2047]321 { return table_->getFlagtraFast(casa::uInt(whichrow)); }
[1907]322
[2186]323 std::vector<float> execFFT(int whichrow, const std::vector<bool>& mask, bool getRealImag=false, bool getAmplitudeOnly=false)
324 { return table_->execFFT(whichrow, mask, getRealImag, getAmplitudeOnly); }
[1907]325
[2591]326 std::vector<uint> getMoleculeIdColumnData() const
327 { return table_->getMoleculeIdColumnData(); }
328 void setMoleculeIdColumnData(const std::vector<uint>& molids)
329 { table_->setMoleculeIdColumnData(molids); }
[2713]330 double calculateModelSelectionCriteria(const std::string& valname, const std::string& blfunc, int order, const std::vector<bool>& inMask, int whichrow, bool useLineFinder, const std::vector<int>& edge, float threshold, int chanAvgLimit)
331 { return table_->calculateModelSelectionCriteria(valname, blfunc, order, inMask, whichrow, useLineFinder, edge, threshold, chanAvgLimit); }
[2012]332
[2789]333 void dropXPol() { table_->dropXPol(); }
334
[2]335private:
[847]336 casa::CountedPtr<Scantable> table_;
[2]337};
338
339} // namespace
340#endif
Note: See TracBrowser for help on using the repository browser.