[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"
|
---|
| 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
|
---|
[2735] | 60 | //void setInterpolation(STCalEnum::InterpolationAxis axis, STCalEnum::InterpolationType itype, casa::Int order=-1);
|
---|
| 61 | void setTimeInterpolation(STCalEnum::InterpolationType itype, casa::Int order=-1);
|
---|
| 62 | void setFrequencyInterpolation(STCalEnum::InterpolationType itype, casa::Int order=-1);
|
---|
[2720] | 63 |
|
---|
| 64 | // set IF (spw) mapping for Tsys transfer
|
---|
| 65 | void setTsysTransfer(casa::uInt from, casa::Vector<casa::uInt> to);
|
---|
| 66 |
|
---|
| 67 | // apply tables
|
---|
[2742] | 68 | void apply(casa::Bool insitu=true, casa::Bool filltsys=false);
|
---|
[2720] | 69 |
|
---|
| 70 | // split target data and store it to disk
|
---|
| 71 | void save(const casa::String &name);
|
---|
| 72 |
|
---|
[2735] | 73 | // reset all settings except target scantable
|
---|
| 74 | void reset();
|
---|
| 75 |
|
---|
| 76 | // reset all settings
|
---|
| 77 | void completeReset();
|
---|
| 78 |
|
---|
[2720] | 79 | private:
|
---|
| 80 | // initialization
|
---|
| 81 | void init();
|
---|
| 82 |
|
---|
[2727] | 83 | // setup interpolator
|
---|
| 84 | void initInterpolator();
|
---|
| 85 |
|
---|
[2720] | 86 | // single loop element in apply()
|
---|
| 87 | void doapply(casa::uInt beamno, casa::uInt ifno, casa::uInt polno,
|
---|
| 88 | casa::Vector<casa::uInt> &rows,
|
---|
[2742] | 89 | casa::Vector<casa::uInt> &skylist,
|
---|
| 90 | casa::Bool filltsys=false);
|
---|
[2720] | 91 |
|
---|
| 92 | // get frequency information from FREQUENCIES subtable
|
---|
| 93 | casa::Vector<casa::Double> getBaseFrequency(casa::uInt whichrow);
|
---|
| 94 |
|
---|
| 95 | // time sort
|
---|
| 96 | casa::Vector<casa::uInt> timeSort(casa::Vector<casa::Double> &t);
|
---|
| 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
|
---|
[2735] | 111 | STCalEnum::InterpolationType iTime_;
|
---|
| 112 | STCalEnum::InterpolationType iFreq_;
|
---|
[2720] | 113 | casa::Int order_;
|
---|
[2733] | 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_;
|
---|
[2720] | 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
|
---|