source: branches/alma/src/ScantableWrapper.h@ 2179

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

New Development: Yes

JIRA Issue: Yes (CAS-2211)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: ASAP 3.0.0 interface changes

Test Programs:

Put in Release Notes: Yes

Module(s): all the CASA sd tools and tasks are affected.

Description: Merged ATNF-ASAP 3.0.0 developments to CASA (alma) branch.

Note you also need to update casa/code/atnf.


  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.9 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"
[847]21#include "Scantable.h"
[1757]22#include "STCoordinate.h"
[2]23
[83]24namespace asap {
[847]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 {
[2]37
38public:
[1385]39 explicit ScantableWrapper( const std::string& name,
[1077]40 int type=0)
[864]41 {
42 casa::Table::TableType tp = casa::Table::Memory;
[1077]43 if ( type == 1 ) tp = casa::Table::Plain;
[864]44 table_ = new Scantable(name, tp);
45 }
[90]46
[1350]47 explicit ScantableWrapper(int type=0)
[864]48 {
49 casa::Table::TableType tp = casa::Table::Memory;
[1077]50 if ( type == 1) tp = casa::Table::Plain;
[864]51 table_= new Scantable(tp);
52 }
[90]53
[1350]54 explicit ScantableWrapper(casa::CountedPtr<Scantable> cp) : table_(cp) {;}
[90]55
[847]56 ScantableWrapper(const ScantableWrapper& mt) :
57 table_(mt.getCP()) {;}
[90]58
[868]59 void assign(const ScantableWrapper& mt)
60 { table_= mt.getCP(); }
61
[847]62 ScantableWrapper copy() {
63 return ScantableWrapper(new Scantable(*(this->getCP()), false));
[80]64 }
[868]65
[896]66 std::vector<float> getSpectrum( int whichrow=0,
[905]67 const std::string& poltype="" ) const {
[896]68 return table_->getSpectrum(whichrow, poltype);
[2]69 }
[527]70 // std::string getPolarizationLabel(bool linear, bool stokes, bool linPol, int polIdx) const {
71 // Boost fails with 4 arguments.
[902]72 std::string getPolarizationLabel(int index, const std::string& ptype) const {
73 return table_->getPolarizationLabel(index, ptype);
[494]74 }
[527]75
[896]76 std::vector<double> getAbcissa(int whichrow=0) const
77 { return table_->getAbcissa(whichrow); }
[41]78
[896]79 std::string getAbcissaLabel(int whichrow=0) const
80 { return table_->getAbcissaLabel(whichrow); }
[157]81
[896]82 float getTsys(int whichrow=0) const
83 { return table_->getTsys(whichrow); }
[2]84
[896]85 std::string getTime(int whichrow=0) const
86 { return table_->getTime(whichrow); }
[207]87
[1350]88 double getIntTime(int whichrow=0) const
89 { return table_->getIntTime(whichrow); }
90
[1068]91 std::string getDirectionString(int whichrow=0) const
92 { return table_->getDirectionString(whichrow); }
93
[864]94 std::string getFluxUnit() const { return table_->getFluxUnit(); }
95
96 void setFluxUnit(const std::string& unit) { table_->setFluxUnit(unit); }
97
[238]98 void setInstrument(const std::string& name) {table_->setInstrument(name);}
[1189]99 void setFeedType(const std::string& ftype) {table_->setFeedType(ftype);}
[238]100
[896]101 std::vector<bool> getMask(int whichrow=0) const
102 { return table_->getMask(whichrow); }
[2]103
[1400]104 /**
[1000]105 void flag(const std::vector<bool>& msk=std::vector<bool>())
106 { table_->flag(msk); }
[1400]107 **/
108 void flag(const std::vector<bool>& msk=std::vector<bool>(), bool unflag=false)
109 { table_->flag(msk, unflag); }
[2]110
[1656]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
[1703]117 void clip(const casa::Float uthres, const casa::Float dthres, bool clipoutside=true, bool unflag=false)
[1700]118 { table_->clip(uthres, dthres, clipoutside, unflag); }
119
[1707]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
[896]123 std::string getSourceName(int whichrow=0) const
124 { return table_->getSourceName(whichrow); }
[794]125
[896]126 float getElevation(int whichrow=0) const
127 { return table_->getElevation(whichrow); }
[90]128
[896]129 float getAzimuth(int whichrow=0) const
130 { return table_->getAzimuth(whichrow); }
[2]131
[896]132 float getParAngle(int whichrow=0) const
133 { return table_->getParAngle(whichrow); }
[2]134
[864]135
[884]136 void setSpectrum(std::vector<float> spectrum, int whichrow=0)
137 { table_->setSpectrum(spectrum, whichrow); }
[868]138
[1111]139 std::vector<uint> getIFNos() { return table_->getIFNos(); }
[864]140 int getIF(int whichrow) const {return table_->getIF(whichrow);}
[1111]141 std::vector<uint> getBeamNos() { return table_->getBeamNos(); }
[864]142 int getBeam(int whichrow) const {return table_->getBeam(whichrow);}
[1111]143 std::vector<uint> getPolNos() { return table_->getPolNos(); }
[864]144 int getPol(int whichrow) const {return table_->getPol(whichrow);}
[868]145 int getCycle(int whichrow) const {return table_->getCycle(whichrow);}
[1111]146 std::vector<uint> getScanNos() { return table_->getScanNos(); }
[868]147 int getScan(int whichrow) const {return table_->getScan(whichrow);}
[1446]148 std::vector<uint> getMolNos() { return table_->getMolNos();}
[864]149
150 STSelector getSelection() const { return table_->getSelection(); }
[868]151 void setSelection(const STSelector& sts)
152 { return table_->setSelection(sts);}
[864]153
[896]154 std::string getPolType() const { return table_->getPolType(); }
155
[864]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();}
[902]162 int ncycle(int scanno) const {return table_->ncycle(scanno);}
[2]163
[864]164 void makePersistent(const std::string& fname)
165 { table_->makePersistent(fname); }
[90]166
[1068]167 void setSourceType(int stype)
168 { table_->setSourceType(stype); }
169
[1360]170 void shift(int npix)
171 { table_->shift(npix); }
172
[1446]173/**
174 commented out by TT
[1170]175 void setRestFrequencies(double rf, const std::string& name,
176 const std::string& unit)
177 { table_->setRestFrequencies(rf, name, unit); }
[1446]178**/
179 void setRestFrequencies(vector<double> rf, const vector<std::string>& name,
180 const std::string& unit)
181 { table_->setRestFrequencies(rf, name, unit); }
182
[925]183/*
[868]184 void setRestFrequencies(const std::string& name) {
185 table_->setRestFrequencies(name);
[847]186 }
[925]187*/
[745]188
[1446]189/*
[864]190 std::vector<double> getRestFrequencies() const
191 { return table_->getRestFrequencies(); }
[1446]192*/
193 std::vector<double> getRestFrequency(int id) const
194 { return table_->getRestFrequency(id); }
[251]195
[105]196 void setCoordInfo(std::vector<string> theinfo) {
197 table_->setCoordInfo(theinfo);
198 }
199 std::vector<string> getCoordInfo() const {
200 return table_->getCoordInfo();
201 }
[90]202
[987]203 void setDirection(const std::string& refstr="")
204 { table_->setDirectionRefString(refstr); }
205
[847]206 casa::CountedPtr<Scantable> getCP() const {return table_;}
207 Scantable* getPtr() {return &(*table_);}
[380]208
[745]209 std::string summary(bool verbose=false) const {
210 return table_->summary(verbose);
[380]211 }
[745]212
[864]213 std::vector<std::string> getHistory()const
214 { return table_->getHistory(); }
[207]215
[864]216 void addHistory(const std::string& hist)
217 { table_->addHistory(hist); }
[745]218
[972]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
[777]225 void calculateAZEL() { table_->calculateAZEL(); };
[465]226
[1003]227 std::vector<std::string> columnNames() const
228 { return table_->columnNames(); }
229
[1388]230 std::string getAntennaName() const
231 { return table_->getAntennaName(); }
232
233 int checkScanInfo(const vector<int>& scanlist) const
234 { return table_->checkScanInfo(scanlist); }
[1446]235
[1757]236 std::vector<double> getDirectionVector(int whichrow) const
[1388]237 { return table_->getDirectionVector(whichrow); }
238
[1757]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
[1446]249 void reshapeSpectrum( int nmin, int nmax )
250 { table_->reshapeSpectrum( nmin, nmax ); }
251
[2]252private:
[847]253 casa::CountedPtr<Scantable> table_;
[2]254};
255
256} // namespace
257#endif
[421]258
Note: See TracBrowser for help on using the repository browser.