1 | // |
---|
2 | // C++ Interface: STMathWrapper |
---|
3 | // |
---|
4 | // Description: |
---|
5 | // |
---|
6 | // |
---|
7 | // Author: Malte Marquarding <Malte.Marquarding@csiro.au>, (C) 2006 |
---|
8 | // |
---|
9 | // Copyright: See COPYING file that comes with this distribution |
---|
10 | // |
---|
11 | // |
---|
12 | #ifndef ASAPSTMATHWRAPPER_H |
---|
13 | #define ASAPSTMATHWRAPPER_H |
---|
14 | |
---|
15 | #include <vector> |
---|
16 | #include <string> |
---|
17 | |
---|
18 | #include <casa/Utilities/CountedPtr.h> |
---|
19 | |
---|
20 | #include "STMath.h" |
---|
21 | #include "Scantable.h" |
---|
22 | #include "ScantableWrapper.h" |
---|
23 | |
---|
24 | namespace asap { |
---|
25 | |
---|
26 | /** |
---|
27 | Wrapper class to handle ScantableWrapper |
---|
28 | |
---|
29 | @author Malte Marquarding |
---|
30 | */ |
---|
31 | class STMathWrapper : public STMath { |
---|
32 | public: |
---|
33 | STMathWrapper() {;} |
---|
34 | STMathWrapper(bool insitu) : STMath(insitu) {;} |
---|
35 | |
---|
36 | virtual ~STMathWrapper() {;} |
---|
37 | |
---|
38 | ScantableWrapper |
---|
39 | average( const std::vector<ScantableWrapper>& in, |
---|
40 | const std::vector<bool>& mask, |
---|
41 | const std::string& weight, |
---|
42 | const std::string& avmode, |
---|
43 | bool alignfreq) |
---|
44 | { |
---|
45 | std::vector<casa::CountedPtr<Scantable> > sts; |
---|
46 | for (int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP()); |
---|
47 | return ScantableWrapper(STMath::average(sts, mask, weight, avmode, alignfreq)); |
---|
48 | } |
---|
49 | ScantableWrapper |
---|
50 | averagePolarisations( const ScantableWrapper& in, |
---|
51 | const std::vector<bool>& mask, |
---|
52 | const std::string& weight) |
---|
53 | { return ScantableWrapper(STMath::averagePolarisations(in.getCP(),mask, weight));} |
---|
54 | |
---|
55 | ScantableWrapper |
---|
56 | unaryOperate( const ScantableWrapper& in, float val, |
---|
57 | const std::string& mode, bool tsys=false ) |
---|
58 | { return ScantableWrapper(STMath::unaryOperate(in.getCP(), val, mode, tsys)); } |
---|
59 | |
---|
60 | ScantableWrapper quotient( const ScantableWrapper& in, |
---|
61 | const std::string& mode = "NEAREST", |
---|
62 | bool preserve = true ) |
---|
63 | { return ScantableWrapper(STMath::quotient(in.getCP(), mode, preserve)); } |
---|
64 | |
---|
65 | ScantableWrapper |
---|
66 | freqSwitch( const ScantableWrapper& in ) |
---|
67 | { return ScantableWrapper(STMath::freqSwitch(in.getCP())); } |
---|
68 | |
---|
69 | std::vector<float> statistic(const ScantableWrapper& in, |
---|
70 | const std::vector<bool>& mask, |
---|
71 | const std::string& which) |
---|
72 | { return STMath::statistic(in.getCP(), mask, which); } |
---|
73 | |
---|
74 | ScantableWrapper bin( const ScantableWrapper& in, int width=5) |
---|
75 | { return ScantableWrapper(STMath::bin(in.getCP(), width)); } |
---|
76 | |
---|
77 | ScantableWrapper |
---|
78 | resample(const ScantableWrapper& in, |
---|
79 | const std::string& method, float width) |
---|
80 | { return ScantableWrapper(STMath::resample(in.getCP(), method, width)); } |
---|
81 | |
---|
82 | ScantableWrapper |
---|
83 | smooth(const ScantableWrapper& in, const std::string& kernel, float width) |
---|
84 | { return ScantableWrapper(STMath::smooth(in.getCP(), kernel, width)); } |
---|
85 | |
---|
86 | ScantableWrapper |
---|
87 | gainElevation(const ScantableWrapper& in, |
---|
88 | const std::vector<float>& coeff, |
---|
89 | const std::string& filename, |
---|
90 | const std::string& method) |
---|
91 | |
---|
92 | { return |
---|
93 | ScantableWrapper(STMath::gainElevation(in.getCP(), coeff, filename, method)); } |
---|
94 | |
---|
95 | ScantableWrapper |
---|
96 | convertFlux(const ScantableWrapper& in, float d, |
---|
97 | float etaap, float jyperk) |
---|
98 | { return ScantableWrapper(STMath::convertFlux(in.getCP(), d, etaap, jyperk)); } |
---|
99 | |
---|
100 | ScantableWrapper opacity(const ScantableWrapper& in, |
---|
101 | float tau) |
---|
102 | { return ScantableWrapper(STMath::opacity(in.getCP(), tau)); } |
---|
103 | |
---|
104 | ScantableWrapper |
---|
105 | merge(const std::vector<ScantableWrapper >& in) |
---|
106 | |
---|
107 | { |
---|
108 | std::vector<casa::CountedPtr<Scantable> > sts; |
---|
109 | for (int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP()); |
---|
110 | return ScantableWrapper(STMath::merge(sts)); } |
---|
111 | |
---|
112 | ScantableWrapper rotateXYPhase( const ScantableWrapper& in, float angle) |
---|
113 | { return ScantableWrapper(STMath::rotateXYPhase(in.getCP(), angle)); } |
---|
114 | |
---|
115 | ScantableWrapper rotateLinPolPhase( const ScantableWrapper& in, float angle) |
---|
116 | { return ScantableWrapper(STMath::rotateLinPolPhase(in.getCP(), angle)); } |
---|
117 | |
---|
118 | ScantableWrapper invertPhase( const ScantableWrapper& in ) |
---|
119 | { return ScantableWrapper(STMath::invertPhase(in.getCP())); } |
---|
120 | |
---|
121 | ScantableWrapper swapPolarisations( const ScantableWrapper& in ) |
---|
122 | { return ScantableWrapper(STMath::swapPolarisations(in.getCP())); } |
---|
123 | |
---|
124 | ScantableWrapper frequencyAlign( const ScantableWrapper& in, |
---|
125 | const std::string& refTime, |
---|
126 | const std::string& method ) |
---|
127 | { return ScantableWrapper(STMath::frequencyAlign(in.getCP())); } |
---|
128 | |
---|
129 | }; |
---|
130 | |
---|
131 | } |
---|
132 | |
---|
133 | #endif |
---|