source: branches/Release2.0/src/ScantableWrapper.h@ 2382

Last change on this file since 2382 was 1003, checked in by mar637, 19 years ago

added column_names()

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.5 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 "Scantable.h"
22
23namespace asap {
24/**
25 * This class contains and wraps a CountedPtr<Scantable>, as the CountedPtr
26 * class does not provide the dor operator which is need for references
27 * in boost::python
28 * see Scantable for interfce description
29 *
30 * @brief The main ASAP data container wrapper
31 * @author Malte Marquarding
32 * @date 2006-02-23
33 * @version 2.0a
34*/
35class ScantableWrapper {
36
37public:
38 ScantableWrapper( const std::string& name,
39 const std::string& type="")
40 {
41 casa::Table::TableType tp = casa::Table::Memory;
42 if ( type == "disk") tp = casa::Table::Plain;
43 table_ = new Scantable(name, tp);
44 }
45
46 ScantableWrapper(const std::string& type="")
47 {
48 casa::Table::TableType tp = casa::Table::Memory;
49 if ( type == "disk") tp = casa::Table::Plain;
50 table_= new Scantable(tp);
51 }
52
53 ScantableWrapper(casa::CountedPtr<Scantable> cp) : table_(cp) {;}
54
55 ScantableWrapper(const ScantableWrapper& mt) :
56 table_(mt.getCP()) {;}
57
58 void assign(const ScantableWrapper& mt)
59 { table_= mt.getCP(); }
60
61 ScantableWrapper copy() {
62 return ScantableWrapper(new Scantable(*(this->getCP()), false));
63 }
64
65 std::vector<float> getSpectrum( int whichrow=0,
66 const std::string& poltype="" ) const {
67 return table_->getSpectrum(whichrow, poltype);
68 }
69 // std::string getPolarizationLabel(bool linear, bool stokes, bool linPol, int polIdx) const {
70 // Boost fails with 4 arguments.
71 std::string getPolarizationLabel(int index, const std::string& ptype) const {
72 return table_->getPolarizationLabel(index, ptype);
73 }
74
75 std::vector<double> getAbcissa(int whichrow=0) const
76 { return table_->getAbcissa(whichrow); }
77
78 std::string getAbcissaLabel(int whichrow=0) const
79 { return table_->getAbcissaLabel(whichrow); }
80
81 float getTsys(int whichrow=0) const
82 { return table_->getTsys(whichrow); }
83
84 std::string getTime(int whichrow=0) const
85 { return table_->getTime(whichrow); }
86
87 std::string getFluxUnit() const { return table_->getFluxUnit(); }
88
89 void setFluxUnit(const std::string& unit) { table_->setFluxUnit(unit); }
90
91 void setInstrument(const std::string& name) {table_->setInstrument(name);}
92
93 std::vector<bool> getMask(int whichrow=0) const
94 { return table_->getMask(whichrow); }
95
96 void flag(const std::vector<bool>& msk=std::vector<bool>())
97 { table_->flag(msk); }
98
99 std::string getSourceName(int whichrow=0) const
100 { return table_->getSourceName(whichrow); }
101
102 float getElevation(int whichrow=0) const
103 { return table_->getElevation(whichrow); }
104
105 float getAzimuth(int whichrow=0) const
106 { return table_->getAzimuth(whichrow); }
107
108 float getParAngle(int whichrow=0) const
109 { return table_->getParAngle(whichrow); }
110
111
112 void setSpectrum(std::vector<float> spectrum, int whichrow=0)
113 { table_->setSpectrum(spectrum, whichrow); }
114
115 int getIF(int whichrow) const {return table_->getIF(whichrow);}
116 int getBeam(int whichrow) const {return table_->getBeam(whichrow);}
117 int getPol(int whichrow) const {return table_->getPol(whichrow);}
118 int getCycle(int whichrow) const {return table_->getCycle(whichrow);}
119 int getScan(int whichrow) const {return table_->getScan(whichrow);}
120
121 STSelector getSelection() const { return table_->getSelection(); }
122 void setSelection(const STSelector& sts)
123 { return table_->setSelection(sts);}
124
125 std::string getPolType() const { return table_->getPolType(); }
126
127 int nif(int scanno=-1) const {return table_->nif(scanno);}
128 int nbeam(int scanno=-1) const {return table_->nbeam(scanno);}
129 int npol(int scanno=-1) const {return table_->npol(scanno);}
130 int nchan(int ifno=-1) const {return table_->nchan(ifno);}
131 int nscan() const {return table_->nscan();}
132 int nrow() const {return table_->nrow();}
133 int ncycle(int scanno) const {return table_->ncycle(scanno);}
134
135 void makePersistent(const std::string& fname)
136 { table_->makePersistent(fname); }
137
138 void setRestFrequencies(double rf, const std::string& unit)
139 { table_->setRestFrequencies(rf, unit); }
140/*
141 void setRestFrequencies(const std::string& name) {
142 table_->setRestFrequencies(name);
143 }
144*/
145
146 std::vector<double> getRestFrequencies() const
147 { return table_->getRestFrequencies(); }
148
149 void setCoordInfo(std::vector<string> theinfo) {
150 table_->setCoordInfo(theinfo);
151 }
152 std::vector<string> getCoordInfo() const {
153 return table_->getCoordInfo();
154 }
155
156 void setDirection(const std::string& refstr="")
157 { table_->setDirectionRefString(refstr); }
158
159 casa::CountedPtr<Scantable> getCP() const {return table_;}
160 Scantable* getPtr() {return &(*table_);}
161
162 std::string summary(bool verbose=false) const {
163 return table_->summary(verbose);
164 }
165
166 std::vector<std::string> getHistory()const
167 { return table_->getHistory(); }
168
169 void addHistory(const std::string& hist)
170 { table_->addHistory(hist); }
171
172 void addFit(const STFitEntry& fit, int row)
173 { table_->addFit(fit, row); }
174
175 STFitEntry getFit(int whichrow) const
176 { return table_->getFit(whichrow); }
177
178 void calculateAZEL() { table_->calculateAZEL(); };
179
180 std::vector<std::string> columnNames() const
181 { return table_->columnNames(); }
182
183private:
184 casa::CountedPtr<Scantable> table_;
185};
186
187} // namespace
188#endif
189
Note: See TracBrowser for help on using the repository browser.