source: trunk/src/ScantableWrapper.h@ 885

Last change on this file since 885 was 884, checked in by mar637, 19 years ago

added setSpectrum

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