[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 | |
---|
| 19 | #include <casa/Containers/Block.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 | /** |
---|
| 38 | Apply any apply tables to target data |
---|
| 39 | |
---|
| 40 | @author Takeshi Nakazato |
---|
| 41 | @date $Date:$ |
---|
| 42 | @version $Revision:$ |
---|
| 43 | */ |
---|
| 44 | class STApplyCal { |
---|
| 45 | public: |
---|
| 46 | STApplyCal(); |
---|
| 47 | STApplyCal(casa::CountedPtr<Scantable> target); |
---|
| 48 | |
---|
| 49 | ~STApplyCal(); |
---|
| 50 | |
---|
| 51 | // set data |
---|
| 52 | void setTarget(casa::CountedPtr<Scantable> target); |
---|
| 53 | void setTarget(const casa::String &name); |
---|
| 54 | |
---|
| 55 | // push new caltable |
---|
| 56 | void push(STCalSkyTable *table); |
---|
| 57 | void push(STCalTsysTable *table); |
---|
| 58 | |
---|
| 59 | // set interpolation method |
---|
| 60 | void setInterpolation(STCalEnum::InterpolationAxis axis, STCalEnum::InterpolationType itype, casa::Int order=-1); |
---|
| 61 | |
---|
| 62 | // set IF (spw) mapping for Tsys transfer |
---|
| 63 | void setTsysTransfer(casa::uInt from, casa::Vector<casa::uInt> to); |
---|
| 64 | |
---|
| 65 | // apply tables |
---|
| 66 | void apply(casa::Bool insitu=true); |
---|
| 67 | |
---|
| 68 | // split target data and store it to disk |
---|
| 69 | void save(const casa::String &name); |
---|
| 70 | |
---|
| 71 | private: |
---|
| 72 | // initialization |
---|
| 73 | void init(); |
---|
| 74 | |
---|
[2727] | 75 | // setup interpolator |
---|
| 76 | void initInterpolator(); |
---|
| 77 | |
---|
[2720] | 78 | // single loop element in apply() |
---|
| 79 | void doapply(casa::uInt beamno, casa::uInt ifno, casa::uInt polno, |
---|
| 80 | casa::Vector<casa::uInt> &rows, |
---|
| 81 | casa::Vector<casa::uInt> &skylist); |
---|
| 82 | |
---|
| 83 | // get frequency information from FREQUENCIES subtable |
---|
| 84 | casa::Vector<casa::Double> getBaseFrequency(casa::uInt whichrow); |
---|
| 85 | |
---|
| 86 | // time sort |
---|
| 87 | casa::Vector<casa::uInt> timeSort(casa::Vector<casa::Double> &t); |
---|
| 88 | |
---|
| 89 | // search spwmap_ to get IFNO for Tsys |
---|
| 90 | casa::uInt getIFForTsys(casa::uInt to); |
---|
| 91 | |
---|
| 92 | // target data |
---|
| 93 | casa::CountedPtr<Scantable> target_; |
---|
| 94 | |
---|
| 95 | // working data |
---|
| 96 | casa::CountedPtr<Scantable> work_; |
---|
| 97 | |
---|
| 98 | // calibrator |
---|
| 99 | casa::CountedPtr<Calibrator> calibrator_; |
---|
| 100 | |
---|
| 101 | // interpolation method |
---|
| 102 | std::vector<STCalEnum::InterpolationType> interp_; |
---|
| 103 | casa::Bool is2d_; |
---|
| 104 | casa::Int order_; |
---|
[2733] | 105 | casa::CountedPtr<Interpolator1D<casa::Double, casa::Float> > interpolatorT_; |
---|
| 106 | casa::CountedPtr<Interpolator1D<casa::Double, casa::Float> > interpolatorF_; |
---|
| 107 | casa::CountedPtr<Interpolator1D<casa::Double, casa::Float> > interpolatorS_; |
---|
[2720] | 108 | |
---|
| 109 | // IF (spw) mapping for Tsys transfer |
---|
| 110 | map<casa::uInt, casa::Vector<casa::uInt> > spwmap_; |
---|
| 111 | |
---|
| 112 | // list of apply tables |
---|
| 113 | std::vector<STCalSkyTable*> skytable_; |
---|
| 114 | std::vector<STCalTsysTable*> tsystable_; |
---|
| 115 | |
---|
| 116 | // calibration type |
---|
| 117 | STCalEnum::CalType caltype_; |
---|
| 118 | casa::Bool doTsys_; |
---|
| 119 | |
---|
| 120 | // selector |
---|
| 121 | STSelector sel_; |
---|
| 122 | |
---|
| 123 | // logger |
---|
| 124 | casa::LogIO os_; |
---|
| 125 | }; |
---|
| 126 | |
---|
| 127 | } |
---|
| 128 | |
---|
| 129 | #endif |
---|