[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> |
---|
[1977] | 22 | #include <casa/Arrays/Matrix.h> |
---|
[1974] | 23 | #include <casa/Logging/LogIO.h> |
---|
[1977] | 24 | #include <casa/Containers/Record.h> |
---|
[1974] | 25 | |
---|
[1975] | 26 | #include <tables/Tables/Table.h> |
---|
[1974] | 27 | #include <tables/Tables/RefRows.h> |
---|
| 28 | |
---|
| 29 | #include <ms/MeasurementSets/MeasurementSet.h> |
---|
| 30 | #include <ms/MeasurementSets/MSColumns.h> |
---|
| 31 | |
---|
[1975] | 32 | #include <measures/Measures/MEpoch.h> |
---|
| 33 | |
---|
[1977] | 34 | #include <atnf/PKSIO/SrcType.h> |
---|
| 35 | |
---|
[1974] | 36 | #include "Scantable.h" |
---|
| 37 | #include "STHeader.h" |
---|
| 38 | |
---|
| 39 | namespace asap |
---|
| 40 | { |
---|
| 41 | |
---|
| 42 | class MSWriter |
---|
| 43 | { |
---|
| 44 | public: |
---|
| 45 | explicit MSWriter(casa::CountedPtr<Scantable> stable) ; |
---|
| 46 | virtual ~MSWriter() ; |
---|
| 47 | |
---|
| 48 | virtual bool write(const std::string& filename, const casa::Record& rec) ; |
---|
| 49 | |
---|
| 50 | protected: |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | private: |
---|
| 54 | |
---|
| 55 | // initialize writer from input Scantable |
---|
| 56 | void init() ; |
---|
| 57 | |
---|
| 58 | // set up MS |
---|
| 59 | void setupMS() ; |
---|
| 60 | |
---|
| 61 | // fill subtables |
---|
| 62 | void fillObservation() ; |
---|
| 63 | void fillAntenna() ; |
---|
[1975] | 64 | void fillProcessor() ; |
---|
| 65 | void fillSource() ; |
---|
[1977] | 66 | void fillWeather() ; |
---|
| 67 | void fillSysCal() ; |
---|
[1975] | 68 | |
---|
[2104] | 69 | // fill empty rows |
---|
| 70 | void infillSpectralWindow() ; |
---|
| 71 | |
---|
[1975] | 72 | // add rows to subtables |
---|
[1974] | 73 | void addFeed( casa::Int id ) ; |
---|
| 74 | void addSpectralWindow( casa::Int spwid, casa::Int freqid ) ; |
---|
[1975] | 75 | void addField( casa::Int fid, casa::String fieldname, casa::String srcname, casa::Double t, casa::Vector<casa::Double> scanrate ) ; |
---|
[2016] | 76 | void addPointing( casa::String &name, casa::Double &me, casa::Double &interval, casa::Matrix<casa::Double> &dir ) ; |
---|
[1974] | 77 | casa::Int addPolarization( casa::Vector<casa::Int> polnos ) ; |
---|
| 78 | casa::Int addDataDescription( casa::Int polid, casa::Int spwid ) ; |
---|
[1977] | 79 | casa::Int addState( casa::Int type, casa::Int &subscan ) ; |
---|
[1974] | 80 | |
---|
| 81 | // utility |
---|
| 82 | casa::Vector<casa::Int> toCorrType( casa::Vector<casa::Int> polnos ) ; |
---|
[2016] | 83 | void getValidTimeRange( casa::Double &me, casa::Double &interval, casa::Table &tab ) ; |
---|
[2018] | 84 | void getValidTimeRange( casa::Double &me, casa::Double &interval, casa::Vector<casa::Double> &atime, casa::Vector<casa::Double> &ainterval ) ; |
---|
[2016] | 85 | //void queryType( casa::Int type, casa::String &stype, casa::Bool &b ) ; |
---|
| 86 | void queryType( casa::Int type, casa::String &stype, casa::Bool &b, casa::Double &t, Double &l ) ; |
---|
[2026] | 87 | casa::Double getDishDiameter( casa::String antname ) ; |
---|
[1974] | 88 | |
---|
[2016] | 89 | // tool for HPC |
---|
| 90 | double gettimeofday_sec() ; |
---|
| 91 | |
---|
[1974] | 92 | casa::CountedPtr<Scantable> table_ ; |
---|
| 93 | STHeader header_ ; |
---|
[2016] | 94 | //casa::CountedPtr<casa::MeasurementSet> mstable_ ; |
---|
| 95 | casa::MeasurementSet *mstable_ ; |
---|
[1974] | 96 | |
---|
[2019] | 97 | casa::Bool isTcal_ ; |
---|
| 98 | casa::Bool isWeather_ ; |
---|
| 99 | |
---|
[1977] | 100 | casa::Bool useFloatData_ ; |
---|
| 101 | casa::Bool useData_ ; |
---|
| 102 | casa::Bool tcalSpec_ ; |
---|
| 103 | casa::Bool tsysSpec_ ; |
---|
| 104 | |
---|
[2016] | 105 | casa::String ptTabName_ ; |
---|
| 106 | |
---|
[1974] | 107 | casa::String polType_ ; |
---|
| 108 | |
---|
| 109 | casa::String filename_ ; |
---|
| 110 | |
---|
| 111 | casa::LogIO os_ ; |
---|
[1977] | 112 | |
---|
| 113 | casa::Record tcalIdRec_ ; |
---|
[2016] | 114 | casa::Record tcalRowRec_ ; |
---|
[1974] | 115 | |
---|
| 116 | MSWriter(); |
---|
| 117 | MSWriter(const MSWriter&); |
---|
| 118 | MSWriter& operator=(const MSWriter&); |
---|
| 119 | |
---|
| 120 | }; |
---|
| 121 | |
---|
| 122 | |
---|
| 123 | }; |
---|
| 124 | #endif |
---|