| 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/Arrays/Matrix.h>
|
|---|
| 23 | #include <casa/Logging/LogIO.h>
|
|---|
| 24 | #include <casa/Containers/Record.h>
|
|---|
| 25 | #include <casa/Containers/RecordField.h>
|
|---|
| 26 |
|
|---|
| 27 | #include <tables/Tables/Table.h>
|
|---|
| 28 | #include <tables/Tables/RefRows.h>
|
|---|
| 29 |
|
|---|
| 30 | #include <ms/MeasurementSets/MeasurementSet.h>
|
|---|
| 31 | #include <ms/MeasurementSets/MSColumns.h>
|
|---|
| 32 |
|
|---|
| 33 | #include <measures/Measures/MEpoch.h>
|
|---|
| 34 |
|
|---|
| 35 | #include <atnf/PKSIO/SrcType.h>
|
|---|
| 36 |
|
|---|
| 37 | #include "Scantable.h"
|
|---|
| 38 | #include "STHeader.h"
|
|---|
| 39 |
|
|---|
| 40 | namespace asap
|
|---|
| 41 | {
|
|---|
| 42 | class MSWriterUtils
|
|---|
| 43 | {
|
|---|
| 44 | protected:
|
|---|
| 45 | template<class T> void putField( const String &name,
|
|---|
| 46 | TableRecord &r,
|
|---|
| 47 | T &val )
|
|---|
| 48 | {
|
|---|
| 49 | RecordFieldPtr<T> rf( r, name ) ;
|
|---|
| 50 | *rf = val ;
|
|---|
| 51 | }
|
|---|
| 52 | template<class T> void defineField( const String &name,
|
|---|
| 53 | TableRecord &r,
|
|---|
| 54 | T &val )
|
|---|
| 55 | {
|
|---|
| 56 | RecordFieldPtr<T> rf( r, name ) ;
|
|---|
| 57 | rf.define( val ) ;
|
|---|
| 58 | }
|
|---|
| 59 | };
|
|---|
| 60 |
|
|---|
| 61 | class MSWriter
|
|---|
| 62 | {
|
|---|
| 63 | public:
|
|---|
| 64 | explicit MSWriter(casa::CountedPtr<Scantable> stable) ;
|
|---|
| 65 | virtual ~MSWriter() ;
|
|---|
| 66 |
|
|---|
| 67 | virtual bool write(const std::string& filename, const casa::Record& rec) ;
|
|---|
| 68 |
|
|---|
| 69 | protected:
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 | private:
|
|---|
| 73 |
|
|---|
| 74 | // initialize writer from input Scantable
|
|---|
| 75 | void init() ;
|
|---|
| 76 |
|
|---|
| 77 | // set up MS
|
|---|
| 78 | void setupMS() ;
|
|---|
| 79 |
|
|---|
| 80 | // fill subtables
|
|---|
| 81 | void fillObservation() ;
|
|---|
| 82 | void fillAntenna() ;
|
|---|
| 83 | void fillProcessor() ;
|
|---|
| 84 | void fillSource() ;
|
|---|
| 85 | void fillWeather() ;
|
|---|
| 86 | void fillSysCal() ;
|
|---|
| 87 |
|
|---|
| 88 | // utility
|
|---|
| 89 | void getValidTimeRange( casa::Double &me, casa::Double &interval, casa::Table &tab ) ;
|
|---|
| 90 | void getValidTimeRange( casa::Double &me, casa::Double &interval, casa::Vector<casa::Double> &atime, casa::Vector<casa::Double> &ainterval ) ;
|
|---|
| 91 | void antennaProperty( casa::String &name, casa::String &mount, casa::String &type, casa::Double &diameter ) ;
|
|---|
| 92 |
|
|---|
| 93 | casa::CountedPtr<Scantable> table_ ;
|
|---|
| 94 | STHeader header_ ;
|
|---|
| 95 | casa::MeasurementSet *mstable_ ;
|
|---|
| 96 |
|
|---|
| 97 | casa::Bool isWeather_ ;
|
|---|
| 98 |
|
|---|
| 99 | casa::Bool useFloatData_ ;
|
|---|
| 100 | casa::Bool useData_ ;
|
|---|
| 101 | casa::Bool tcalSpec_ ;
|
|---|
| 102 | casa::Bool tsysSpec_ ;
|
|---|
| 103 |
|
|---|
| 104 | casa::String ptTabName_ ;
|
|---|
| 105 |
|
|---|
| 106 | casa::String polType_ ;
|
|---|
| 107 |
|
|---|
| 108 | casa::String filename_ ;
|
|---|
| 109 |
|
|---|
| 110 | casa::LogIO os_ ;
|
|---|
| 111 |
|
|---|
| 112 | casa::Record srcRec_ ;
|
|---|
| 113 |
|
|---|
| 114 | MSWriter();
|
|---|
| 115 | MSWriter(const MSWriter&);
|
|---|
| 116 | MSWriter& operator=(const MSWriter&);
|
|---|
| 117 |
|
|---|
| 118 | };
|
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 | };
|
|---|
| 122 | #endif
|
|---|