[1974] | 1 | //
|
---|
| 2 | // C++ Interface: MSFiller
|
---|
| 3 | //
|
---|
| 4 | // Description:
|
---|
| 5 | //
|
---|
| 6 | // This class is specific filler 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 ASAPMSFILLER_H
|
---|
| 14 | #define ASAPMSFILLER_H
|
---|
| 15 |
|
---|
| 16 | // STL
|
---|
| 17 | #include <string>
|
---|
[1987] | 18 |
|
---|
| 19 | // Boost
|
---|
| 20 | #include <boost/pool/object_pool.hpp>
|
---|
| 21 |
|
---|
[1974] | 22 | // AIPS++
|
---|
| 23 | #include <casa/aips.h>
|
---|
| 24 | #include <casa/Utilities/CountedPtr.h>
|
---|
| 25 | #include <casa/Arrays/Vector.h>
|
---|
[1987] | 26 | #include <casa/Arrays/Matrix.h>
|
---|
[1993] | 27 | #include <casa/Arrays/Cube.h>
|
---|
[1974] | 28 | #include <casa/Logging/LogIO.h>
|
---|
| 29 |
|
---|
| 30 | #include <casa/Containers/Record.h>
|
---|
[2002] | 31 | #include <casa/Containers/Block.h>
|
---|
[1974] | 32 |
|
---|
| 33 | #include <ms/MeasurementSets/MeasurementSet.h>
|
---|
[1987] | 34 | #include <ms/MeasurementSets/MSPointing.h>
|
---|
[1974] | 35 |
|
---|
| 36 | #include "Scantable.h"
|
---|
| 37 |
|
---|
| 38 | namespace asap
|
---|
| 39 | {
|
---|
| 40 |
|
---|
| 41 | class MSFiller
|
---|
| 42 | {
|
---|
| 43 | public:
|
---|
| 44 | explicit MSFiller(casa::CountedPtr<Scantable> stable) ;
|
---|
| 45 | virtual ~MSFiller() ;
|
---|
| 46 |
|
---|
| 47 | virtual bool open(const std::string& filename, const casa::Record& rec) ;
|
---|
| 48 | virtual void fill() ;
|
---|
| 49 | virtual void close() ;
|
---|
| 50 |
|
---|
| 51 | protected:
|
---|
| 52 |
|
---|
| 53 |
|
---|
| 54 | private:
|
---|
| 55 |
|
---|
| 56 | MSFiller();
|
---|
| 57 | MSFiller(const MSFiller&);
|
---|
| 58 | MSFiller& operator=(const MSFiller&);
|
---|
| 59 |
|
---|
| 60 | // fill subtables
|
---|
| 61 | //void fillFrequencies() ;
|
---|
| 62 | //void fillMolecules() ;
|
---|
| 63 | void fillWeather() ;
|
---|
| 64 | void fillFocus() ;
|
---|
| 65 | //void fillHistory() ;
|
---|
| 66 | //void fillFit() ;
|
---|
[2002] | 67 | void fillTcal( boost::object_pool<casa::ROTableColumn> *poolr ) ;
|
---|
[1974] | 68 |
|
---|
| 69 | // get SRCTYPE from STATE_ID
|
---|
[1987] | 70 | casa::Int getSrcType( casa::Int stateId, boost::object_pool<casa::ROTableColumn> *pool ) ;
|
---|
[1974] | 71 |
|
---|
| 72 | // get POLNO from CORR_TYPE
|
---|
[2002] | 73 | casa::Block<casa::uInt> getPolNo( casa::Int corrType ) ;
|
---|
[1974] | 74 |
|
---|
| 75 | // get poltype from CORR_TYPE
|
---|
| 76 | casa::String getPolType( casa::Int corrType ) ;
|
---|
| 77 |
|
---|
| 78 | // get WEATHER_ID
|
---|
| 79 | casa::uInt getWeatherId( casa::uInt idx, casa::Double wtime ) ;
|
---|
| 80 |
|
---|
| 81 | // get time stamp in SYSCAL table
|
---|
| 82 | // assume that tab is selected by ANTENNA_ID, FEED_ID, SPECTRAL_WINDOW_ID
|
---|
| 83 | // and sorted by TIME
|
---|
[2017] | 84 | void getSysCalTime( casa::Vector<casa::MEpoch> &scTimeIn, casa::Vector<casa::Double> &scInterval, casa::Block<casa::MEpoch> &tcol, casa::Block<casa::Int> &tidx ) ;
|
---|
[1974] | 85 |
|
---|
| 86 | // get TCAL_ID
|
---|
[2004] | 87 | casa::Block<casa::uInt> getTcalId( casa::Int feedId, casa::Int spwId, casa::MEpoch &t ) ;
|
---|
[1974] | 88 |
|
---|
| 89 | // get direction for DIRECTION, AZIMUTH, and ELEVATION columns
|
---|
[2238] | 90 | casa::uInt getDirection( casa::uInt idx,
|
---|
| 91 | casa::Vector<casa::Double> &dir,
|
---|
| 92 | casa::Vector<casa::Double> &srate,
|
---|
| 93 | casa::String &ref,
|
---|
[2246] | 94 | casa::Vector<casa::Double> &ptcol,
|
---|
[2238] | 95 | casa::ROArrayColumn<casa::Double> &pdcol,
|
---|
| 96 | casa::Double t ) ;
|
---|
| 97 | casa::uInt getDirection( casa::uInt idx,
|
---|
| 98 | casa::Vector<casa::Double> &dir,
|
---|
| 99 | casa::Vector<casa::Double> &azel,
|
---|
| 100 | casa::Vector<casa::Double> &srate,
|
---|
[2246] | 101 | casa::Vector<casa::Double> &ptcol,
|
---|
[2238] | 102 | casa::ROArrayColumn<casa::Double> &pdcol,
|
---|
| 103 | casa::MEpoch &t, casa::MPosition &antpos ) ;
|
---|
| 104 | void getSourceDirection( casa::Vector<casa::Double> &dir,
|
---|
| 105 | casa::Vector<casa::Double> &azel,
|
---|
| 106 | casa::Vector<casa::Double> &srate,
|
---|
| 107 | casa::MEpoch &t,
|
---|
| 108 | casa::MPosition &antpos,
|
---|
| 109 | casa::Vector<casa::MDirection> &srcdir ) ;
|
---|
[1990] | 110 |
|
---|
| 111 | // create key for TCAL table
|
---|
| 112 | casa::String keyTcal( casa::Int feedid, casa::Int spwid, casa::String stime ) ;
|
---|
[2003] | 113 |
|
---|
| 114 | // binary search
|
---|
| 115 | casa::uInt binarySearch( casa::Vector<casa::MEpoch> &timeList, casa::Double target ) ;
|
---|
[2238] | 116 | casa::uInt binarySearch( casa::Vector<casa::Double> &timeList, casa::Double target ) ;
|
---|
[2017] | 117 |
|
---|
| 118 | // tool for HPC
|
---|
| 119 | double gettimeofday_sec() ;
|
---|
[2217] | 120 |
|
---|
| 121 | // get frequency frame
|
---|
| 122 | std::string getFrame() ;
|
---|
[2237] | 123 |
|
---|
| 124 | // reshape SPECTRA and FLAGTRA
|
---|
| 125 | void reshapeSpectraAndFlagtra( casa::Cube<casa::Float> &sp,
|
---|
| 126 | casa::Cube<casa::Bool> &fl,
|
---|
| 127 | casa::Table &tab,
|
---|
| 128 | casa::Int &npol,
|
---|
| 129 | casa::Int &nchan,
|
---|
| 130 | casa::Int &nrow,
|
---|
| 131 | casa::Vector<casa::Int> &corrtype ) ;
|
---|
[1974] | 132 |
|
---|
[2237] | 133 | // initialize header
|
---|
| 134 | void initHeader( STHeader &header ) ;
|
---|
| 135 |
|
---|
| 136 | // get value from table column using object pool
|
---|
| 137 | casa::String asString( casa::String name,
|
---|
| 138 | casa::uInt idx,
|
---|
| 139 | casa::Table tab,
|
---|
| 140 | boost::object_pool<casa::ROTableColumn> *pool ) ;
|
---|
| 141 | casa::Bool asBool( casa::String name,
|
---|
| 142 | casa::uInt idx,
|
---|
| 143 | casa::Table &tab,
|
---|
| 144 | boost::object_pool<casa::ROTableColumn> *pool ) ;
|
---|
| 145 | casa::Int asInt( casa::String name,
|
---|
| 146 | casa::uInt idx,
|
---|
| 147 | casa::Table &tab,
|
---|
| 148 | boost::object_pool<casa::ROTableColumn> *pool ) ;
|
---|
| 149 | casa::uInt asuInt( casa::String name,
|
---|
| 150 | casa::uInt idx,
|
---|
| 151 | casa::Table &tab,
|
---|
| 152 | boost::object_pool<casa::ROTableColumn> *pool ) ;
|
---|
| 153 | casa::Float asFloat( casa::String name,
|
---|
| 154 | casa::uInt idx,
|
---|
| 155 | casa::Table &tab,
|
---|
| 156 | boost::object_pool<casa::ROTableColumn> *pool ) ;
|
---|
| 157 | casa::Double asDouble( casa::String name,
|
---|
| 158 | casa::uInt idx,
|
---|
| 159 | casa::Table &tab,
|
---|
| 160 | boost::object_pool<casa::ROTableColumn> *pool ) ;
|
---|
| 161 |
|
---|
| 162 | void sourceInfo( casa::Int sourceId,
|
---|
| 163 | casa::Int spwId,
|
---|
| 164 | casa::String &name,
|
---|
| 165 | casa::MDirection &direction,
|
---|
| 166 | casa::Vector<casa::Double> &properMotion,
|
---|
| 167 | casa::Vector<casa::Double> &restFreqs,
|
---|
| 168 | casa::Vector<casa::String> &transitions,
|
---|
| 169 | casa::Vector<casa::Double> &sysVels,
|
---|
| 170 | boost::object_pool<casa::ROTableColumn> *pool ) ;
|
---|
| 171 |
|
---|
| 172 | void spectralSetup( casa::Int spwId,
|
---|
| 173 | casa::MEpoch &me,
|
---|
| 174 | casa::MPosition &mp,
|
---|
| 175 | casa::MDirection &md,
|
---|
| 176 | casa::Double &refpix,
|
---|
| 177 | casa::Double &refval,
|
---|
| 178 | casa::Double &increment,
|
---|
| 179 | casa::Int &nchan,
|
---|
| 180 | casa::String &freqref,
|
---|
| 181 | casa::Double &reffreq,
|
---|
| 182 | casa::Double &bandwidth,
|
---|
| 183 | boost::object_pool<casa::ROTableColumn> *pool ) ;
|
---|
| 184 |
|
---|
[1974] | 185 | casa::CountedPtr<Scantable> table_ ;
|
---|
| 186 | casa::MeasurementSet mstable_ ;
|
---|
[1987] | 187 | casa::String tablename_ ;
|
---|
[1974] | 188 | casa::Int antenna_ ;
|
---|
[2021] | 189 | casa::String antennaStr_ ;
|
---|
[1974] | 190 | casa::Bool getPt_ ;
|
---|
| 191 |
|
---|
| 192 | casa::Bool isFloatData_ ;
|
---|
| 193 | casa::Bool isData_ ;
|
---|
| 194 |
|
---|
| 195 | casa::Bool isDoppler_ ;
|
---|
| 196 | casa::Bool isFlagCmd_ ;
|
---|
| 197 | casa::Bool isFreqOffset_ ;
|
---|
| 198 | casa::Bool isHistory_ ;
|
---|
| 199 | casa::Bool isProcessor_ ;
|
---|
| 200 | casa::Bool isSysCal_ ;
|
---|
| 201 | casa::Bool isWeather_ ;
|
---|
| 202 |
|
---|
[1993] | 203 | casa::String colTsys_ ;
|
---|
| 204 | casa::String colTcal_ ;
|
---|
| 205 |
|
---|
[1974] | 206 | casa::LogIO os_ ;
|
---|
| 207 |
|
---|
| 208 | casa::Vector<casa::Double> mwTime_ ;
|
---|
| 209 | casa::Vector<casa::Double> mwInterval_ ;
|
---|
[2234] | 210 | casa::Vector<casa::uInt> mwIndex_ ;
|
---|
[1974] | 211 |
|
---|
[1987] | 212 | // Record for TCAL_ID
|
---|
| 213 | // "FIELD0": "SPW0": Vector<uInt>
|
---|
| 214 | // "SPW1": Vector<uInt>
|
---|
| 215 | // ...
|
---|
[1974] | 216 | casa::Record tcalrec_ ;
|
---|
[1987] | 217 |
|
---|
| 218 | //casa::ROTableColumn *scCol_ ;
|
---|
[1974] | 219 | };
|
---|
| 220 |
|
---|
| 221 |
|
---|
| 222 | };
|
---|
| 223 | #endif
|
---|