// // C++ Interface: MSFiller // // Description: // // This class is specific filler for MS format // // Takeshi Nakazato , (C) 2010 // // Copyright: See COPYING file that comes with this distribution // // #ifndef ASAPMSFILLER_H #define ASAPMSFILLER_H // STL #include // AIPS++ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "TableTraverse.h" #include "Scantable.h" #include "MathUtils.h" using namespace casacore; namespace asap { class MSFillerUtils { protected: template void getScalar( const String &name, const uInt &idx, const Table &tab, T &val ) { ROScalarColumn col( tab, name ) ; val = col( idx ) ; } template void getArray( const String &name, const uInt &idx, const Table &tab, Array &val ) { ROArrayColumn col( tab, name ) ; val = col( idx ) ; } template void getScalarMeas( const String &name, const uInt &idx, const Table &tab, T &val ) { ROScalarMeasColumn measCol( tab, name ) ; val = measCol( idx ) ; } template void getArrayMeas( const String &name, const uInt &idx, const Table &tab, Array &val ) { ROArrayMeasColumn measCol( tab, name ) ; val = measCol( idx ) ; } template void getScalarQuant( const String &name, const uInt &idx, const Table &tab, Quantum &val ) { ROScalarQuantColumn quantCol( tab, name ) ; val = quantCol( idx ) ; } template void getArrayQuant( const String &name, const uInt &idx, const Table &tab, Array< Quantum > &val ) { ROArrayQuantColumn quantCol( tab, name ) ; val = quantCol( idx ) ; } template T interp( Double x0, Double x1, Double x, T y0, T y1 ) { Double dx0 = x - x0 ; Double dx1 = x1 - x ; return ( y0 * dx1 + y1 * dx0 ) / ( x1 - x0 ) ; } String keyTcal( const Int &feedid, const Int &spwid, const Double &time ) { String stime = MVTime( Quantity(time,Unit("s")) ).string( MVTime::YMD ) ; String sfeed = "FEED" + String::toString( feedid ) ; String sspw = "SPW" + String::toString( spwid ) ; return sfeed+":"+sspw+":"+stime ; } String keyTcal( const Int &feedid, const Int &spwid, const String &stime ) { String sfeed = "FEED" + String::toString( feedid ) ; String sspw = "SPW" + String::toString( spwid ) ; return sfeed+":"+sspw+":"+stime ; } }; class MSFiller : public MSFillerUtils { public: explicit MSFiller(CountedPtr stable) ; virtual ~MSFiller() ; virtual bool open(const std::string& filename, const Record& rec) ; virtual void fill() ; virtual void close() ; protected: private: MSFiller(); MSFiller(const MSFiller&); MSFiller& operator=(const MSFiller&); // fill subtables //void fillFrequencies() ; //void fillMolecules() ; void fillWeather() ; void fillFocus() ; //void fillHistory() ; //void fillFit() ; void fillTcal() ; void infillTcal() ; // get frequency frame std::string getFrame() ; // initialize header void initHeader( STHeader &header ) ; // get base frame from SPECTRAL_WINDOW table std::string frameFromSpwTable(); CountedPtr table_ ; MeasurementSet mstable_ ; String tablename_ ; Int antenna_ ; String antennaStr_ ; Bool getPt_ ; Bool freqToLsr_ ; Bool isFloatData_ ; Bool isData_ ; Bool isDoppler_ ; Bool isFlagCmd_ ; Bool isFreqOffset_ ; Bool isHistory_ ; Bool isProcessor_ ; Bool isSysCal_ ; Bool isWeather_ ; String colTsys_ ; String colTcal_ ; LogIO os_ ; Vector mwTime_ ; Vector mwInterval_ ; Vector mwIndex_ ; // Record for TCAL_ID // "FIELD0": "SPW0": Vector // "SPW1": Vector // ... Record tcalrec_ ; //map< String,Vector > tcalrec_ ; }; }; #endif