source: branches/alma/src/STMathWrapper.h@ 1481

Last change on this file since 1481 was 1446, checked in by TakTsutsumi, 16 years ago

Merged recent updates (since 2007) from nrao-asap

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.6 KB
Line 
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
24namespace asap {
25
26/**
27Wrapper class to handle ScantableWrapper
28
29@author Malte Marquarding
30*/
31class STMathWrapper : public STMath {
32public:
33 STMathWrapper() {;}
34 explicit 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 const std::string& avmode = "NONE")
53 {
54 return ScantableWrapper(STMath::averageChannel(in.getCP(), mode, avmode));
55 }
56
57 ScantableWrapper
58 averagePolarisations( const ScantableWrapper& in,
59 const std::vector<bool>& mask,
60 const std::string& weight)
61 { return ScantableWrapper(STMath::averagePolarisations(in.getCP(),mask, weight));}
62
63 ScantableWrapper
64 averageBeams( const ScantableWrapper& in,
65 const std::vector<bool>& mask,
66 const std::string& weight)
67
68 { return ScantableWrapper(STMath::averageBeams(in.getCP(),mask, weight));}
69
70 ScantableWrapper
71 unaryOperate( const ScantableWrapper& in, float val,
72 const std::string& mode, bool tsys=false )
73 { return ScantableWrapper(STMath::unaryOperate(in.getCP(), val, mode, tsys)); }
74
75 ScantableWrapper binaryOperate( const ScantableWrapper& left,
76 const ScantableWrapper& right,
77 const std::string& mode)
78 { return ScantableWrapper( STMath::binaryOperate( left.getCP(), right.getCP(),
79 mode ) ); }
80
81
82 ScantableWrapper autoQuotient( const ScantableWrapper& in,
83 const std::string& mode = "NEAREST",
84 bool preserve = true )
85 { return ScantableWrapper(STMath::autoQuotient(in.getCP(), mode, preserve)); }
86
87 ScantableWrapper quotient( const ScantableWrapper& on,
88 const ScantableWrapper& off,
89 bool preserve = true )
90 { return ScantableWrapper( STMath::quotient( on.getCP(), off.getCP(),
91 preserve ) ); }
92
93 ScantableWrapper dototalpower( const ScantableWrapper& calon,
94 const ScantableWrapper& caloff, casa::Float tcal= 0 )
95 { return ScantableWrapper( STMath::dototalpower( calon.getCP(), caloff.getCP(), tcal ) ); }
96
97 ScantableWrapper dosigref( const ScantableWrapper& sig,
98 const ScantableWrapper& ref,
99 int smoothref = 0, casa::Float tsysv=0.0, casa::Float tau=0.0)
100 { return ScantableWrapper( STMath::dosigref( sig.getCP(), ref.getCP(), smoothref, tsysv, tau ) ); }
101
102 ScantableWrapper donod( const ScantableWrapper& s,
103 const std::vector<int>& scans,
104 int smoothref = 0,
105 casa::Float tsysv=0.0, casa::Float tau=0.0, casa::Float tcal=0.0 )
106 { return ScantableWrapper( STMath::donod( s.getCP(), scans, smoothref, tsysv, tau, tcal ) ); }
107
108 ScantableWrapper dofs( const ScantableWrapper& s,
109 const std::vector<int>& scans,
110 int smoothref = 0,
111 casa::Float tsysv=0.0, casa::Float tau=0.0, casa::Float tcal=0.0 )
112 { return ScantableWrapper( STMath::dofs( s.getCP(), scans, smoothref, tsysv, tau, tcal ) ); }
113
114 ScantableWrapper
115 freqSwitch( const ScantableWrapper& in )
116 { return ScantableWrapper(STMath::freqSwitch(in.getCP())); }
117
118 std::vector<float> statistic(const ScantableWrapper& in,
119 const std::vector<bool>& mask,
120 const std::string& which)
121 { return STMath::statistic(in.getCP(), mask, which); }
122
123 ScantableWrapper bin( const ScantableWrapper& in, int width=5)
124 { return ScantableWrapper(STMath::bin(in.getCP(), width)); }
125
126 ScantableWrapper
127 resample(const ScantableWrapper& in,
128 const std::string& method, float width)
129 { return ScantableWrapper(STMath::resample(in.getCP(), method, width)); }
130
131 ScantableWrapper
132 smooth(const ScantableWrapper& in, const std::string& kernel, float width)
133 { return ScantableWrapper(STMath::smooth(in.getCP(), kernel, width)); }
134
135 ScantableWrapper
136 gainElevation(const ScantableWrapper& in,
137 const std::vector<float>& coeff,
138 const std::string& filename,
139 const std::string& method)
140
141 { return
142 ScantableWrapper(STMath::gainElevation(in.getCP(), coeff, filename, method)); }
143
144 ScantableWrapper
145 convertFlux(const ScantableWrapper& in, float d,
146 float etaap, float jyperk)
147 { return ScantableWrapper(STMath::convertFlux(in.getCP(), d, etaap, jyperk)); }
148
149 ScantableWrapper opacity(const ScantableWrapper& in,
150 float tau)
151 { return ScantableWrapper(STMath::opacity(in.getCP(), tau)); }
152
153 ScantableWrapper
154 merge(const std::vector<ScantableWrapper >& in)
155
156 {
157 std::vector<casa::CountedPtr<Scantable> > sts;
158 for (unsigned int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP());
159 return ScantableWrapper(STMath::merge(sts)); }
160
161 ScantableWrapper rotateXYPhase( const ScantableWrapper& in, float angle)
162 { return ScantableWrapper(STMath::rotateXYPhase(in.getCP(), angle)); }
163
164 ScantableWrapper rotateLinPolPhase( const ScantableWrapper& in, float angle)
165 { return ScantableWrapper(STMath::rotateLinPolPhase(in.getCP(), angle)); }
166
167 ScantableWrapper invertPhase( const ScantableWrapper& in )
168 { return ScantableWrapper(STMath::invertPhase(in.getCP())); }
169
170 ScantableWrapper swapPolarisations( const ScantableWrapper& in )
171 { return ScantableWrapper(STMath::swapPolarisations(in.getCP())); }
172
173 ScantableWrapper frequencyAlign( const ScantableWrapper& in,
174 const std::string& refTime,
175 const std::string& method )
176 { return ScantableWrapper(STMath::frequencyAlign(in.getCP())); }
177
178 ScantableWrapper convertPolarisation( const ScantableWrapper& in,
179 const std::string& newtype )
180 { return ScantableWrapper(STMath::convertPolarisation(in.getCP(),newtype)); }
181
182 ScantableWrapper mxExtract( const ScantableWrapper& in,
183 const std::string& scantype="on" )
184 { return ScantableWrapper(STMath::mxExtract(in.getCP(),scantype)); }
185
186 ScantableWrapper lagFlag( const ScantableWrapper& in,
187 double frequency, double width )
188 { return ScantableWrapper(STMath::lagFlag(in.getCP(), frequency, width)); }
189
190 // test for average spectra with different channel/resolution
191 ScantableWrapper
192 new_average( const std::vector<ScantableWrapper>& in,
193 const bool& compel,
194 const std::vector<bool>& mask,
195 const std::string& weight,
196 const std::string& avmode )
197 {
198 std::vector<casa::CountedPtr<Scantable> > sts;
199 for (unsigned int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP());
200 return ScantableWrapper(STMath::new_average(sts, compel, mask, weight, avmode));
201 }
202
203};
204
205}
206
207#endif
Note: See TracBrowser for help on using the repository browser.