[1974] | 1 | // |
---|
| 2 | // C++ Interface: MSWriter |
---|
| 3 | // |
---|
| 4 | // Description: |
---|
| 5 | // |
---|
| 6 | // This class is specific writer for MS format |
---|
| 7 | // |
---|
| 8 | // Takeshi Nakazato <takeshi.nakazato@nao.ac.jp>, (C) 2010 |
---|
| 9 | // |
---|
| 10 | // Copyright: See COPYING file that comes with this distribution |
---|
| 11 | // |
---|
| 12 | // |
---|
| 13 | #ifndef ASAPMSWRITER_H |
---|
| 14 | #define ASAPMSWRITER_H |
---|
| 15 | |
---|
| 16 | // STL |
---|
| 17 | #include <string> |
---|
| 18 | // AIPS++ |
---|
| 19 | #include <casa/aips.h> |
---|
| 20 | #include <casa/Utilities/CountedPtr.h> |
---|
| 21 | #include <casa/Arrays/Vector.h> |
---|
| 22 | #include <casa/Logging/LogIO.h> |
---|
| 23 | |
---|
[1975] | 24 | #include <tables/Tables/Table.h> |
---|
[1974] | 25 | #include <tables/Tables/RefRows.h> |
---|
| 26 | |
---|
| 27 | #include <ms/MeasurementSets/MeasurementSet.h> |
---|
| 28 | #include <ms/MeasurementSets/MSColumns.h> |
---|
| 29 | |
---|
[1975] | 30 | #include <measures/Measures/MEpoch.h> |
---|
| 31 | |
---|
[1974] | 32 | #include "Scantable.h" |
---|
| 33 | #include "STHeader.h" |
---|
| 34 | |
---|
| 35 | namespace asap |
---|
| 36 | { |
---|
| 37 | |
---|
| 38 | class MSWriter |
---|
| 39 | { |
---|
| 40 | public: |
---|
| 41 | explicit MSWriter(casa::CountedPtr<Scantable> stable) ; |
---|
| 42 | virtual ~MSWriter() ; |
---|
| 43 | |
---|
| 44 | virtual bool write(const std::string& filename, const casa::Record& rec) ; |
---|
| 45 | |
---|
| 46 | protected: |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | private: |
---|
| 50 | |
---|
| 51 | // initialize writer from input Scantable |
---|
| 52 | void init() ; |
---|
| 53 | |
---|
| 54 | // set up MS |
---|
| 55 | void setupMS() ; |
---|
| 56 | |
---|
| 57 | // fill subtables |
---|
| 58 | void fillObservation() ; |
---|
| 59 | void fillAntenna() ; |
---|
[1975] | 60 | void fillProcessor() ; |
---|
| 61 | void fillSource() ; |
---|
| 62 | |
---|
| 63 | // add rows to subtables |
---|
[1974] | 64 | void addFeed( casa::Int id ) ; |
---|
| 65 | void addSpectralWindow( casa::Int spwid, casa::Int freqid ) ; |
---|
[1975] | 66 | void addField( casa::Int fid, casa::String fieldname, casa::String srcname, casa::Double t, casa::Vector<casa::Double> scanrate ) ; |
---|
[1974] | 67 | casa::Int addPolarization( casa::Vector<casa::Int> polnos ) ; |
---|
| 68 | casa::Int addDataDescription( casa::Int polid, casa::Int spwid ) ; |
---|
| 69 | |
---|
| 70 | // utility |
---|
| 71 | casa::Vector<casa::Int> toCorrType( casa::Vector<casa::Int> polnos ) ; |
---|
[1975] | 72 | void getValidTimeRange( casa::MEpoch &me, casa::Double &interval, casa::Table &tab ) ; |
---|
[1974] | 73 | |
---|
| 74 | casa::CountedPtr<Scantable> table_ ; |
---|
| 75 | STHeader header_ ; |
---|
| 76 | casa::CountedPtr<casa::MeasurementSet> mstable_ ; |
---|
| 77 | |
---|
| 78 | casa::Bool isFloatData_ ; |
---|
| 79 | casa::Bool isData_ ; |
---|
| 80 | casa::String polType_ ; |
---|
| 81 | |
---|
| 82 | casa::String filename_ ; |
---|
| 83 | |
---|
| 84 | casa::LogIO os_ ; |
---|
| 85 | |
---|
| 86 | MSWriter(); |
---|
| 87 | MSWriter(const MSWriter&); |
---|
| 88 | MSWriter& operator=(const MSWriter&); |
---|
| 89 | |
---|
| 90 | }; |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | }; |
---|
| 94 | #endif |
---|