source: trunk/src/ScantableWrapper.h@ 1191

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

Fix for ticket #61 - changing of default polarisation. Done ticket #62 as far as possible. Tid data gets automatically set as 'circular'\nAlso add circular pol class which was missing so far.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.0 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,
[1077]39 int type=0)
[864]40 {
41 casa::Table::TableType tp = casa::Table::Memory;
[1077]42 if ( type == 1 ) tp = casa::Table::Plain;
[864]43 table_ = new Scantable(name, tp);
44 }
[90]45
[1077]46 ScantableWrapper(int type=0)
[864]47 {
48 casa::Table::TableType tp = casa::Table::Memory;
[1077]49 if ( type == 1) tp = casa::Table::Plain;
[864]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
[1068]87 std::string getDirectionString(int whichrow=0) const
88 { return table_->getDirectionString(whichrow); }
89
[864]90 std::string getFluxUnit() const { return table_->getFluxUnit(); }
91
92 void setFluxUnit(const std::string& unit) { table_->setFluxUnit(unit); }
93
[238]94 void setInstrument(const std::string& name) {table_->setInstrument(name);}
[1189]95 void setFeedType(const std::string& ftype) {table_->setFeedType(ftype);}
[238]96
[896]97 std::vector<bool> getMask(int whichrow=0) const
98 { return table_->getMask(whichrow); }
[2]99
[1000]100 void flag(const std::vector<bool>& msk=std::vector<bool>())
101 { table_->flag(msk); }
[2]102
[896]103 std::string getSourceName(int whichrow=0) const
104 { return table_->getSourceName(whichrow); }
[794]105
[896]106 float getElevation(int whichrow=0) const
107 { return table_->getElevation(whichrow); }
[90]108
[896]109 float getAzimuth(int whichrow=0) const
110 { return table_->getAzimuth(whichrow); }
[2]111
[896]112 float getParAngle(int whichrow=0) const
113 { return table_->getParAngle(whichrow); }
[2]114
[864]115
[884]116 void setSpectrum(std::vector<float> spectrum, int whichrow=0)
117 { table_->setSpectrum(spectrum, whichrow); }
[868]118
[1111]119 std::vector<uint> getIFNos() { return table_->getIFNos(); }
[864]120 int getIF(int whichrow) const {return table_->getIF(whichrow);}
[1111]121 std::vector<uint> getBeamNos() { return table_->getBeamNos(); }
[864]122 int getBeam(int whichrow) const {return table_->getBeam(whichrow);}
[1111]123 std::vector<uint> getPolNos() { return table_->getPolNos(); }
[864]124 int getPol(int whichrow) const {return table_->getPol(whichrow);}
[868]125 int getCycle(int whichrow) const {return table_->getCycle(whichrow);}
[1111]126 std::vector<uint> getScanNos() { return table_->getScanNos(); }
[868]127 int getScan(int whichrow) const {return table_->getScan(whichrow);}
[864]128
129 STSelector getSelection() const { return table_->getSelection(); }
[868]130 void setSelection(const STSelector& sts)
131 { return table_->setSelection(sts);}
[864]132
[896]133 std::string getPolType() const { return table_->getPolType(); }
134
[864]135 int nif(int scanno=-1) const {return table_->nif(scanno);}
136 int nbeam(int scanno=-1) const {return table_->nbeam(scanno);}
137 int npol(int scanno=-1) const {return table_->npol(scanno);}
138 int nchan(int ifno=-1) const {return table_->nchan(ifno);}
139 int nscan() const {return table_->nscan();}
140 int nrow() const {return table_->nrow();}
[902]141 int ncycle(int scanno) const {return table_->ncycle(scanno);}
[2]142
[864]143 void makePersistent(const std::string& fname)
144 { table_->makePersistent(fname); }
[90]145
[1068]146 void setSourceType(int stype)
147 { table_->setSourceType(stype); }
148
[1170]149 void setRestFrequencies(double rf, const std::string& name,
150 const std::string& unit)
151 { table_->setRestFrequencies(rf, name, unit); }
[925]152/*
[868]153 void setRestFrequencies(const std::string& name) {
154 table_->setRestFrequencies(name);
[847]155 }
[925]156*/
[745]157
[864]158 std::vector<double> getRestFrequencies() const
159 { return table_->getRestFrequencies(); }
[251]160
[105]161 void setCoordInfo(std::vector<string> theinfo) {
162 table_->setCoordInfo(theinfo);
163 }
164 std::vector<string> getCoordInfo() const {
165 return table_->getCoordInfo();
166 }
[90]167
[987]168 void setDirection(const std::string& refstr="")
169 { table_->setDirectionRefString(refstr); }
170
[847]171 casa::CountedPtr<Scantable> getCP() const {return table_;}
172 Scantable* getPtr() {return &(*table_);}
[380]173
[745]174 std::string summary(bool verbose=false) const {
175 return table_->summary(verbose);
[380]176 }
[745]177
[864]178 std::vector<std::string> getHistory()const
179 { return table_->getHistory(); }
[207]180
[864]181 void addHistory(const std::string& hist)
182 { table_->addHistory(hist); }
[745]183
[972]184 void addFit(const STFitEntry& fit, int row)
185 { table_->addFit(fit, row); }
186
187 STFitEntry getFit(int whichrow) const
188 { return table_->getFit(whichrow); }
189
[777]190 void calculateAZEL() { table_->calculateAZEL(); };
[465]191
[1003]192 std::vector<std::string> columnNames() const
193 { return table_->columnNames(); }
194
[2]195private:
[847]196 casa::CountedPtr<Scantable> table_;
[2]197};
198
199} // namespace
200#endif
[421]201
Note: See TracBrowser for help on using the repository browser.