source: trunk/src/ScantableWrapper.h @ 901

Last change on this file since 901 was 901, checked in by mar637, 18 years ago

SDContainer -> STHeader

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.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
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"
[2]22
[83]23namespace asap {
[847]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 {
[2]36
37public:
[864]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  }
[90]45
[864]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  }
[90]52
[847]53  ScantableWrapper(casa::CountedPtr<Scantable> cp) : table_(cp) {;}
[90]54
[847]55  ScantableWrapper(const ScantableWrapper& mt) :
56    table_(mt.getCP()) {;}
[90]57
[868]58  void assign(const ScantableWrapper& mt)
59    { table_= mt.getCP(); }
60
[847]61  ScantableWrapper copy() {
62    return ScantableWrapper(new Scantable(*(this->getCP()), false));
[80]63  }
[868]64
[896]65  std::vector<float> getSpectrum( int whichrow=0,
66                                  const std::string& poltype="linear" ) const {
67    return table_->getSpectrum(whichrow, poltype);
[2]68  }
[527]69  //  std::string getPolarizationLabel(bool linear, bool stokes, bool linPol, int polIdx) const {
70  // Boost fails with 4 arguments.
[745]71  std::string getPolarizationLabel(bool linear, bool stokes,
72                                   bool linPol) const {
[527]73    int polIdx = -1;
74    return table_->getPolarizationLabel(linear, stokes, linPol, polIdx);
[494]75  }
[527]76
[896]77  std::vector<double> getAbcissa(int whichrow=0) const
78    { return table_->getAbcissa(whichrow); }
[41]79
[896]80  std::string getAbcissaLabel(int whichrow=0) const
81    { return table_->getAbcissaLabel(whichrow); }
[157]82
[896]83  float getTsys(int whichrow=0) const
84    { return table_->getTsys(whichrow); }
[2]85
[896]86  std::string getTime(int whichrow=0) const
87    { return table_->getTime(whichrow); }
[207]88
[864]89  std::string getFluxUnit() const { return table_->getFluxUnit(); }
90
91  void setFluxUnit(const std::string& unit) { table_->setFluxUnit(unit); }
92
[238]93  void setInstrument(const std::string& name) {table_->setInstrument(name);}
94
[896]95  std::vector<bool> getMask(int whichrow=0) const
96    { return table_->getMask(whichrow); }
[2]97
[864]98  void flag() { table_->flag(); }
[2]99
[896]100  std::string getSourceName(int whichrow=0) const
101    { return table_->getSourceName(whichrow); }
[794]102
[896]103  float getElevation(int whichrow=0) const
104    { return table_->getElevation(whichrow); }
[90]105
[896]106  float getAzimuth(int whichrow=0) const
107    { return table_->getAzimuth(whichrow); }
[2]108
[896]109  float getParAngle(int whichrow=0) const
110    { return table_->getParAngle(whichrow); }
[2]111
[864]112
[884]113  void setSpectrum(std::vector<float> spectrum, int whichrow=0)
114    { table_->setSpectrum(spectrum, whichrow); }
[868]115
[864]116  int getIF(int whichrow) const {return table_->getIF(whichrow);}
117  int getBeam(int whichrow) const {return table_->getBeam(whichrow);}
118  int getPol(int whichrow) const {return table_->getPol(whichrow);}
[868]119  int getCycle(int whichrow) const {return table_->getCycle(whichrow);}
120  int getScan(int whichrow) const {return table_->getScan(whichrow);}
[864]121
122  STSelector getSelection() const { return table_->getSelection(); }
[868]123  void setSelection(const STSelector& sts)
124    { return table_->setSelection(sts);}
[864]125
[896]126  std::string getPolType() const { return table_->getPolType(); }
127
[864]128  int nif(int scanno=-1) const {return table_->nif(scanno);}
129  int nbeam(int scanno=-1) const {return table_->nbeam(scanno);}
130  int npol(int scanno=-1) const {return table_->npol(scanno);}
131  int nchan(int ifno=-1) const {return table_->nchan(ifno);}
132  int nscan() const {return table_->nscan();}
133  int nrow() const {return table_->nrow();}
[847]134  ///@todo int nstokes() {return table_->nStokes();}
[2]135
[864]136  void makePersistent(const std::string& fname)
137    { table_->makePersistent(fname); }
[90]138
[868]139  void setRestFrequencies(double rf, const std::string& unit)
140    { table_->setRestFrequencies(rf, unit); }
[401]141
[868]142  void setRestFrequencies(const std::string& name) {
143    table_->setRestFrequencies(name);
[847]144  }
[745]145
[864]146  std::vector<double> getRestFrequencies() const
147    { return table_->getRestFrequencies(); }
[251]148
[105]149  void setCoordInfo(std::vector<string> theinfo) {
150    table_->setCoordInfo(theinfo);
151  }
152  std::vector<string> getCoordInfo() const {
153    return table_->getCoordInfo();
154  }
[90]155
[847]156  casa::CountedPtr<Scantable> getCP() const {return table_;}
157  Scantable* getPtr() {return &(*table_);}
[380]158
[745]159  std::string summary(bool verbose=false) const {
160    return table_->summary(verbose);
[380]161  }
[745]162
[864]163  std::vector<std::string> getHistory()const
164    { return table_->getHistory(); }
[207]165
[864]166  void addHistory(const std::string& hist)
167    { table_->addHistory(hist); }
168  /*
[896]169  void addFit(int whichrow, const std::vector<double>& p,
[745]170              const std::vector<bool>& m, const std::vector<string>& f,
171              const std::vector<int>& c) {
172
[455]173    casa::Vector<casa::Double> p2(p);
[745]174    casa::Vector<casa::Bool> m2(m);
[465]175    casa::Vector<casa::String> f2 = mathutil::toVectorString(f);
[455]176    casa::Vector<casa::Int> c2(c);
[896]177    table_->addFit(casa::uInt(whichrow), p2,m2,f2,c2);
[455]178  }
[896]179  SDFitTable getSDFitTable(int whichrow) {
180    return table_->getSDFitTable(casa::uInt(whichrow));
[465]181  }
[864]182  */
[777]183  void calculateAZEL() { table_->calculateAZEL(); };
[465]184
[2]185private:
[847]186  casa::CountedPtr<Scantable> table_;
[2]187};
188
189} // namespace
190#endif
[421]191
Note: See TracBrowser for help on using the repository browser.