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 | **/ |
---|
38 | STSideBandSep() { throw( AipsError("No data set to process") ); }; |
---|
39 | explicit STSideBandSep(const vector<string> &names); |
---|
40 | explicit STSideBandSep(const vector<ScantableWrapper> &tables); |
---|
41 | virtual ~STSideBandSep(); |
---|
42 | |
---|
43 | /** |
---|
44 | * Set IFNO and frequency tolerance to select data to process |
---|
45 | **/ |
---|
46 | void setFrequency(const unsigned int ifno, const string freqtol, |
---|
47 | const string frame=""); |
---|
48 | |
---|
49 | /** |
---|
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 | /** |
---|
77 | * Set scantable to fill frequencies of image sideband (temporal) |
---|
78 | **/ |
---|
79 | void setImageTable(const ScantableWrapper &s); |
---|
80 | void setScanTb0(const ScantableWrapper &s); |
---|
81 | |
---|
82 | /** |
---|
83 | * Set additional information to fill frequencies of image sideband |
---|
84 | **/ |
---|
85 | void setLO1(const double lo1, const string frame="TOPO", |
---|
86 | const double reftime=-1, string refdir=""); |
---|
87 | void setLO1Root(const string name); |
---|
88 | |
---|
89 | /** |
---|
90 | * Actual calculation of frequencies of image sideband |
---|
91 | **/ |
---|
92 | void solveImageFreqency(); |
---|
93 | |
---|
94 | private: |
---|
95 | /** Initialize member variables **/ |
---|
96 | void init(); |
---|
97 | void initshift(); |
---|
98 | |
---|
99 | /** Return if the path exists (optionally, check file type) **/ |
---|
100 | Bool checkFile(const string name, string type=""); |
---|
101 | |
---|
102 | /** |
---|
103 | * Get LO1 frequency to solve the frequencies of image side band |
---|
104 | **/ |
---|
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); |
---|
114 | |
---|
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. |
---|
121 | unsigned int sigIfno_; |
---|
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 |
---|
132 | double lo1Freq_; |
---|
133 | MFrequency::Types loFrame_; |
---|
134 | double loTime_; |
---|
135 | string loDir_; |
---|
136 | string asdmName_, asisName_; |
---|
137 | |
---|
138 | CountedPtr<Scantable> imgTab_p, sigTab_p; |
---|
139 | // TEMPORAL member |
---|
140 | CountedPtr<Scantable> st0_; |
---|
141 | |
---|
142 | }; // class |
---|
143 | |
---|
144 | } // namespace |
---|
145 | |
---|
146 | #endif |
---|