| 1 | //
|
|---|
| 2 | // C++ Interface: STApplyCal
|
|---|
| 3 | //
|
|---|
| 4 | // Description:
|
|---|
| 5 | //
|
|---|
| 6 | // Apply any apply tables to target data.
|
|---|
| 7 | //
|
|---|
| 8 | // Author: Takeshi Nakazato <takeshi.nakazato@nao.ac.jp> (C) 2012
|
|---|
| 9 | //
|
|---|
| 10 | // Copyright: See COPYING file that comes with this distribution
|
|---|
| 11 | //
|
|---|
| 12 | //
|
|---|
| 13 | #ifndef ASAP_APPLY_CAL_H
|
|---|
| 14 | #define ASAP_APPLY_CAL_H
|
|---|
| 15 |
|
|---|
| 16 | #include <map>
|
|---|
| 17 | #include <vector>
|
|---|
| 18 |
|
|---|
| 19 | #include <casa/Utilities/CountedPtr.h>
|
|---|
| 20 | #include <casa/Arrays/Vector.h>
|
|---|
| 21 | #include <casa/Logging/LogIO.h>
|
|---|
| 22 | #include <tables/Tables/Table.h>
|
|---|
| 23 | #include <tables/Tables/ScalarColumn.h>
|
|---|
| 24 | #include <measures/TableMeasures/ScalarMeasColumn.h>
|
|---|
| 25 |
|
|---|
| 26 | #include "Scantable.h"
|
|---|
| 27 | #include "STSelector.h"
|
|---|
| 28 | #include "STApplyTable.h"
|
|---|
| 29 | #include "STCalEnum.h"
|
|---|
| 30 | //#include "Calibrator.h"
|
|---|
| 31 | //#include "Interpolator1D.h"
|
|---|
| 32 | #include "STCalSkyTable.h"
|
|---|
| 33 | #include "STCalTsysTable.h"
|
|---|
| 34 |
|
|---|
| 35 | namespace asap {
|
|---|
| 36 |
|
|---|
| 37 | template<class T, class U> class Interpolator1D;
|
|---|
| 38 | class Calibrator;
|
|---|
| 39 |
|
|---|
| 40 | /**
|
|---|
| 41 | Apply any apply tables to target data
|
|---|
| 42 |
|
|---|
| 43 | @author Takeshi Nakazato
|
|---|
| 44 | @date $Date:$
|
|---|
| 45 | @version $Revision:$
|
|---|
| 46 | */
|
|---|
| 47 | class STApplyCal {
|
|---|
| 48 | public:
|
|---|
| 49 | STApplyCal();
|
|---|
| 50 | STApplyCal(casa::CountedPtr<Scantable> target);
|
|---|
| 51 |
|
|---|
| 52 | ~STApplyCal();
|
|---|
| 53 |
|
|---|
| 54 | // set data
|
|---|
| 55 | void setTarget(casa::CountedPtr<Scantable> target);
|
|---|
| 56 | void setTarget(const casa::String &name);
|
|---|
| 57 |
|
|---|
| 58 | // push new caltable
|
|---|
| 59 | void push(STCalSkyTable *table);
|
|---|
| 60 | void push(STCalTsysTable *table);
|
|---|
| 61 |
|
|---|
| 62 | // set interpolation method
|
|---|
| 63 | //void setInterpolation(STCalEnum::InterpolationAxis axis, STCalEnum::InterpolationType itype, casa::Int order=-1);
|
|---|
| 64 | void setTimeInterpolation(STCalEnum::InterpolationType itype, casa::Int order=-1);
|
|---|
| 65 | void setFrequencyInterpolation(STCalEnum::InterpolationType itype, casa::Int order=-1);
|
|---|
| 66 |
|
|---|
| 67 | // set IF (spw) mapping for Tsys transfer
|
|---|
| 68 | void setTsysTransfer(casa::uInt from, casa::Vector<casa::uInt> to);
|
|---|
| 69 |
|
|---|
| 70 | // apply tables
|
|---|
| 71 | void apply(casa::Bool insitu=false, casa::Bool filltsys=true);
|
|---|
| 72 |
|
|---|
| 73 | // split target data and store it to disk
|
|---|
| 74 | void save(const casa::String &name);
|
|---|
| 75 |
|
|---|
| 76 | // reset all settings except target scantable
|
|---|
| 77 | void reset();
|
|---|
| 78 |
|
|---|
| 79 | // reset all settings
|
|---|
| 80 | void completeReset();
|
|---|
| 81 |
|
|---|
| 82 | private:
|
|---|
| 83 | // initialization
|
|---|
| 84 | void init();
|
|---|
| 85 |
|
|---|
| 86 | // setup interpolator
|
|---|
| 87 | void initInterpolator();
|
|---|
| 88 |
|
|---|
| 89 | // single loop element in apply()
|
|---|
| 90 | void doapply(casa::uInt beamno, casa::uInt ifno, casa::uInt polno,
|
|---|
| 91 | casa::Vector<casa::uInt> &rows,
|
|---|
| 92 | casa::Vector<casa::uInt> &skylist,
|
|---|
| 93 | casa::Bool filltsys=true);
|
|---|
| 94 |
|
|---|
| 95 | // get frequency information from FREQUENCIES subtable
|
|---|
| 96 | casa::Vector<casa::Double> getBaseFrequency(casa::uInt whichrow);
|
|---|
| 97 |
|
|---|
| 98 | // search spwmap_ to get IFNO for Tsys
|
|---|
| 99 | casa::uInt getIFForTsys(casa::uInt to);
|
|---|
| 100 |
|
|---|
| 101 | // target data
|
|---|
| 102 | casa::CountedPtr<Scantable> target_;
|
|---|
| 103 |
|
|---|
| 104 | // working data
|
|---|
| 105 | casa::CountedPtr<Scantable> work_;
|
|---|
| 106 |
|
|---|
| 107 | // calibrator
|
|---|
| 108 | casa::CountedPtr<Calibrator> calibrator_;
|
|---|
| 109 |
|
|---|
| 110 | // interpolation method
|
|---|
| 111 | STCalEnum::InterpolationType iTime_;
|
|---|
| 112 | STCalEnum::InterpolationType iFreq_;
|
|---|
| 113 | casa::Int order_;
|
|---|
| 114 | casa::CountedPtr<Interpolator1D<casa::Double, casa::Float> > interpolatorT_;
|
|---|
| 115 | casa::CountedPtr<Interpolator1D<casa::Double, casa::Float> > interpolatorF_;
|
|---|
| 116 | casa::CountedPtr<Interpolator1D<casa::Double, casa::Float> > interpolatorS_;
|
|---|
| 117 |
|
|---|
| 118 | // IF (spw) mapping for Tsys transfer
|
|---|
| 119 | map<casa::uInt, casa::Vector<casa::uInt> > spwmap_;
|
|---|
| 120 |
|
|---|
| 121 | // list of apply tables
|
|---|
| 122 | std::vector<STCalSkyTable*> skytable_;
|
|---|
| 123 | std::vector<STCalTsysTable*> tsystable_;
|
|---|
| 124 |
|
|---|
| 125 | // calibration type
|
|---|
| 126 | STCalEnum::CalType caltype_;
|
|---|
| 127 | casa::Bool doTsys_;
|
|---|
| 128 |
|
|---|
| 129 | // selector
|
|---|
| 130 | STSelector sel_;
|
|---|
| 131 |
|
|---|
| 132 | // logger
|
|---|
| 133 | casa::LogIO os_;
|
|---|
| 134 | };
|
|---|
| 135 |
|
|---|
| 136 | }
|
|---|
| 137 |
|
|---|
| 138 | #endif
|
|---|