[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] | 23 | namespace 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 | */ |
---|
| 35 | class ScantableWrapper { |
---|
[2] | 36 | |
---|
| 37 | public: |
---|
[1385] | 38 | explicit 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 | |
---|
[1350] | 46 | explicit 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 | |
---|
[1350] | 53 | explicit 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 | |
---|
[1350] | 87 | double getIntTime(int whichrow=0) const |
---|
| 88 | { return table_->getIntTime(whichrow); } |
---|
| 89 | |
---|
[1068] | 90 | std::string getDirectionString(int whichrow=0) const |
---|
| 91 | { return table_->getDirectionString(whichrow); } |
---|
| 92 | |
---|
[864] | 93 | std::string getFluxUnit() const { return table_->getFluxUnit(); } |
---|
| 94 | |
---|
| 95 | void setFluxUnit(const std::string& unit) { table_->setFluxUnit(unit); } |
---|
| 96 | |
---|
[238] | 97 | void setInstrument(const std::string& name) {table_->setInstrument(name);} |
---|
[1189] | 98 | void setFeedType(const std::string& ftype) {table_->setFeedType(ftype);} |
---|
[238] | 99 | |
---|
[896] | 100 | std::vector<bool> getMask(int whichrow=0) const |
---|
| 101 | { return table_->getMask(whichrow); } |
---|
[2] | 102 | |
---|
[1400] | 103 | /** |
---|
[1000] | 104 | void flag(const std::vector<bool>& msk=std::vector<bool>()) |
---|
| 105 | { table_->flag(msk); } |
---|
[1400] | 106 | **/ |
---|
| 107 | void flag(const std::vector<bool>& msk=std::vector<bool>(), bool unflag=false) |
---|
| 108 | { table_->flag(msk, unflag); } |
---|
[2] | 109 | |
---|
[1656] | 110 | void flagRow(const std::vector<casa::uInt>& rows=std::vector<casa::uInt>(), bool unflag=false) |
---|
| 111 | { table_->flagRow(rows, unflag); } |
---|
| 112 | |
---|
| 113 | bool getFlagRow(int whichrow=0) const |
---|
| 114 | { return table_->getFlagRow(whichrow); } |
---|
| 115 | |
---|
[1703] | 116 | void clip(const casa::Float uthres, const casa::Float dthres, bool clipoutside=true, bool unflag=false) |
---|
[1700] | 117 | { table_->clip(uthres, dthres, clipoutside, unflag); } |
---|
| 118 | |
---|
[1707] | 119 | std::vector<bool> getClipMask(int whichrow, const casa::Float uthres, const casa::Float dthres, bool clipoutside, bool unflag) const |
---|
| 120 | { return table_->getClipMask(whichrow, uthres, dthres, clipoutside, unflag); } |
---|
| 121 | |
---|
[896] | 122 | std::string getSourceName(int whichrow=0) const |
---|
| 123 | { return table_->getSourceName(whichrow); } |
---|
[794] | 124 | |
---|
[896] | 125 | float getElevation(int whichrow=0) const |
---|
| 126 | { return table_->getElevation(whichrow); } |
---|
[90] | 127 | |
---|
[896] | 128 | float getAzimuth(int whichrow=0) const |
---|
| 129 | { return table_->getAzimuth(whichrow); } |
---|
[2] | 130 | |
---|
[896] | 131 | float getParAngle(int whichrow=0) const |
---|
| 132 | { return table_->getParAngle(whichrow); } |
---|
[2] | 133 | |
---|
[864] | 134 | |
---|
[884] | 135 | void setSpectrum(std::vector<float> spectrum, int whichrow=0) |
---|
| 136 | { table_->setSpectrum(spectrum, whichrow); } |
---|
[868] | 137 | |
---|
[1111] | 138 | std::vector<uint> getIFNos() { return table_->getIFNos(); } |
---|
[864] | 139 | int getIF(int whichrow) const {return table_->getIF(whichrow);} |
---|
[1111] | 140 | std::vector<uint> getBeamNos() { return table_->getBeamNos(); } |
---|
[864] | 141 | int getBeam(int whichrow) const {return table_->getBeam(whichrow);} |
---|
[1111] | 142 | std::vector<uint> getPolNos() { return table_->getPolNos(); } |
---|
[864] | 143 | int getPol(int whichrow) const {return table_->getPol(whichrow);} |
---|
[868] | 144 | int getCycle(int whichrow) const {return table_->getCycle(whichrow);} |
---|
[1111] | 145 | std::vector<uint> getScanNos() { return table_->getScanNos(); } |
---|
[868] | 146 | int getScan(int whichrow) const {return table_->getScan(whichrow);} |
---|
[1446] | 147 | std::vector<uint> getMolNos() { return table_->getMolNos();} |
---|
[864] | 148 | |
---|
| 149 | STSelector getSelection() const { return table_->getSelection(); } |
---|
[868] | 150 | void setSelection(const STSelector& sts) |
---|
| 151 | { return table_->setSelection(sts);} |
---|
[864] | 152 | |
---|
[896] | 153 | std::string getPolType() const { return table_->getPolType(); } |
---|
| 154 | |
---|
[864] | 155 | int nif(int scanno=-1) const {return table_->nif(scanno);} |
---|
| 156 | int nbeam(int scanno=-1) const {return table_->nbeam(scanno);} |
---|
| 157 | int npol(int scanno=-1) const {return table_->npol(scanno);} |
---|
| 158 | int nchan(int ifno=-1) const {return table_->nchan(ifno);} |
---|
| 159 | int nscan() const {return table_->nscan();} |
---|
| 160 | int nrow() const {return table_->nrow();} |
---|
[902] | 161 | int ncycle(int scanno) const {return table_->ncycle(scanno);} |
---|
[2] | 162 | |
---|
[864] | 163 | void makePersistent(const std::string& fname) |
---|
| 164 | { table_->makePersistent(fname); } |
---|
[90] | 165 | |
---|
[1068] | 166 | void setSourceType(int stype) |
---|
| 167 | { table_->setSourceType(stype); } |
---|
| 168 | |
---|
[1360] | 169 | void shift(int npix) |
---|
| 170 | { table_->shift(npix); } |
---|
| 171 | |
---|
[1446] | 172 | /** |
---|
| 173 | commented out by TT |
---|
[1170] | 174 | void setRestFrequencies(double rf, const std::string& name, |
---|
| 175 | const std::string& unit) |
---|
| 176 | { table_->setRestFrequencies(rf, name, unit); } |
---|
[1446] | 177 | **/ |
---|
| 178 | void setRestFrequencies(vector<double> rf, const vector<std::string>& name, |
---|
| 179 | const std::string& unit) |
---|
| 180 | { table_->setRestFrequencies(rf, name, unit); } |
---|
| 181 | |
---|
[925] | 182 | /* |
---|
[868] | 183 | void setRestFrequencies(const std::string& name) { |
---|
| 184 | table_->setRestFrequencies(name); |
---|
[847] | 185 | } |
---|
[925] | 186 | */ |
---|
[745] | 187 | |
---|
[1446] | 188 | /* |
---|
[864] | 189 | std::vector<double> getRestFrequencies() const |
---|
| 190 | { return table_->getRestFrequencies(); } |
---|
[1446] | 191 | */ |
---|
| 192 | std::vector<double> getRestFrequency(int id) const |
---|
| 193 | { return table_->getRestFrequency(id); } |
---|
[251] | 194 | |
---|
[105] | 195 | void setCoordInfo(std::vector<string> theinfo) { |
---|
| 196 | table_->setCoordInfo(theinfo); |
---|
| 197 | } |
---|
| 198 | std::vector<string> getCoordInfo() const { |
---|
| 199 | return table_->getCoordInfo(); |
---|
| 200 | } |
---|
[90] | 201 | |
---|
[987] | 202 | void setDirection(const std::string& refstr="") |
---|
| 203 | { table_->setDirectionRefString(refstr); } |
---|
| 204 | |
---|
[847] | 205 | casa::CountedPtr<Scantable> getCP() const {return table_;} |
---|
| 206 | Scantable* getPtr() {return &(*table_);} |
---|
[380] | 207 | |
---|
[745] | 208 | std::string summary(bool verbose=false) const { |
---|
| 209 | return table_->summary(verbose); |
---|
[380] | 210 | } |
---|
[745] | 211 | |
---|
[864] | 212 | std::vector<std::string> getHistory()const |
---|
| 213 | { return table_->getHistory(); } |
---|
[207] | 214 | |
---|
[864] | 215 | void addHistory(const std::string& hist) |
---|
| 216 | { table_->addHistory(hist); } |
---|
[745] | 217 | |
---|
[972] | 218 | void addFit(const STFitEntry& fit, int row) |
---|
| 219 | { table_->addFit(fit, row); } |
---|
| 220 | |
---|
| 221 | STFitEntry getFit(int whichrow) const |
---|
| 222 | { return table_->getFit(whichrow); } |
---|
| 223 | |
---|
[777] | 224 | void calculateAZEL() { table_->calculateAZEL(); }; |
---|
[465] | 225 | |
---|
[1003] | 226 | std::vector<std::string> columnNames() const |
---|
| 227 | { return table_->columnNames(); } |
---|
| 228 | |
---|
[1388] | 229 | std::string getAntennaName() const |
---|
| 230 | { return table_->getAntennaName(); } |
---|
| 231 | |
---|
| 232 | int checkScanInfo(const vector<int>& scanlist) const |
---|
| 233 | { return table_->checkScanInfo(scanlist); } |
---|
[1446] | 234 | |
---|
[1388] | 235 | std::vector<double> getDirectionVector(int whichrow) const |
---|
| 236 | { return table_->getDirectionVector(whichrow); } |
---|
| 237 | |
---|
[1446] | 238 | void reshapeSpectrum( int nmin, int nmax ) |
---|
| 239 | { table_->reshapeSpectrum( nmin, nmax ); } |
---|
| 240 | |
---|
[2] | 241 | private: |
---|
[847] | 242 | casa::CountedPtr<Scantable> table_; |
---|
[2] | 243 | }; |
---|
| 244 | |
---|
| 245 | } // namespace |
---|
| 246 | #endif |
---|
[421] | 247 | |
---|