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 | // time sort |
---|
99 | casa::Vector<casa::uInt> timeSort(casa::Vector<casa::Double> &t); |
---|
100 | |
---|
101 | // search spwmap_ to get IFNO for Tsys |
---|
102 | casa::uInt getIFForTsys(casa::uInt to); |
---|
103 | |
---|
104 | // target data |
---|
105 | casa::CountedPtr<Scantable> target_; |
---|
106 | |
---|
107 | // working data |
---|
108 | casa::CountedPtr<Scantable> work_; |
---|
109 | |
---|
110 | // calibrator |
---|
111 | casa::CountedPtr<Calibrator> calibrator_; |
---|
112 | |
---|
113 | // interpolation method |
---|
114 | STCalEnum::InterpolationType iTime_; |
---|
115 | STCalEnum::InterpolationType iFreq_; |
---|
116 | casa::Int order_; |
---|
117 | casa::CountedPtr<Interpolator1D<casa::Double, casa::Float> > interpolatorT_; |
---|
118 | casa::CountedPtr<Interpolator1D<casa::Double, casa::Float> > interpolatorF_; |
---|
119 | casa::CountedPtr<Interpolator1D<casa::Double, casa::Float> > interpolatorS_; |
---|
120 | |
---|
121 | // IF (spw) mapping for Tsys transfer |
---|
122 | map<casa::uInt, casa::Vector<casa::uInt> > spwmap_; |
---|
123 | |
---|
124 | // list of apply tables |
---|
125 | std::vector<STCalSkyTable*> skytable_; |
---|
126 | std::vector<STCalTsysTable*> tsystable_; |
---|
127 | |
---|
128 | // calibration type |
---|
129 | STCalEnum::CalType caltype_; |
---|
130 | casa::Bool doTsys_; |
---|
131 | |
---|
132 | // selector |
---|
133 | STSelector sel_; |
---|
134 | |
---|
135 | // logger |
---|
136 | casa::LogIO os_; |
---|
137 | }; |
---|
138 | |
---|
139 | } |
---|
140 | |
---|
141 | #endif |
---|