[2707] | 1 | // C++ Interface: STSideBandSep |
---|
| 2 | // |
---|
| 3 | // Description: |
---|
| 4 | // A class to invoke sideband separation of Scantable |
---|
| 5 | // |
---|
| 6 | // Author: Kanako Sugimoto <kana.sugi@nao.ac.jp>, (C) 2012 |
---|
| 7 | // |
---|
| 8 | // Copyright: See COPYING file that comes with this distribution |
---|
| 9 | // |
---|
| 10 | // |
---|
| 11 | #ifndef ASAPSIDEBANDSEP_H |
---|
| 12 | #define ASAPSIDEBANDSEP_H |
---|
| 13 | |
---|
| 14 | // STL |
---|
| 15 | #include <iostream> |
---|
| 16 | #include <string> |
---|
| 17 | #include <vector> |
---|
| 18 | // casacore |
---|
| 19 | #include <casa/aips.h> |
---|
| 20 | #include <casa/Utilities/CountedPtr.h> |
---|
| 21 | #include <measures/Measures/MDirection.h> |
---|
| 22 | #include <coordinates/Coordinates/DirectionCoordinate.h> |
---|
| 23 | #include <coordinates/Coordinates/SpectralCoordinate.h> |
---|
| 24 | // asap |
---|
| 25 | #include "ScantableWrapper.h" |
---|
| 26 | #include "Scantable.h" |
---|
| 27 | |
---|
| 28 | using namespace std; |
---|
| 29 | using namespace casa; |
---|
| 30 | |
---|
| 31 | namespace asap { |
---|
| 32 | |
---|
| 33 | class STSideBandSep { |
---|
| 34 | public: |
---|
| 35 | /** |
---|
| 36 | * constructors and a destructor |
---|
| 37 | **/ |
---|
[2726] | 38 | STSideBandSep() { throw( AipsError("No data set to process") ); }; |
---|
| 39 | explicit STSideBandSep(const vector<string> &names); |
---|
| 40 | explicit STSideBandSep(const vector<ScantableWrapper> &tables); |
---|
[2707] | 41 | virtual ~STSideBandSep(); |
---|
| 42 | |
---|
| 43 | /** |
---|
[2726] | 44 | * Set IFNO and frequency tolerance to select data to process |
---|
[2707] | 45 | **/ |
---|
[2726] | 46 | void setFrequency(const unsigned int ifno, const string freqtol, |
---|
| 47 | const string frame=""); |
---|
[2707] | 48 | |
---|
| 49 | /** |
---|
[2726] | 50 | * Set direction tolerance to group spectra. |
---|
| 51 | * The spectra within this range will be averaged before procesing. |
---|
| 52 | **/ |
---|
| 53 | void setDirTolerance(const vector<string> dirtol); |
---|
| 54 | |
---|
| 55 | /** |
---|
| 56 | * Set the number of channels shifted in image side band |
---|
| 57 | * of each of scantable. |
---|
| 58 | **/ |
---|
| 59 | void setShift(const vector<double> &shift); |
---|
| 60 | |
---|
| 61 | /** |
---|
| 62 | * Set rejection limit of solution. |
---|
| 63 | **/ |
---|
| 64 | void setThreshold(const double limit); |
---|
| 65 | |
---|
| 66 | /** |
---|
| 67 | * Resolve both image and signal sideband when true is set. |
---|
| 68 | **/ |
---|
| 69 | void solveBoth(const bool flag) { doboth_ = flag; }; |
---|
| 70 | |
---|
| 71 | /** |
---|
| 72 | * Obtain spectra by subtracting the solution of the other sideband. |
---|
| 73 | **/ |
---|
| 74 | void solvefromOther(const bool flag) { otherside_ = flag; }; |
---|
| 75 | |
---|
| 76 | /** |
---|
[2712] | 77 | * Set scantable to fill frequencies of image sideband (temporal) |
---|
[2707] | 78 | **/ |
---|
| 79 | void setImageTable(const ScantableWrapper &s); |
---|
[2712] | 80 | void setScanTb0(const ScantableWrapper &s); |
---|
[2726] | 81 | |
---|
[2707] | 82 | /** |
---|
| 83 | * Set additional information to fill frequencies of image sideband |
---|
| 84 | **/ |
---|
[2726] | 85 | void setLO1(const double lo1, const string frame="TOPO", |
---|
| 86 | const double reftime=-1, string refdir=""); |
---|
[2711] | 87 | void setLO1Root(const string name); |
---|
[2726] | 88 | |
---|
[2707] | 89 | /** |
---|
| 90 | * Actual calculation of frequencies of image sideband |
---|
| 91 | **/ |
---|
| 92 | void solveImageFreqency(); |
---|
| 93 | |
---|
| 94 | private: |
---|
[2726] | 95 | /** Initialize member variables **/ |
---|
| 96 | void init(); |
---|
| 97 | void initshift(); |
---|
| 98 | |
---|
| 99 | /** Return if the path exists (optionally, check file type) **/ |
---|
[2707] | 100 | Bool checkFile(const string name, string type=""); |
---|
[2726] | 101 | |
---|
| 102 | /** |
---|
| 103 | * Get LO1 frequency to solve the frequencies of image side band |
---|
| 104 | **/ |
---|
[2711] | 105 | bool getLo1FromAsdm(const string asdmname, |
---|
| 106 | const double refval, const double refpix, |
---|
| 107 | const double increment, const int nChan); |
---|
| 108 | bool getLo1FromAsisTab(const string msname, |
---|
| 109 | const double refval, const double refpix, |
---|
| 110 | const double increment, const int nChan); |
---|
| 111 | bool getLo1FromScanTab(casa::CountedPtr< Scantable > &scantab, |
---|
| 112 | const double refval, const double refpix, |
---|
| 113 | const double increment, const int nChan); |
---|
[2707] | 114 | |
---|
[2726] | 115 | /** Member variables **/ |
---|
| 116 | // input tables |
---|
| 117 | vector<string> infileList_; |
---|
| 118 | vector< CountedPtr<Scantable> > intabList_; |
---|
| 119 | unsigned int ntable_; |
---|
| 120 | // frequency and direction setup to select data. |
---|
[2707] | 121 | unsigned int sigIfno_; |
---|
[2726] | 122 | Quantum<Double> ftol_; |
---|
| 123 | MFrequency::Types solFrame_; |
---|
| 124 | vector<double> sigShift_, imgShift_; |
---|
| 125 | unsigned int nshift_, nchan_; |
---|
| 126 | vector< CountedPtr<Scantable> > tableList_; |
---|
| 127 | Double xtol_, ytol_; |
---|
| 128 | // solution parameters |
---|
| 129 | bool otherside_, doboth_; |
---|
| 130 | double rejlimit_; |
---|
| 131 | // LO1 |
---|
[2707] | 132 | double lo1Freq_; |
---|
| 133 | MFrequency::Types loFrame_; |
---|
| 134 | double loTime_; |
---|
| 135 | string loDir_; |
---|
[2711] | 136 | string asdmName_, asisName_; |
---|
[2707] | 137 | |
---|
[2712] | 138 | CountedPtr<Scantable> imgTab_p, sigTab_p; |
---|
| 139 | // TEMPORAL member |
---|
| 140 | CountedPtr<Scantable> st0_; |
---|
[2707] | 141 | |
---|
| 142 | }; // class |
---|
| 143 | |
---|
| 144 | } // namespace |
---|
| 145 | |
---|
| 146 | #endif |
---|