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 | {
|
---|
44 | std::vector<casa::CountedPtr<Scantable> > sts;
|
---|
45 | for (unsigned int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP());
|
---|
46 | return ScantableWrapper(STMath::average(sts, mask, weight, avmode));
|
---|
47 | }
|
---|
48 |
|
---|
49 | ScantableWrapper
|
---|
50 | averageChannel( const ScantableWrapper& in,
|
---|
51 | const std::string& mode = "MEDIAN")
|
---|
52 | {
|
---|
53 | return ScantableWrapper(STMath::averageChannel(in.getCP(), mode));
|
---|
54 | }
|
---|
55 |
|
---|
56 | ScantableWrapper
|
---|
57 | averagePolarisations( const ScantableWrapper& in,
|
---|
58 | const std::vector<bool>& mask,
|
---|
59 | const std::string& weight)
|
---|
60 | { return ScantableWrapper(STMath::averagePolarisations(in.getCP(),mask, weight));}
|
---|
61 |
|
---|
62 | ScantableWrapper
|
---|
63 | unaryOperate( const ScantableWrapper& in, float val,
|
---|
64 | const std::string& mode, bool tsys=false )
|
---|
65 | { return ScantableWrapper(STMath::unaryOperate(in.getCP(), val, mode, tsys)); }
|
---|
66 |
|
---|
67 | ScantableWrapper autoQuotient( const ScantableWrapper& in,
|
---|
68 | const std::string& mode = "NEAREST",
|
---|
69 | bool preserve = true )
|
---|
70 | { return ScantableWrapper(STMath::autoQuotient(in.getCP(), mode, preserve)); }
|
---|
71 |
|
---|
72 | ScantableWrapper quotient( const ScantableWrapper& on,
|
---|
73 | const ScantableWrapper& off,
|
---|
74 | bool preserve = true )
|
---|
75 | { return ScantableWrapper( STMath::quotient( on.getCP(), off.getCP(),
|
---|
76 | preserve ) ); }
|
---|
77 |
|
---|
78 | ScantableWrapper
|
---|
79 | freqSwitch( const ScantableWrapper& in )
|
---|
80 | { return ScantableWrapper(STMath::freqSwitch(in.getCP())); }
|
---|
81 |
|
---|
82 | std::vector<float> statistic(const ScantableWrapper& in,
|
---|
83 | const std::vector<bool>& mask,
|
---|
84 | const std::string& which)
|
---|
85 | { return STMath::statistic(in.getCP(), mask, which); }
|
---|
86 |
|
---|
87 | ScantableWrapper bin( const ScantableWrapper& in, int width=5)
|
---|
88 | { return ScantableWrapper(STMath::bin(in.getCP(), width)); }
|
---|
89 |
|
---|
90 | ScantableWrapper
|
---|
91 | resample(const ScantableWrapper& in,
|
---|
92 | const std::string& method, float width)
|
---|
93 | { return ScantableWrapper(STMath::resample(in.getCP(), method, width)); }
|
---|
94 |
|
---|
95 | ScantableWrapper
|
---|
96 | smooth(const ScantableWrapper& in, const std::string& kernel, float width)
|
---|
97 | { return ScantableWrapper(STMath::smooth(in.getCP(), kernel, width)); }
|
---|
98 |
|
---|
99 | ScantableWrapper
|
---|
100 | gainElevation(const ScantableWrapper& in,
|
---|
101 | const std::vector<float>& coeff,
|
---|
102 | const std::string& filename,
|
---|
103 | const std::string& method)
|
---|
104 |
|
---|
105 | { return
|
---|
106 | ScantableWrapper(STMath::gainElevation(in.getCP(), coeff, filename, method)); }
|
---|
107 |
|
---|
108 | ScantableWrapper
|
---|
109 | convertFlux(const ScantableWrapper& in, float d,
|
---|
110 | float etaap, float jyperk)
|
---|
111 | { return ScantableWrapper(STMath::convertFlux(in.getCP(), d, etaap, jyperk)); }
|
---|
112 |
|
---|
113 | ScantableWrapper opacity(const ScantableWrapper& in,
|
---|
114 | float tau)
|
---|
115 | { return ScantableWrapper(STMath::opacity(in.getCP(), tau)); }
|
---|
116 |
|
---|
117 | ScantableWrapper
|
---|
118 | merge(const std::vector<ScantableWrapper >& in)
|
---|
119 |
|
---|
120 | {
|
---|
121 | std::vector<casa::CountedPtr<Scantable> > sts;
|
---|
122 | for (unsigned int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP());
|
---|
123 | return ScantableWrapper(STMath::merge(sts)); }
|
---|
124 |
|
---|
125 | ScantableWrapper rotateXYPhase( const ScantableWrapper& in, float angle)
|
---|
126 | { return ScantableWrapper(STMath::rotateXYPhase(in.getCP(), angle)); }
|
---|
127 |
|
---|
128 | ScantableWrapper rotateLinPolPhase( const ScantableWrapper& in, float angle)
|
---|
129 | { return ScantableWrapper(STMath::rotateLinPolPhase(in.getCP(), angle)); }
|
---|
130 |
|
---|
131 | ScantableWrapper invertPhase( const ScantableWrapper& in )
|
---|
132 | { return ScantableWrapper(STMath::invertPhase(in.getCP())); }
|
---|
133 |
|
---|
134 | ScantableWrapper swapPolarisations( const ScantableWrapper& in )
|
---|
135 | { return ScantableWrapper(STMath::swapPolarisations(in.getCP())); }
|
---|
136 |
|
---|
137 | ScantableWrapper frequencyAlign( const ScantableWrapper& in,
|
---|
138 | const std::string& refTime,
|
---|
139 | const std::string& method )
|
---|
140 | { return ScantableWrapper(STMath::frequencyAlign(in.getCP())); }
|
---|
141 |
|
---|
142 | ScantableWrapper convertPolarisation( const ScantableWrapper& in,
|
---|
143 | const std::string& newtype )
|
---|
144 | { return ScantableWrapper(STMath::convertPolarisation(in.getCP(),newtype)); }
|
---|
145 |
|
---|
146 | };
|
---|
147 |
|
---|
148 | }
|
---|
149 |
|
---|
150 | #endif
|
---|