| 1 | // | 
|---|
| 2 | // C++ Interface: CalibrationManagerWrapper | 
|---|
| 3 | // | 
|---|
| 4 | // Description: | 
|---|
| 5 | // | 
|---|
| 6 | // | 
|---|
| 7 | // Author: Takeshi Nakazato <takeshi.nakazato@nao.ac.jp>, (C) 2012 | 
|---|
| 8 | // | 
|---|
| 9 | // Copyright: See COPYING file that comes with this distribution | 
|---|
| 10 | // | 
|---|
| 11 | // | 
|---|
| 12 | #ifndef ASAP_CALIBRATION_MANAGER_WRAPPER_H | 
|---|
| 13 | #define ASAP_CALIBRATION_MANAGER_WRAPPER_H | 
|---|
| 14 |  | 
|---|
| 15 | #include <string> | 
|---|
| 16 | #include <vector> | 
|---|
| 17 | #include <unistd.h> | 
|---|
| 18 |  | 
|---|
| 19 |  | 
|---|
| 20 | #include <casa/BasicSL/String.h> | 
|---|
| 21 | #include <casa/Utilities/CountedPtr.h> | 
|---|
| 22 | #include <casa/Logging/LogIO.h> | 
|---|
| 23 |  | 
|---|
| 24 | #include "ScantableWrapper.h" | 
|---|
| 25 | #include "CalibrationManager.h" | 
|---|
| 26 | #include "GILHandler.h" | 
|---|
| 27 |  | 
|---|
| 28 | namespace asap { | 
|---|
| 29 |  | 
|---|
| 30 | /** | 
|---|
| 31 | * Class for calibration management. | 
|---|
| 32 | * It also intends to be an interface for Python layer. | 
|---|
| 33 | * @author TakeshiNakazato | 
|---|
| 34 | */ | 
|---|
| 35 | class CalibrationManagerWrapper { | 
|---|
| 36 | public: | 
|---|
| 37 | CalibrationManagerWrapper() | 
|---|
| 38 | : calibrationManagerImpl_() | 
|---|
| 39 | {} | 
|---|
| 40 |  | 
|---|
| 41 | virtual ~CalibrationManagerWrapper() | 
|---|
| 42 | {} | 
|---|
| 43 |  | 
|---|
| 44 | void setScantable(ScantableWrapper &s) | 
|---|
| 45 | { | 
|---|
| 46 | calibrationManagerImpl_.setScantable(s); | 
|---|
| 47 | } | 
|---|
| 48 | void setScantableByName(const std::string &s) | 
|---|
| 49 | { | 
|---|
| 50 | calibrationManagerImpl_.setScantableByName(s); | 
|---|
| 51 | } | 
|---|
| 52 | void addApplyTable(const std::string &c) | 
|---|
| 53 | { | 
|---|
| 54 | calibrationManagerImpl_.addApplyTable(c); | 
|---|
| 55 | } | 
|---|
| 56 | void addSkyTable(const std::string &c) | 
|---|
| 57 | { | 
|---|
| 58 | calibrationManagerImpl_.addSkyTable(c); | 
|---|
| 59 | } | 
|---|
| 60 | void addTsysTable(const std::string &c) | 
|---|
| 61 | { | 
|---|
| 62 | calibrationManagerImpl_.addTsysTable(c); | 
|---|
| 63 | } | 
|---|
| 64 | void setMode(const std::string &mode) | 
|---|
| 65 | { | 
|---|
| 66 | calibrationManagerImpl_.setMode(mode); | 
|---|
| 67 | } | 
|---|
| 68 | void setTimeInterpolation(const std::string &interp, int order=-1) | 
|---|
| 69 | { | 
|---|
| 70 | calibrationManagerImpl_.setTimeInterpolation(interp, order); | 
|---|
| 71 | } | 
|---|
| 72 | void setFrequencyInterpolation(const std::string &interp, int order=-1) | 
|---|
| 73 | { | 
|---|
| 74 | calibrationManagerImpl_.setFrequencyInterpolation(interp, order); | 
|---|
| 75 | } | 
|---|
| 76 | void setTsysSpw(const std::vector<int> &spwlist) | 
|---|
| 77 | { | 
|---|
| 78 | calibrationManagerImpl_.setTsysSpw(spwlist); | 
|---|
| 79 | } | 
|---|
| 80 | void setTsysSpwWithRange(const casacore::Record &spwlist, bool average=false) | 
|---|
| 81 | { | 
|---|
| 82 | calibrationManagerImpl_.setTsysSpwWithRange(spwlist, average); | 
|---|
| 83 | } | 
|---|
| 84 | void setTsysTransfer(unsigned int from, | 
|---|
| 85 | const std::vector<unsigned int> &to) | 
|---|
| 86 | { | 
|---|
| 87 | calibrationManagerImpl_.setTsysTransfer(from, to); | 
|---|
| 88 | } | 
|---|
| 89 | void setCalibrationOptions(const casacore::Record &options) | 
|---|
| 90 | { | 
|---|
| 91 | calibrationManagerImpl_.setCalibrationOptions(options); | 
|---|
| 92 | } | 
|---|
| 93 | void resetCalSetup() | 
|---|
| 94 | { | 
|---|
| 95 | calibrationManagerImpl_.resetCalSetup(); | 
|---|
| 96 | } | 
|---|
| 97 | void reset() | 
|---|
| 98 | { | 
|---|
| 99 | calibrationManagerImpl_.reset(); | 
|---|
| 100 | } | 
|---|
| 101 |  | 
|---|
| 102 | void calibrate() | 
|---|
| 103 | { | 
|---|
| 104 | GILHandler scopedRelease; | 
|---|
| 105 | calibrationManagerImpl_.calibrate(); | 
|---|
| 106 | } | 
|---|
| 107 | void apply(bool insitu=false, bool filltsys=true) | 
|---|
| 108 | { | 
|---|
| 109 | GILHandler scopedRelease; | 
|---|
| 110 | calibrationManagerImpl_.apply(insitu, filltsys); | 
|---|
| 111 | } | 
|---|
| 112 | void saveCaltable(const std::string &name) | 
|---|
| 113 | { | 
|---|
| 114 | calibrationManagerImpl_.saveCaltable(name); | 
|---|
| 115 | } | 
|---|
| 116 | void split(const std::string &name) | 
|---|
| 117 | { | 
|---|
| 118 | calibrationManagerImpl_.split(name); | 
|---|
| 119 | } | 
|---|
| 120 | private: | 
|---|
| 121 | CalibrationManager calibrationManagerImpl_; | 
|---|
| 122 | }; | 
|---|
| 123 |  | 
|---|
| 124 | } | 
|---|
| 125 | #endif | 
|---|