source: trunk/src/ScantableWrapper.h @ 1730

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

Ticket #183: added get_weather to scantable. It returns a dicr or list of dicts

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.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"
[1598]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
[1430]104  /**
[1000]105  void flag(const std::vector<bool>& msk=std::vector<bool>())
106    { table_->flag(msk); }
[1430]107  **/
108  void flag(const std::vector<bool>& msk=std::vector<bool>(), bool unflag=false)
109    { table_->flag(msk, unflag); }
[2]110
[896]111  std::string getSourceName(int whichrow=0) const
112    { return table_->getSourceName(whichrow); }
[794]113
[896]114  float getElevation(int whichrow=0) const
115    { return table_->getElevation(whichrow); }
[90]116
[896]117  float getAzimuth(int whichrow=0) const
118    { return table_->getAzimuth(whichrow); }
[2]119
[896]120  float getParAngle(int whichrow=0) const
121    { return table_->getParAngle(whichrow); }
[2]122
[864]123
[884]124  void setSpectrum(std::vector<float> spectrum, int whichrow=0)
125    { table_->setSpectrum(spectrum, whichrow); }
[868]126
[1111]127  std::vector<uint> getIFNos() { return table_->getIFNos(); }
[864]128  int getIF(int whichrow) const {return table_->getIF(whichrow);}
[1111]129  std::vector<uint> getBeamNos() { return table_->getBeamNos(); }
[864]130  int getBeam(int whichrow) const {return table_->getBeam(whichrow);}
[1111]131  std::vector<uint> getPolNos() { return table_->getPolNos(); }
[864]132  int getPol(int whichrow) const {return table_->getPol(whichrow);}
[868]133  int getCycle(int whichrow) const {return table_->getCycle(whichrow);}
[1111]134  std::vector<uint> getScanNos() { return table_->getScanNos(); }
[868]135  int getScan(int whichrow) const {return table_->getScan(whichrow);}
[864]136
137  STSelector getSelection() const { return table_->getSelection(); }
[868]138  void setSelection(const STSelector& sts)
139    { return table_->setSelection(sts);}
[864]140
[896]141  std::string getPolType() const { return table_->getPolType(); }
142
[864]143  int nif(int scanno=-1) const {return table_->nif(scanno);}
144  int nbeam(int scanno=-1) const {return table_->nbeam(scanno);}
145  int npol(int scanno=-1) const {return table_->npol(scanno);}
146  int nchan(int ifno=-1) const {return table_->nchan(ifno);}
147  int nscan() const {return table_->nscan();}
148  int nrow() const {return table_->nrow();}
[902]149  int ncycle(int scanno) const {return table_->ncycle(scanno);}
[2]150
[864]151  void makePersistent(const std::string& fname)
152    { table_->makePersistent(fname); }
[90]153
[1068]154  void setSourceType(int stype)
155    { table_->setSourceType(stype); }
156
[1360]157  void shift(int npix)
158  { table_->shift(npix); }
159
[1170]160  void setRestFrequencies(double rf, const std::string& name,
161                          const std::string& unit)
162    { table_->setRestFrequencies(rf, name, unit); }
[925]163/*
[868]164  void setRestFrequencies(const std::string& name) {
165    table_->setRestFrequencies(name);
[847]166  }
[925]167*/
[745]168
[864]169  std::vector<double> getRestFrequencies() const
170    { return table_->getRestFrequencies(); }
[251]171
[105]172  void setCoordInfo(std::vector<string> theinfo) {
173    table_->setCoordInfo(theinfo);
174  }
175  std::vector<string> getCoordInfo() const {
176    return table_->getCoordInfo();
177  }
[90]178
[987]179  void setDirection(const std::string& refstr="")
180    { table_->setDirectionRefString(refstr); }
181
[847]182  casa::CountedPtr<Scantable> getCP() const {return table_;}
183  Scantable* getPtr() {return &(*table_);}
[380]184
[745]185  std::string summary(bool verbose=false) const {
186    return table_->summary(verbose);
[380]187  }
[745]188
[864]189  std::vector<std::string> getHistory()const
190    { return table_->getHistory(); }
[207]191
[864]192  void addHistory(const std::string& hist)
193    { table_->addHistory(hist); }
[745]194
[972]195  void addFit(const STFitEntry& fit, int row)
196    { table_->addFit(fit, row); }
197
198  STFitEntry getFit(int whichrow) const
199  { return table_->getFit(whichrow); }
200
[777]201  void calculateAZEL() { table_->calculateAZEL(); };
[465]202
[1003]203  std::vector<std::string> columnNames() const
204    { return table_->columnNames(); }
205
[1391]206  std::string getAntennaName() const
207    { return table_->getAntennaName(); }
208
209  int checkScanInfo(const vector<int>& scanlist) const
210    { return table_->checkScanInfo(scanlist); }
211
[1730]212  std::vector<double> getDirectionVector(int whichrow) const
[1391]213    { return table_->getDirectionVector(whichrow); }
214
[1586]215  void parallactify(bool flag)
216    { table_->parallactify(flag); }
217
[1598]218  STCoordinate getCoordinate(int row) {
219    return STCoordinate(table_->getSpectralCoordinate(row));
220  }
221
[1730]222  std::vector<float> getWeather(int whichrow) const
223    { return table_->getWeather(whichrow); }
224
[2]225private:
[847]226  casa::CountedPtr<Scantable> table_;
[2]227};
228
229} // namespace
230#endif
Note: See TracBrowser for help on using the repository browser.