[2720] | 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 | |
---|
[2742] | 19 | #include <casa/Utilities/CountedPtr.h> |
---|
[2720] | 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" |
---|
[2756] | 30 | //#include "Calibrator.h" |
---|
| 31 | //#include "Interpolator1D.h" |
---|
[2720] | 32 | #include "STCalSkyTable.h" |
---|
| 33 | #include "STCalTsysTable.h" |
---|
| 34 | |
---|
| 35 | namespace asap { |
---|
| 36 | |
---|
[2756] | 37 | template<class T, class U> class Interpolator1D; |
---|
| 38 | class Calibrator; |
---|
| 39 | |
---|
[2720] | 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(); |
---|
[3106] | 50 | STApplyCal(casacore::CountedPtr<Scantable> target); |
---|
[2720] | 51 | |
---|
| 52 | ~STApplyCal(); |
---|
| 53 | |
---|
| 54 | // set data |
---|
[3106] | 55 | void setTarget(casacore::CountedPtr<Scantable> target); |
---|
| 56 | void setTarget(const casacore::String &name); |
---|
[2720] | 57 | |
---|
| 58 | // push new caltable |
---|
| 59 | void push(STCalSkyTable *table); |
---|
| 60 | void push(STCalTsysTable *table); |
---|
| 61 | |
---|
| 62 | // set interpolation method |
---|
[3106] | 63 | //void setInterpolation(STCalEnum::InterpolationAxis axis, STCalEnum::InterpolationType itype, casacore::Int order=-1); |
---|
| 64 | void setTimeInterpolation(STCalEnum::InterpolationType itype, casacore::Int order=-1); |
---|
| 65 | void setFrequencyInterpolation(STCalEnum::InterpolationType itype, casacore::Int order=-1); |
---|
[2720] | 66 | |
---|
| 67 | // set IF (spw) mapping for Tsys transfer |
---|
[3106] | 68 | void setTsysTransfer(casacore::uInt from, casacore::Vector<casacore::uInt> to); |
---|
[2720] | 69 | |
---|
| 70 | // apply tables |
---|
[3106] | 71 | void apply(casacore::Bool insitu=false, casacore::Bool filltsys=true); |
---|
[2720] | 72 | |
---|
| 73 | // split target data and store it to disk |
---|
[3106] | 74 | void save(const casacore::String &name); |
---|
[2720] | 75 | |
---|
[2735] | 76 | // reset all settings except target scantable |
---|
| 77 | void reset(); |
---|
| 78 | |
---|
| 79 | // reset all settings |
---|
| 80 | void completeReset(); |
---|
| 81 | |
---|
[2720] | 82 | private: |
---|
| 83 | // initialization |
---|
| 84 | void init(); |
---|
| 85 | |
---|
[2727] | 86 | // setup interpolator |
---|
| 87 | void initInterpolator(); |
---|
| 88 | |
---|
[2720] | 89 | // single loop element in apply() |
---|
[3106] | 90 | void doapply(casacore::uInt beamno, casacore::uInt ifno, casacore::uInt polno, |
---|
| 91 | casacore::Vector<casacore::uInt> &rows, |
---|
| 92 | casacore::Vector<casacore::uInt> &skylist, |
---|
| 93 | casacore::Bool filltsys=true); |
---|
[2720] | 94 | |
---|
| 95 | // get frequency information from FREQUENCIES subtable |
---|
[3106] | 96 | casacore::Vector<casacore::Double> getBaseFrequency(casacore::uInt whichrow); |
---|
[2720] | 97 | |
---|
| 98 | // search spwmap_ to get IFNO for Tsys |
---|
[3106] | 99 | casacore::uInt getIFForTsys(casacore::uInt to); |
---|
[2720] | 100 | |
---|
| 101 | // target data |
---|
[3106] | 102 | casacore::CountedPtr<Scantable> target_; |
---|
[2720] | 103 | |
---|
| 104 | // working data |
---|
[3106] | 105 | casacore::CountedPtr<Scantable> work_; |
---|
[2720] | 106 | |
---|
| 107 | // calibrator |
---|
[3106] | 108 | casacore::CountedPtr<Calibrator> calibrator_; |
---|
[2720] | 109 | |
---|
| 110 | // interpolation method |
---|
[2735] | 111 | STCalEnum::InterpolationType iTime_; |
---|
| 112 | STCalEnum::InterpolationType iFreq_; |
---|
[3106] | 113 | casacore::Int order_; |
---|
| 114 | casacore::CountedPtr<Interpolator1D<casacore::Double, casacore::Float> > interpolatorT_; |
---|
| 115 | casacore::CountedPtr<Interpolator1D<casacore::Double, casacore::Float> > interpolatorF_; |
---|
| 116 | casacore::CountedPtr<Interpolator1D<casacore::Double, casacore::Float> > interpolatorS_; |
---|
[2720] | 117 | |
---|
| 118 | // IF (spw) mapping for Tsys transfer |
---|
[3106] | 119 | map<casacore::uInt, casacore::Vector<casacore::uInt> > spwmap_; |
---|
[2720] | 120 | |
---|
| 121 | // list of apply tables |
---|
| 122 | std::vector<STCalSkyTable*> skytable_; |
---|
| 123 | std::vector<STCalTsysTable*> tsystable_; |
---|
| 124 | |
---|
| 125 | // calibration type |
---|
| 126 | STCalEnum::CalType caltype_; |
---|
[3106] | 127 | casacore::Bool doTsys_; |
---|
[2720] | 128 | |
---|
| 129 | // selector |
---|
| 130 | STSelector sel_; |
---|
| 131 | |
---|
| 132 | // logger |
---|
[3106] | 133 | casacore::LogIO os_; |
---|
[2720] | 134 | }; |
---|
| 135 | |
---|
| 136 | } |
---|
| 137 | |
---|
| 138 | #endif |
---|