// // C++ Interface: Scantable // // Description: // // // Author: Malte Marquarding , (C) 2006 // // Copyright: See COPYING file that comes with this distribution // // #ifndef ASAPSCANTABLEWRAPPER_H #define ASAPSCANTABLEWRAPPER_H #include #include #include #include "MathUtils.h" #include "STFit.h" #include "Scantable.h" #include "STCoordinate.h" namespace asap { /** * This class contains and wraps a CountedPtr, as the CountedPtr * class does not provide the dor operator which is need for references * in boost::python * see Scantable for interfce description * * @brief The main ASAP data container wrapper * @author Malte Marquarding * @date 2006-02-23 * @version 2.0a */ class ScantableWrapper { public: explicit ScantableWrapper( const std::string& name, int type=0) { casa::Table::TableType tp = casa::Table::Memory; if ( type == 1 ) tp = casa::Table::Plain; table_ = new Scantable(name, tp); } explicit ScantableWrapper(int type=0) { casa::Table::TableType tp = casa::Table::Memory; if ( type == 1) tp = casa::Table::Plain; table_= new Scantable(tp); } explicit ScantableWrapper(casa::CountedPtr cp) : table_(cp) {;} ScantableWrapper(const ScantableWrapper& mt) : table_(mt.getCP()) {;} void assign(const ScantableWrapper& mt) { table_= mt.getCP(); } ScantableWrapper copy() { return ScantableWrapper(new Scantable(*(this->getCP()), false)); } std::vector getSpectrum( int whichrow=0, const std::string& poltype="" ) const { return table_->getSpectrum(whichrow, poltype); } // std::string getPolarizationLabel(bool linear, bool stokes, bool linPol, int polIdx) const { // Boost fails with 4 arguments. std::string getPolarizationLabel(int index, const std::string& ptype) const { return table_->getPolarizationLabel(index, ptype); } std::vector getAbcissa(int whichrow=0) const { return table_->getAbcissa(whichrow); } std::string getAbcissaLabel(int whichrow=0) const { return table_->getAbcissaLabel(whichrow); } float getTsys(int whichrow=0) const { return table_->getTsys(whichrow); } std::string getTime(int whichrow=0) const { return table_->getTime(whichrow); } double getIntTime(int whichrow=0) const { return table_->getIntTime(whichrow); } std::string getDirectionString(int whichrow=0) const { return table_->getDirectionString(whichrow); } std::string getFluxUnit() const { return table_->getFluxUnit(); } void setFluxUnit(const std::string& unit) { table_->setFluxUnit(unit); } void setInstrument(const std::string& name) {table_->setInstrument(name);} void setFeedType(const std::string& ftype) {table_->setFeedType(ftype);} std::vector getMask(int whichrow=0) const { return table_->getMask(whichrow); } /** void flag(const std::vector& msk=std::vector()) { table_->flag(msk); } **/ void flag(const std::vector& msk=std::vector(), bool unflag=false) { table_->flag(msk, unflag); } std::string getSourceName(int whichrow=0) const { return table_->getSourceName(whichrow); } float getElevation(int whichrow=0) const { return table_->getElevation(whichrow); } float getAzimuth(int whichrow=0) const { return table_->getAzimuth(whichrow); } float getParAngle(int whichrow=0) const { return table_->getParAngle(whichrow); } void setSpectrum(std::vector spectrum, int whichrow=0) { table_->setSpectrum(spectrum, whichrow); } std::vector getIFNos() { return table_->getIFNos(); } int getIF(int whichrow) const {return table_->getIF(whichrow);} std::vector getBeamNos() { return table_->getBeamNos(); } int getBeam(int whichrow) const {return table_->getBeam(whichrow);} std::vector getPolNos() { return table_->getPolNos(); } int getPol(int whichrow) const {return table_->getPol(whichrow);} int getCycle(int whichrow) const {return table_->getCycle(whichrow);} std::vector getScanNos() { return table_->getScanNos(); } int getScan(int whichrow) const {return table_->getScan(whichrow);} STSelector getSelection() const { return table_->getSelection(); } void setSelection(const STSelector& sts) { return table_->setSelection(sts);} std::string getPolType() const { return table_->getPolType(); } int nif(int scanno=-1) const {return table_->nif(scanno);} int nbeam(int scanno=-1) const {return table_->nbeam(scanno);} int npol(int scanno=-1) const {return table_->npol(scanno);} int nchan(int ifno=-1) const {return table_->nchan(ifno);} int nscan() const {return table_->nscan();} int nrow() const {return table_->nrow();} int ncycle(int scanno) const {return table_->ncycle(scanno);} void makePersistent(const std::string& fname) { table_->makePersistent(fname); } void setSourceType(int stype) { table_->setSourceType(stype); } void shift(int npix) { table_->shift(npix); } void setRestFrequencies(double rf, const std::string& name, const std::string& unit) { table_->setRestFrequencies(rf, name, unit); } /* void setRestFrequencies(const std::string& name) { table_->setRestFrequencies(name); } */ std::vector getRestFrequencies() const { return table_->getRestFrequencies(); } void setCoordInfo(std::vector theinfo) { table_->setCoordInfo(theinfo); } std::vector getCoordInfo() const { return table_->getCoordInfo(); } void setDirection(const std::string& refstr="") { table_->setDirectionRefString(refstr); } casa::CountedPtr getCP() const {return table_;} Scantable* getPtr() {return &(*table_);} std::string summary(bool verbose=false) const { return table_->summary(verbose); } std::vector getHistory()const { return table_->getHistory(); } void addHistory(const std::string& hist) { table_->addHistory(hist); } void addFit(const STFitEntry& fit, int row) { table_->addFit(fit, row); } STFitEntry getFit(int whichrow) const { return table_->getFit(whichrow); } void calculateAZEL() { table_->calculateAZEL(); }; std::vector columnNames() const { return table_->columnNames(); } std::string getAntennaName() const { return table_->getAntennaName(); } int checkScanInfo(const vector& scanlist) const { return table_->checkScanInfo(scanlist); } std::vector getDirectionVector(int whichrow) const { return table_->getDirectionVector(whichrow); } void parallactify(bool flag) { table_->parallactify(flag); } STCoordinate getCoordinate(int row) { return STCoordinate(table_->getSpectralCoordinate(row)); } std::vector getWeather(int whichrow) const { return table_->getWeather(whichrow); } private: casa::CountedPtr table_; }; } // namespace #endif