| 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 "STFitEntry.h"
|
|---|
| 22 | #include "Scantable.h"
|
|---|
| 23 | #include "STCoordinate.h"
|
|---|
| 24 |
|
|---|
| 25 | namespace asap {
|
|---|
| 26 | /**
|
|---|
| 27 | * This class contains and wraps a CountedPtr<Scantable>, as the CountedPtr
|
|---|
| 28 | * class does not provide the dor operator which is need for references
|
|---|
| 29 | * in boost::python
|
|---|
| 30 | * see Scantable for interfce description
|
|---|
| 31 | *
|
|---|
| 32 | * @brief The main ASAP data container wrapper
|
|---|
| 33 | * @author Malte Marquarding
|
|---|
| 34 | * @date 2006-02-23
|
|---|
| 35 | * @version 2.0a
|
|---|
| 36 | */
|
|---|
| 37 | class ScantableWrapper {
|
|---|
| 38 |
|
|---|
| 39 | public:
|
|---|
| 40 | explicit ScantableWrapper( const std::string& name,
|
|---|
| 41 | int type=0)
|
|---|
| 42 | {
|
|---|
| 43 | casa::Table::TableType tp = casa::Table::Memory;
|
|---|
| 44 | if ( type == 1 ) tp = casa::Table::Plain;
|
|---|
| 45 | table_ = new Scantable(name, tp);
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | explicit ScantableWrapper(int type=0)
|
|---|
| 49 | {
|
|---|
| 50 | casa::Table::TableType tp = casa::Table::Memory;
|
|---|
| 51 | if ( type == 1) tp = casa::Table::Plain;
|
|---|
| 52 | table_= new Scantable(tp);
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 | explicit ScantableWrapper(casa::CountedPtr<Scantable> cp) : table_(cp) {;}
|
|---|
| 56 |
|
|---|
| 57 | ScantableWrapper(const ScantableWrapper& mt) :
|
|---|
| 58 | table_(mt.getCP()) {;}
|
|---|
| 59 |
|
|---|
| 60 | void assign(const ScantableWrapper& mt)
|
|---|
| 61 | { table_= mt.getCP(); }
|
|---|
| 62 |
|
|---|
| 63 | ScantableWrapper copy() {
|
|---|
| 64 | return ScantableWrapper(new Scantable(*(this->getCP()), false));
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | std::vector<float> getSpectrum( int whichrow=0,
|
|---|
| 68 | const std::string& poltype="" ) const {
|
|---|
| 69 | return table_->getSpectrum(whichrow, poltype);
|
|---|
| 70 | }
|
|---|
| 71 | // std::string getPolarizationLabel(bool linear, bool stokes, bool linPol, int polIdx) const {
|
|---|
| 72 | // Boost fails with 4 arguments.
|
|---|
| 73 | std::string getPolarizationLabel(int index, const std::string& ptype) const {
|
|---|
| 74 | return table_->getPolarizationLabel(index, ptype);
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | std::vector<double> getAbcissa(int whichrow=0) const
|
|---|
| 78 | { return table_->getAbcissa(whichrow); }
|
|---|
| 79 |
|
|---|
| 80 | std::string getAbcissaLabel(int whichrow=0) const
|
|---|
| 81 | { return table_->getAbcissaLabel(whichrow); }
|
|---|
| 82 |
|
|---|
| 83 | float getTsys(int whichrow=0) const
|
|---|
| 84 | { return table_->getTsys(whichrow); }
|
|---|
| 85 |
|
|---|
| 86 | std::string getTime(int whichrow=0) const
|
|---|
| 87 | { return table_->getTime(whichrow); }
|
|---|
| 88 |
|
|---|
| 89 | double getIntTime(int whichrow=0) const
|
|---|
| 90 | { return table_->getIntTime(whichrow); }
|
|---|
| 91 |
|
|---|
| 92 | std::string getDirectionString(int whichrow=0) const
|
|---|
| 93 | { return table_->getDirectionString(whichrow); }
|
|---|
| 94 |
|
|---|
| 95 | std::string getFluxUnit() const { return table_->getFluxUnit(); }
|
|---|
| 96 |
|
|---|
| 97 | void setFluxUnit(const std::string& unit) { table_->setFluxUnit(unit); }
|
|---|
| 98 |
|
|---|
| 99 | void setInstrument(const std::string& name) {table_->setInstrument(name);}
|
|---|
| 100 | void setFeedType(const std::string& ftype) {table_->setFeedType(ftype);}
|
|---|
| 101 |
|
|---|
| 102 | std::vector<bool> getMask(int whichrow=0) const
|
|---|
| 103 | { return table_->getMask(whichrow); }
|
|---|
| 104 |
|
|---|
| 105 | /**
|
|---|
| 106 | void flag(const std::vector<bool>& msk=std::vector<bool>())
|
|---|
| 107 | { table_->flag(msk); }
|
|---|
| 108 | **/
|
|---|
| 109 | void flag(const std::vector<bool>& msk=std::vector<bool>(), bool unflag=false)
|
|---|
| 110 | { table_->flag(msk, unflag); }
|
|---|
| 111 |
|
|---|
| 112 | void flagRow(const std::vector<casa::uInt>& rows=std::vector<casa::uInt>(), bool unflag=false)
|
|---|
| 113 | { table_->flagRow(rows, unflag); }
|
|---|
| 114 |
|
|---|
| 115 | bool getFlagRow(int whichrow=0) const
|
|---|
| 116 | { return table_->getFlagRow(whichrow); }
|
|---|
| 117 |
|
|---|
| 118 | void clip(const casa::Float uthres, const casa::Float dthres, bool clipoutside=true, bool unflag=false)
|
|---|
| 119 | { table_->clip(uthres, dthres, clipoutside, unflag); }
|
|---|
| 120 |
|
|---|
| 121 | std::vector<bool> getClipMask(int whichrow, const casa::Float uthres, const casa::Float dthres, bool clipoutside, bool unflag) const
|
|---|
| 122 | { return table_->getClipMask(whichrow, uthres, dthres, clipoutside, unflag); }
|
|---|
| 123 |
|
|---|
| 124 | std::string getSourceName(int whichrow=0) const
|
|---|
| 125 | { return table_->getSourceName(whichrow); }
|
|---|
| 126 |
|
|---|
| 127 | float getElevation(int whichrow=0) const
|
|---|
| 128 | { return table_->getElevation(whichrow); }
|
|---|
| 129 |
|
|---|
| 130 | float getAzimuth(int whichrow=0) const
|
|---|
| 131 | { return table_->getAzimuth(whichrow); }
|
|---|
| 132 |
|
|---|
| 133 | float getParAngle(int whichrow=0) const
|
|---|
| 134 | { return table_->getParAngle(whichrow); }
|
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 | void setSpectrum(std::vector<float> spectrum, int whichrow=0)
|
|---|
| 138 | { table_->setSpectrum(spectrum, whichrow); }
|
|---|
| 139 |
|
|---|
| 140 | std::vector<uint> getIFNos() { return table_->getIFNos(); }
|
|---|
| 141 | int getIF(int whichrow) const {return table_->getIF(whichrow);}
|
|---|
| 142 | std::vector<uint> getBeamNos() { return table_->getBeamNos(); }
|
|---|
| 143 | int getBeam(int whichrow) const {return table_->getBeam(whichrow);}
|
|---|
| 144 | std::vector<uint> getPolNos() { return table_->getPolNos(); }
|
|---|
| 145 | int getPol(int whichrow) const {return table_->getPol(whichrow);}
|
|---|
| 146 | int getCycle(int whichrow) const {return table_->getCycle(whichrow);}
|
|---|
| 147 | std::vector<uint> getScanNos() { return table_->getScanNos(); }
|
|---|
| 148 | int getScan(int whichrow) const {return table_->getScan(whichrow);}
|
|---|
| 149 | std::vector<uint> getMolNos() { return table_->getMolNos();}
|
|---|
| 150 |
|
|---|
| 151 | STSelector getSelection() const { return table_->getSelection(); }
|
|---|
| 152 | void setSelection(const STSelector& sts)
|
|---|
| 153 | { return table_->setSelection(sts);}
|
|---|
| 154 |
|
|---|
| 155 | std::string getPolType() const { return table_->getPolType(); }
|
|---|
| 156 |
|
|---|
| 157 | int nif(int scanno=-1) const {return table_->nif(scanno);}
|
|---|
| 158 | int nbeam(int scanno=-1) const {return table_->nbeam(scanno);}
|
|---|
| 159 | int npol(int scanno=-1) const {return table_->npol(scanno);}
|
|---|
| 160 | int nchan(int ifno=-1) const {return table_->nchan(ifno);}
|
|---|
| 161 | int nscan() const {return table_->nscan();}
|
|---|
| 162 | int nrow() const {return table_->nrow();}
|
|---|
| 163 | int ncycle(int scanno) const {return table_->ncycle(scanno);}
|
|---|
| 164 |
|
|---|
| 165 | void makePersistent(const std::string& fname)
|
|---|
| 166 | { table_->makePersistent(fname); }
|
|---|
| 167 |
|
|---|
| 168 | void setSourceType(int stype)
|
|---|
| 169 | { table_->setSourceType(stype); }
|
|---|
| 170 |
|
|---|
| 171 | void shift(int npix)
|
|---|
| 172 | { table_->shift(npix); }
|
|---|
| 173 |
|
|---|
| 174 | /**
|
|---|
| 175 | commented out by TT
|
|---|
| 176 | void setRestFrequencies(double rf, const std::string& name,
|
|---|
| 177 | const std::string& unit)
|
|---|
| 178 | { table_->setRestFrequencies(rf, name, unit); }
|
|---|
| 179 | **/
|
|---|
| 180 | void setRestFrequencies(vector<double> rf, const vector<std::string>& name,
|
|---|
| 181 | const std::string& unit)
|
|---|
| 182 | { table_->setRestFrequencies(rf, name, unit); }
|
|---|
| 183 |
|
|---|
| 184 | /*
|
|---|
| 185 | void setRestFrequencies(const std::string& name) {
|
|---|
| 186 | table_->setRestFrequencies(name);
|
|---|
| 187 | }
|
|---|
| 188 | */
|
|---|
| 189 |
|
|---|
| 190 | /*
|
|---|
| 191 | std::vector<double> getRestFrequencies() const
|
|---|
| 192 | { return table_->getRestFrequencies(); }
|
|---|
| 193 | */
|
|---|
| 194 | std::vector<double> getRestFrequency(int id) const
|
|---|
| 195 | { return table_->getRestFrequency(id); }
|
|---|
| 196 |
|
|---|
| 197 | void setCoordInfo(std::vector<string> theinfo) {
|
|---|
| 198 | table_->setCoordInfo(theinfo);
|
|---|
| 199 | }
|
|---|
| 200 | std::vector<string> getCoordInfo() const {
|
|---|
| 201 | return table_->getCoordInfo();
|
|---|
| 202 | }
|
|---|
| 203 |
|
|---|
| 204 | void setDirection(const std::string& refstr="")
|
|---|
| 205 | { table_->setDirectionRefString(refstr); }
|
|---|
| 206 |
|
|---|
| 207 | casa::CountedPtr<Scantable> getCP() const {return table_;}
|
|---|
| 208 | Scantable* getPtr() {return &(*table_);}
|
|---|
| 209 |
|
|---|
| 210 | std::string summary(bool verbose=false) const {
|
|---|
| 211 | return table_->summary(verbose);
|
|---|
| 212 | }
|
|---|
| 213 |
|
|---|
| 214 | std::vector<std::string> getHistory()const
|
|---|
| 215 | { return table_->getHistory(); }
|
|---|
| 216 |
|
|---|
| 217 | void addHistory(const std::string& hist)
|
|---|
| 218 | { table_->addHistory(hist); }
|
|---|
| 219 |
|
|---|
| 220 | void addFit(const STFitEntry& fit, int row)
|
|---|
| 221 | { table_->addFit(fit, row); }
|
|---|
| 222 |
|
|---|
| 223 | STFitEntry getFit(int whichrow) const
|
|---|
| 224 | { return table_->getFit(whichrow); }
|
|---|
| 225 |
|
|---|
| 226 | void calculateAZEL() { table_->calculateAZEL(); };
|
|---|
| 227 |
|
|---|
| 228 | std::vector<std::string> columnNames() const
|
|---|
| 229 | { return table_->columnNames(); }
|
|---|
| 230 |
|
|---|
| 231 | std::string getAntennaName() const
|
|---|
| 232 | { return table_->getAntennaName(); }
|
|---|
| 233 |
|
|---|
| 234 | int checkScanInfo(const vector<int>& scanlist) const
|
|---|
| 235 | { return table_->checkScanInfo(scanlist); }
|
|---|
| 236 |
|
|---|
| 237 | std::vector<double> getDirectionVector(int whichrow) const
|
|---|
| 238 | { return table_->getDirectionVector(whichrow); }
|
|---|
| 239 |
|
|---|
| 240 | void parallactify(bool flag)
|
|---|
| 241 | { table_->parallactify(flag); }
|
|---|
| 242 |
|
|---|
| 243 | STCoordinate getCoordinate(int row) {
|
|---|
| 244 | return STCoordinate(table_->getSpectralCoordinate(row));
|
|---|
| 245 | }
|
|---|
| 246 |
|
|---|
| 247 | std::vector<float> getWeather(int whichrow) const
|
|---|
| 248 | { return table_->getWeather(whichrow); }
|
|---|
| 249 |
|
|---|
| 250 | void reshapeSpectrum( int nmin, int nmax )
|
|---|
| 251 | { table_->reshapeSpectrum( nmin, nmax ); }
|
|---|
| 252 |
|
|---|
| 253 | STFitEntry polyBaseline(const std::vector<bool>& mask, int order, int rowno)
|
|---|
| 254 | { return table_->polyBaseline(mask, order, rowno); }
|
|---|
| 255 |
|
|---|
| 256 | void polyBaselineBatch(const std::vector<bool>& mask, int order)
|
|---|
| 257 | { table_->polyBaselineBatch(mask, order); }
|
|---|
| 258 |
|
|---|
| 259 | bool getFlagtraFast(int whichrow=0) const
|
|---|
| 260 | { return table_->getFlagtraFast(whichrow); }
|
|---|
| 261 |
|
|---|
| 262 |
|
|---|
| 263 | private:
|
|---|
| 264 | casa::CountedPtr<Scantable> table_;
|
|---|
| 265 | };
|
|---|
| 266 |
|
|---|
| 267 | } // namespace
|
|---|
| 268 | #endif
|
|---|
| 269 |
|
|---|