source: trunk/src/ScantableWrapper.h@ 920

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

change default polytype passed as argument to "", to then apply Scantable::poltype if empty.
added poltype to STHeader

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