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

Last change on this file since 1703 was 1703, checked in by Takeshi Nakazato, 14 years ago

New Development: No

JIRA Issue: No

Ready to Release: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No?

Module(s): Module Names change impacts.

Description: Describe your changes here...

Fixed several bugs in Scantable::clip() method.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.4 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  explicit ScantableWrapper( const std::string& name,
39                    int type=0)
40  {
41    casa::Table::TableType tp = casa::Table::Memory;
42    if ( type == 1 ) tp = casa::Table::Plain;
43    table_ = new Scantable(name, tp);
44  }
45
46  explicit ScantableWrapper(int type=0)
47  {
48    casa::Table::TableType tp = casa::Table::Memory;
49    if ( type == 1) tp = casa::Table::Plain;
50    table_= new Scantable(tp);
51  }
52
53  explicit 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  double getIntTime(int whichrow=0) const
88    { return table_->getIntTime(whichrow); }
89
90  std::string getDirectionString(int whichrow=0) const
91    { return table_->getDirectionString(whichrow); }
92
93  std::string getFluxUnit() const { return table_->getFluxUnit(); }
94
95  void setFluxUnit(const std::string& unit) { table_->setFluxUnit(unit); }
96
97  void setInstrument(const std::string& name) {table_->setInstrument(name);}
98  void setFeedType(const std::string& ftype) {table_->setFeedType(ftype);}
99
100  std::vector<bool> getMask(int whichrow=0) const
101    { return table_->getMask(whichrow); }
102
103  /**
104  void flag(const std::vector<bool>& msk=std::vector<bool>())
105    { table_->flag(msk); }
106  **/
107  void flag(const std::vector<bool>& msk=std::vector<bool>(), bool unflag=false)
108    { table_->flag(msk, unflag); }
109
110  void flagRow(const std::vector<casa::uInt>& rows=std::vector<casa::uInt>(), bool unflag=false)
111    { table_->flagRow(rows, unflag); }
112
113  bool getFlagRow(int whichrow=0) const
114    { return table_->getFlagRow(whichrow); }
115
116  void clip(const casa::Float uthres, const casa::Float dthres, bool clipoutside=true, bool unflag=false)
117    { table_->clip(uthres, dthres, clipoutside, unflag); }
118
119  std::string getSourceName(int whichrow=0) const
120    { return table_->getSourceName(whichrow); }
121
122  float getElevation(int whichrow=0) const
123    { return table_->getElevation(whichrow); }
124
125  float getAzimuth(int whichrow=0) const
126    { return table_->getAzimuth(whichrow); }
127
128  float getParAngle(int whichrow=0) const
129    { return table_->getParAngle(whichrow); }
130
131
132  void setSpectrum(std::vector<float> spectrum, int whichrow=0)
133    { table_->setSpectrum(spectrum, whichrow); }
134
135  std::vector<uint> getIFNos() { return table_->getIFNos(); }
136  int getIF(int whichrow) const {return table_->getIF(whichrow);}
137  std::vector<uint> getBeamNos() { return table_->getBeamNos(); }
138  int getBeam(int whichrow) const {return table_->getBeam(whichrow);}
139  std::vector<uint> getPolNos() { return table_->getPolNos(); }
140  int getPol(int whichrow) const {return table_->getPol(whichrow);}
141  int getCycle(int whichrow) const {return table_->getCycle(whichrow);}
142  std::vector<uint> getScanNos() { return table_->getScanNos(); }
143  int getScan(int whichrow) const {return table_->getScan(whichrow);}
144  std::vector<uint> getMolNos() { return table_->getMolNos();}
145
146  STSelector getSelection() const { return table_->getSelection(); }
147  void setSelection(const STSelector& sts)
148    { return table_->setSelection(sts);}
149
150  std::string getPolType() const { return table_->getPolType(); }
151
152  int nif(int scanno=-1) const {return table_->nif(scanno);}
153  int nbeam(int scanno=-1) const {return table_->nbeam(scanno);}
154  int npol(int scanno=-1) const {return table_->npol(scanno);}
155  int nchan(int ifno=-1) const {return table_->nchan(ifno);}
156  int nscan() const {return table_->nscan();}
157  int nrow() const {return table_->nrow();}
158  int ncycle(int scanno) const {return table_->ncycle(scanno);}
159
160  void makePersistent(const std::string& fname)
161    { table_->makePersistent(fname); }
162
163  void setSourceType(int stype)
164    { table_->setSourceType(stype); }
165
166  void shift(int npix)
167  { table_->shift(npix); }
168
169/**
170  commented out by TT
171  void setRestFrequencies(double rf, const std::string& name,
172                          const std::string& unit)
173    { table_->setRestFrequencies(rf, name, unit); }
174**/
175  void setRestFrequencies(vector<double> rf, const vector<std::string>& name,
176                          const std::string& unit)
177    { table_->setRestFrequencies(rf, name, unit); }
178
179/*
180  void setRestFrequencies(const std::string& name) {
181    table_->setRestFrequencies(name);
182  }
183*/
184
185/*
186  std::vector<double> getRestFrequencies() const
187    { return table_->getRestFrequencies(); }
188*/
189  std::vector<double> getRestFrequency(int id) const
190    { return table_->getRestFrequency(id); }
191
192  void setCoordInfo(std::vector<string> theinfo) {
193    table_->setCoordInfo(theinfo);
194  }
195  std::vector<string> getCoordInfo() const {
196    return table_->getCoordInfo();
197  }
198
199  void setDirection(const std::string& refstr="")
200    { table_->setDirectionRefString(refstr); }
201
202  casa::CountedPtr<Scantable> getCP() const {return table_;}
203  Scantable* getPtr() {return &(*table_);}
204
205  std::string summary(bool verbose=false) const {
206    return table_->summary(verbose);
207  }
208
209  std::vector<std::string> getHistory()const
210    { return table_->getHistory(); }
211
212  void addHistory(const std::string& hist)
213    { table_->addHistory(hist); }
214
215  void addFit(const STFitEntry& fit, int row)
216    { table_->addFit(fit, row); }
217
218  STFitEntry getFit(int whichrow) const
219  { return table_->getFit(whichrow); }
220
221  void calculateAZEL() { table_->calculateAZEL(); };
222
223  std::vector<std::string> columnNames() const
224    { return table_->columnNames(); }
225
226  std::string getAntennaName() const
227    { return table_->getAntennaName(); }
228
229  int checkScanInfo(const vector<int>& scanlist) const
230    { return table_->checkScanInfo(scanlist); }
231 
232  std::vector<double>  getDirectionVector(int whichrow) const
233    { return table_->getDirectionVector(whichrow); }
234
235  void reshapeSpectrum( int nmin, int nmax )
236  { table_->reshapeSpectrum( nmin, nmax ); }
237
238private:
239  casa::CountedPtr<Scantable> table_;
240};
241
242} // namespace
243#endif
244
Note: See TracBrowser for help on using the repository browser.