[1778] | 1 | //
|
---|
| 2 | // C++ Interface: FillerBase
|
---|
| 3 | //
|
---|
| 4 | // Description:
|
---|
| 5 | //
|
---|
| 6 | // This class is the Base class for all data fillers.
|
---|
| 7 | // The derived filler needs to implement
|
---|
| 8 | // open()
|
---|
| 9 | // close()
|
---|
| 10 | // fill()
|
---|
| 11 | //
|
---|
| 12 | // The fill() method usually iterates over the source data and calls
|
---|
| 13 | // the setXYZ() methods for. After all the data for a row has been set via
|
---|
| 14 | // these methods, the fill() method needs to call commitRow() to write the
|
---|
| 15 | // data to the scantable.
|
---|
| 16 | // All arguments which are defaulted in the setXYZ() methods are optional. All
|
---|
| 17 | // others should be set explicitly.
|
---|
| 18 | //
|
---|
| 19 | // Author: Malte Marquarding <asap@atnf.csiro.au>, (C) 2010
|
---|
| 20 | //
|
---|
| 21 | // Copyright: See COPYING file that comes with this distribution
|
---|
| 22 | //
|
---|
| 23 | //
|
---|
| 24 | #ifndef ASAPFILLERBASE_H
|
---|
| 25 | #define ASAPFILLERBASE_H
|
---|
| 26 |
|
---|
| 27 | // STL
|
---|
| 28 | #include <string>
|
---|
[2289] | 29 | #include <vector>
|
---|
[1778] | 30 | // AIPS++
|
---|
| 31 | #include <casa/aips.h>
|
---|
[1780] | 32 | #include <casa/Utilities/CountedPtr.h>
|
---|
| 33 | #include <casa/Arrays/Vector.h>
|
---|
| 34 | #include <tables/Tables/TableRow.h>
|
---|
| 35 | #include "Scantable.h"
|
---|
[1778] | 36 |
|
---|
| 37 | namespace asap
|
---|
| 38 | {
|
---|
| 39 |
|
---|
| 40 | class FillerBase
|
---|
| 41 | {
|
---|
| 42 | public:
|
---|
[3106] | 43 | explicit FillerBase(casacore::CountedPtr<Scantable> stable);
|
---|
[1795] | 44 | virtual ~FillerBase() {;}
|
---|
[1778] | 45 |
|
---|
[3106] | 46 | virtual bool open(const std::string& filename, const casacore::Record& rec) = 0;
|
---|
[1904] | 47 | // virtual bool open(const std::string& filename) = 0;
|
---|
[1778] | 48 | virtual void fill() = 0;
|
---|
| 49 | virtual void close() = 0;
|
---|
| 50 |
|
---|
[1786] | 51 | void setReferenceRegex(const std::string& rx) { referenceRx_ = rx; }
|
---|
[1793] | 52 | std::string getReferenceRegex() { return referenceRx_; }
|
---|
[1786] | 53 |
|
---|
[1778] | 54 | protected:
|
---|
| 55 |
|
---|
| 56 | void commitRow();
|
---|
[1803] | 57 | void setHeader(const STHeader& header);
|
---|
[3106] | 58 | void setSpectrum(const casacore::Vector<casacore::Float>& spectrum,
|
---|
| 59 | const casacore::Vector<casacore::uChar>& flags,
|
---|
| 60 | const casacore::Vector<casacore::Float>& tsys);
|
---|
| 61 | void setFlagrow(casacore::uInt flag);
|
---|
| 62 | void setOpacity(casacore::Float opacity=0.0f);
|
---|
| 63 | void setIndex(casacore::uInt scanno, casacore::uInt cycleno,
|
---|
| 64 | casacore::uInt ifno, casacore::uInt polno,
|
---|
| 65 | casacore::uInt beamno=0);
|
---|
| 66 | void setFrequency(casacore::Double refpix, casacore::Double refval,
|
---|
| 67 | casacore::Double incr);
|
---|
| 68 | void setMolecule(const casacore::Vector<casacore::Double>& restfreq);
|
---|
| 69 | void setDirection(const casacore::Vector<casacore::Double>& dir,
|
---|
| 70 | casacore::Float az=0.0f, casacore::Float el=0.0f);
|
---|
[1778] | 71 |
|
---|
[3106] | 72 | void setFocus(casacore::Float pa=0.0f, casacore::Float faxis=0.0f,
|
---|
| 73 | casacore::Float ftan=0.0f, casacore::Float frot=0.0f);
|
---|
| 74 | void setTime(casacore::Double mjd, casacore::Double integration);
|
---|
| 75 | void setWeather(casacore::Float temperature=0.0f,
|
---|
| 76 | casacore::Float pressure=0.0f,
|
---|
| 77 | casacore::Float humidity=0.0f,
|
---|
| 78 | casacore::Float windspeed=0.0f,
|
---|
| 79 | casacore::Float windaz=0.0f);
|
---|
| 80 | void setWeather2(casacore::Float temperature=0.0f,
|
---|
| 81 | casacore::Float pressure=0.0f,
|
---|
| 82 | casacore::Float humidity=0.0f,
|
---|
| 83 | casacore::Float windspeed=0.0f,
|
---|
| 84 | casacore::Float windaz=0.0f);
|
---|
| 85 | void setTcal(const casacore::String& caltime="",
|
---|
| 86 | const casacore::Vector<casacore::Float>& tcal=casacore::Vector<casacore::Float>());
|
---|
| 87 | void setTcal2(const casacore::String& caltime="",
|
---|
| 88 | const casacore::Vector<casacore::Float>& tcal=casacore::Vector<casacore::Float>());
|
---|
| 89 | void setScanRate(const casacore::Vector<casacore::Double>& srate=casacore::Vector<casacore::Double>());
|
---|
| 90 | void setReferenceBeam(casacore::Int beamno=-1);
|
---|
| 91 | void setSource(const std::string& name, casacore::Int type,
|
---|
[1778] | 92 | const std::string& fieldname="",
|
---|
[3106] | 93 | const casacore::Vector<casacore::Double>& dir=casacore::Vector<casacore::Double>(),
|
---|
| 94 | const casacore::Vector<casacore::Double>& propermot=casacore::Vector<casacore::Double>(),
|
---|
| 95 | casacore::Double velocity=0.0);
|
---|
[1778] | 96 |
|
---|
[3106] | 97 | casacore::CountedPtr< Scantable > table_;
|
---|
[1795] | 98 |
|
---|
[1778] | 99 | private:
|
---|
| 100 |
|
---|
[1811] | 101 | FillerBase();
|
---|
| 102 | FillerBase(const FillerBase&);
|
---|
| 103 | FillerBase& operator=(const FillerBase&);
|
---|
[3106] | 104 | casacore::String referenceRx_;
|
---|
| 105 | casacore::TableRow row_;
|
---|
[2289] | 106 |
|
---|
[3106] | 107 | std::vector< casacore::Vector<casacore::Double> > mEntry_ ;
|
---|
| 108 | std::vector<casacore::uInt> mIdx_ ;
|
---|
| 109 | std::vector< casacore::Vector<casacore::Double> > fEntry_ ;
|
---|
| 110 | std::vector<casacore::uInt> fIdx_ ;
|
---|
| 111 | std::vector< casacore::Vector<casacore::Float> > wEntry_ ;
|
---|
| 112 | std::vector<casacore::uInt> wIdx_ ;
|
---|
[1780] | 113 | };
|
---|
[1778] | 114 |
|
---|
| 115 |
|
---|
| 116 | };
|
---|
[1780] | 117 | #endif
|
---|