| 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
|
|---|
| 14 |
|
|---|
| 15 | #include <vector>
|
|---|
| 16 | #include <string>
|
|---|
| 17 | #include <casa/Arrays/Vector.h>
|
|---|
| 18 |
|
|---|
| 19 | #include "MathUtils.h"
|
|---|
| 20 | #include "STFit.h"
|
|---|
| 21 | #include "Scantable.h"
|
|---|
| 22 | #include "STCoordinate.h"
|
|---|
| 23 |
|
|---|
| 24 | namespace asap {
|
|---|
| 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 | */
|
|---|
| 36 | class ScantableWrapper {
|
|---|
| 37 |
|
|---|
| 38 | public:
|
|---|
| 39 | explicit ScantableWrapper( const std::string& name,
|
|---|
| 40 | int type=0)
|
|---|
| 41 | {
|
|---|
| 42 | casa::Table::TableType tp = casa::Table::Memory;
|
|---|
| 43 | if ( type == 1 ) tp = casa::Table::Plain;
|
|---|
| 44 | table_ = new Scantable(name, tp);
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | explicit ScantableWrapper(int type=0)
|
|---|
| 48 | {
|
|---|
| 49 | casa::Table::TableType tp = casa::Table::Memory;
|
|---|
| 50 | if ( type == 1) tp = casa::Table::Plain;
|
|---|
| 51 | table_= new Scantable(tp);
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | explicit ScantableWrapper(casa::CountedPtr<Scantable> cp) : table_(cp) {;}
|
|---|
| 55 |
|
|---|
| 56 | ScantableWrapper(const ScantableWrapper& mt) :
|
|---|
| 57 | table_(mt.getCP()) {;}
|
|---|
| 58 |
|
|---|
| 59 | void assign(const ScantableWrapper& mt)
|
|---|
| 60 | { table_= mt.getCP(); }
|
|---|
| 61 |
|
|---|
| 62 | ScantableWrapper copy() {
|
|---|
| 63 | return ScantableWrapper(new Scantable(*(this->getCP()), false));
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | std::vector<float> getSpectrum( int whichrow=0,
|
|---|
| 67 | const std::string& poltype="" ) const {
|
|---|
| 68 | return table_->getSpectrum(whichrow, poltype);
|
|---|
| 69 | }
|
|---|
| 70 | // std::string getPolarizationLabel(bool linear, bool stokes, bool linPol, int polIdx) const {
|
|---|
| 71 | // Boost fails with 4 arguments.
|
|---|
| 72 | std::string getPolarizationLabel(int index, const std::string& ptype) const {
|
|---|
| 73 | return table_->getPolarizationLabel(index, ptype);
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|
| 76 | std::vector<double> getAbcissa(int whichrow=0) const
|
|---|
| 77 | { return table_->getAbcissa(whichrow); }
|
|---|
| 78 |
|
|---|
| 79 | std::string getAbcissaLabel(int whichrow=0) const
|
|---|
| 80 | { return table_->getAbcissaLabel(whichrow); }
|
|---|
| 81 |
|
|---|
| 82 | float getTsys(int whichrow=0) const
|
|---|
| 83 | { return table_->getTsys(whichrow); }
|
|---|
| 84 |
|
|---|
| 85 | std::string getTime(int whichrow=0) const
|
|---|
| 86 | { return table_->getTime(whichrow); }
|
|---|
| 87 |
|
|---|
| 88 | double getIntTime(int whichrow=0) const
|
|---|
| 89 | { return table_->getIntTime(whichrow); }
|
|---|
| 90 |
|
|---|
| 91 | std::string getDirectionString(int whichrow=0) const
|
|---|
| 92 | { return table_->getDirectionString(whichrow); }
|
|---|
| 93 |
|
|---|
| 94 | std::string getFluxUnit() const { return table_->getFluxUnit(); }
|
|---|
| 95 |
|
|---|
| 96 | void setFluxUnit(const std::string& unit) { table_->setFluxUnit(unit); }
|
|---|
| 97 |
|
|---|
| 98 | void setInstrument(const std::string& name) {table_->setInstrument(name);}
|
|---|
| 99 | void setFeedType(const std::string& ftype) {table_->setFeedType(ftype);}
|
|---|
| 100 |
|
|---|
| 101 | std::vector<bool> getMask(int whichrow=0) const
|
|---|
| 102 | { return table_->getMask(whichrow); }
|
|---|
| 103 |
|
|---|
| 104 | /**
|
|---|
| 105 | void flag(const std::vector<bool>& msk=std::vector<bool>())
|
|---|
| 106 | { table_->flag(msk); }
|
|---|
| 107 | **/
|
|---|
| 108 | void flag(const std::vector<bool>& msk=std::vector<bool>(), bool unflag=false)
|
|---|
| 109 | { table_->flag(msk, unflag); }
|
|---|
| 110 |
|
|---|
| 111 | std::string getSourceName(int whichrow=0) const
|
|---|
| 112 | { return table_->getSourceName(whichrow); }
|
|---|
| 113 |
|
|---|
| 114 | float getElevation(int whichrow=0) const
|
|---|
| 115 | { return table_->getElevation(whichrow); }
|
|---|
| 116 |
|
|---|
| 117 | float getAzimuth(int whichrow=0) const
|
|---|
| 118 | { return table_->getAzimuth(whichrow); }
|
|---|
| 119 |
|
|---|
| 120 | float getParAngle(int whichrow=0) const
|
|---|
| 121 | { return table_->getParAngle(whichrow); }
|
|---|
| 122 |
|
|---|
| 123 |
|
|---|
| 124 | void setSpectrum(std::vector<float> spectrum, int whichrow=0)
|
|---|
| 125 | { table_->setSpectrum(spectrum, whichrow); }
|
|---|
| 126 |
|
|---|
| 127 | std::vector<uint> getIFNos() { return table_->getIFNos(); }
|
|---|
| 128 | int getIF(int whichrow) const {return table_->getIF(whichrow);}
|
|---|
| 129 | std::vector<uint> getBeamNos() { return table_->getBeamNos(); }
|
|---|
| 130 | int getBeam(int whichrow) const {return table_->getBeam(whichrow);}
|
|---|
| 131 | std::vector<uint> getPolNos() { return table_->getPolNos(); }
|
|---|
| 132 | int getPol(int whichrow) const {return table_->getPol(whichrow);}
|
|---|
| 133 | int getCycle(int whichrow) const {return table_->getCycle(whichrow);}
|
|---|
| 134 | std::vector<uint> getScanNos() { return table_->getScanNos(); }
|
|---|
| 135 | int getScan(int whichrow) const {return table_->getScan(whichrow);}
|
|---|
| 136 |
|
|---|
| 137 | STSelector getSelection() const { return table_->getSelection(); }
|
|---|
| 138 | void setSelection(const STSelector& sts)
|
|---|
| 139 | { return table_->setSelection(sts);}
|
|---|
| 140 |
|
|---|
| 141 | std::string getPolType() const { return table_->getPolType(); }
|
|---|
| 142 |
|
|---|
| 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();}
|
|---|
| 149 | int ncycle(int scanno) const {return table_->ncycle(scanno);}
|
|---|
| 150 |
|
|---|
| 151 | void makePersistent(const std::string& fname)
|
|---|
| 152 | { table_->makePersistent(fname); }
|
|---|
| 153 |
|
|---|
| 154 | void setSourceType(int stype)
|
|---|
| 155 | { table_->setSourceType(stype); }
|
|---|
| 156 |
|
|---|
| 157 | void shift(int npix)
|
|---|
| 158 | { table_->shift(npix); }
|
|---|
| 159 |
|
|---|
| 160 | void setRestFrequencies(double rf, const std::string& name,
|
|---|
| 161 | const std::string& unit)
|
|---|
| 162 | { table_->setRestFrequencies(rf, name, unit); }
|
|---|
| 163 | /*
|
|---|
| 164 | void setRestFrequencies(const std::string& name) {
|
|---|
| 165 | table_->setRestFrequencies(name);
|
|---|
| 166 | }
|
|---|
| 167 | */
|
|---|
| 168 |
|
|---|
| 169 | std::vector<double> getRestFrequencies() const
|
|---|
| 170 | { return table_->getRestFrequencies(); }
|
|---|
| 171 |
|
|---|
| 172 | void setCoordInfo(std::vector<string> theinfo) {
|
|---|
| 173 | table_->setCoordInfo(theinfo);
|
|---|
| 174 | }
|
|---|
| 175 | std::vector<string> getCoordInfo() const {
|
|---|
| 176 | return table_->getCoordInfo();
|
|---|
| 177 | }
|
|---|
| 178 |
|
|---|
| 179 | void setDirection(const std::string& refstr="")
|
|---|
| 180 | { table_->setDirectionRefString(refstr); }
|
|---|
| 181 |
|
|---|
| 182 | casa::CountedPtr<Scantable> getCP() const {return table_;}
|
|---|
| 183 | Scantable* getPtr() {return &(*table_);}
|
|---|
| 184 |
|
|---|
| 185 | std::string summary(bool verbose=false) const {
|
|---|
| 186 | return table_->summary(verbose);
|
|---|
| 187 | }
|
|---|
| 188 |
|
|---|
| 189 | std::vector<std::string> getHistory()const
|
|---|
| 190 | { return table_->getHistory(); }
|
|---|
| 191 |
|
|---|
| 192 | void addHistory(const std::string& hist)
|
|---|
| 193 | { table_->addHistory(hist); }
|
|---|
| 194 |
|
|---|
| 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 |
|
|---|
| 201 | void calculateAZEL() { table_->calculateAZEL(); };
|
|---|
| 202 |
|
|---|
| 203 | std::vector<std::string> columnNames() const
|
|---|
| 204 | { return table_->columnNames(); }
|
|---|
| 205 |
|
|---|
| 206 | std::string getAntennaName() const
|
|---|
| 207 | { return table_->getAntennaName(); }
|
|---|
| 208 |
|
|---|
| 209 | int checkScanInfo(const vector<int>& scanlist) const
|
|---|
| 210 | { return table_->checkScanInfo(scanlist); }
|
|---|
| 211 |
|
|---|
| 212 | std::vector<double> getDirectionVector(int whichrow) const
|
|---|
| 213 | { return table_->getDirectionVector(whichrow); }
|
|---|
| 214 |
|
|---|
| 215 | void parallactify(bool flag)
|
|---|
| 216 | { table_->parallactify(flag); }
|
|---|
| 217 |
|
|---|
| 218 | STCoordinate getCoordinate(int row) {
|
|---|
| 219 | return STCoordinate(table_->getSpectralCoordinate(row));
|
|---|
| 220 | }
|
|---|
| 221 |
|
|---|
| 222 | std::vector<float> getWeather(int whichrow) const
|
|---|
| 223 | { return table_->getWeather(whichrow); }
|
|---|
| 224 |
|
|---|
| 225 | private:
|
|---|
| 226 | casa::CountedPtr<Scantable> table_;
|
|---|
| 227 | };
|
|---|
| 228 |
|
|---|
| 229 | } // namespace
|
|---|
| 230 | #endif
|
|---|