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

Last change on this file since 1749 was 1680, checked in by Takeshi Nakazato, 15 years ago

New Development: No

JIRA Issue: Yes CAS-1823

Ready to Release: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

  1. Bug fix

In scantable.py, self._math = stmath() should be
self._math = stmath( rcParamsinsitu ).

  1. Delete operation mode

I have deleted operation mode parameter which is used for a function
to do an operation of scantable with 1D list, since I have implemented
the operation of scantable with 2D list.

  1. Extend operation of scantable

Now, operation of scantable with 2D list is available.

  1. Accept integer input for operation

Operation of scantable with int as well as int list is working
in addition to operation with float or float list.


  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.1 KB
RevLine 
[872]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
[49]14
15#include <vector>
16#include <string>
17
[872]18#include <casa/Utilities/CountedPtr.h>
[49]19
[872]20#include "STMath.h"
21#include "Scantable.h"
22#include "ScantableWrapper.h"
[49]23
[83]24namespace asap {
[49]25
[872]26/**
27Wrapper class to handle ScantableWrapper
[49]28
[872]29@author Malte Marquarding
30*/
31class STMathWrapper : public STMath {
32public:
33 STMathWrapper() {;}
[1353]34 explicit STMathWrapper(bool insitu) : STMath(insitu) {;}
[716]35
[872]36 virtual ~STMathWrapper() {;}
[49]37
[872]38 ScantableWrapper
39 average( const std::vector<ScantableWrapper>& in,
40 const std::vector<bool>& mask,
41 const std::string& weight,
[977]42 const std::string& avmode )
[872]43 {
44 std::vector<casa::CountedPtr<Scantable> > sts;
[996]45 for (unsigned int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP());
[978]46 return ScantableWrapper(STMath::average(sts, mask, weight, avmode));
[872]47 }
[1069]48
[940]49 ScantableWrapper
[1069]50 averageChannel( const ScantableWrapper& in,
[1078]51 const std::string& mode = "MEDIAN",
52 const std::string& avmode = "NONE")
[1069]53 {
[1078]54 return ScantableWrapper(STMath::averageChannel(in.getCP(), mode, avmode));
[1069]55 }
56
57 ScantableWrapper
[940]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));}
[107]62
[872]63 ScantableWrapper
[1145]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
[872]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)); }
[49]74
[1677]75 ScantableWrapper arrayOperate( const ScantableWrapper& in,
76 const std::vector<float> val,
[1680]77 const std::string& mode,
78 bool tsys=false )
79 { return ScantableWrapper(STMath::arrayOperateChannel(in.getCP(), val, mode, tsys)); }
[1677]80
81 ScantableWrapper array2dOperate( const ScantableWrapper& in,
82 const std::vector< std::vector<float> > val,
83 const std::string& mode, bool tsys=false )
84 { return ScantableWrapper(STMath::array2dOperate(in.getCP(), val, mode, tsys)); }
85
[1308]86 ScantableWrapper binaryOperate( const ScantableWrapper& left,
87 const ScantableWrapper& right,
88 const std::string& mode)
89 { return ScantableWrapper( STMath::binaryOperate( left.getCP(), right.getCP(),
90 mode ) ); }
91
92
[1066]93 ScantableWrapper autoQuotient( const ScantableWrapper& in,
94 const std::string& mode = "NEAREST",
95 bool preserve = true )
96 { return ScantableWrapper(STMath::autoQuotient(in.getCP(), mode, preserve)); }
97
98 ScantableWrapper quotient( const ScantableWrapper& on,
99 const ScantableWrapper& off,
[872]100 bool preserve = true )
[1066]101 { return ScantableWrapper( STMath::quotient( on.getCP(), off.getCP(),
102 preserve ) ); }
[151]103
[1388]104 ScantableWrapper dototalpower( const ScantableWrapper& calon,
105 const ScantableWrapper& caloff, casa::Float tcal= 0 )
106 { return ScantableWrapper( STMath::dototalpower( calon.getCP(), caloff.getCP(), tcal ) ); }
107
108 ScantableWrapper dosigref( const ScantableWrapper& sig,
109 const ScantableWrapper& ref,
110 int smoothref = 0, casa::Float tsysv=0.0, casa::Float tau=0.0)
111 { return ScantableWrapper( STMath::dosigref( sig.getCP(), ref.getCP(), smoothref, tsysv, tau ) ); }
112
113 ScantableWrapper donod( const ScantableWrapper& s,
114 const std::vector<int>& scans,
115 int smoothref = 0,
116 casa::Float tsysv=0.0, casa::Float tau=0.0, casa::Float tcal=0.0 )
117 { return ScantableWrapper( STMath::donod( s.getCP(), scans, smoothref, tsysv, tau, tcal ) ); }
118
119 ScantableWrapper dofs( const ScantableWrapper& s,
120 const std::vector<int>& scans,
121 int smoothref = 0,
122 casa::Float tsysv=0.0, casa::Float tau=0.0, casa::Float tcal=0.0 )
123 { return ScantableWrapper( STMath::dofs( s.getCP(), scans, smoothref, tsysv, tau, tcal ) ); }
124
[872]125 ScantableWrapper
126 freqSwitch( const ScantableWrapper& in )
127 { return ScantableWrapper(STMath::freqSwitch(in.getCP())); }
[300]128
[872]129 std::vector<float> statistic(const ScantableWrapper& in,
130 const std::vector<bool>& mask,
131 const std::string& which)
132 { return STMath::statistic(in.getCP(), mask, which); }
[222]133
[1516]134 std::vector<int> minMaxChan(const ScantableWrapper& in,
[1514]135 const std::vector<bool>& mask,
136 const std::string& which)
[1516]137 { return STMath::minMaxChan(in.getCP(), mask, which); }
[1514]138
[872]139 ScantableWrapper bin( const ScantableWrapper& in, int width=5)
140 { return ScantableWrapper(STMath::bin(in.getCP(), width)); }
[228]141
[872]142 ScantableWrapper
143 resample(const ScantableWrapper& in,
144 const std::string& method, float width)
145 { return ScantableWrapper(STMath::resample(in.getCP(), method, width)); }
[262]146
[872]147 ScantableWrapper
148 smooth(const ScantableWrapper& in, const std::string& kernel, float width)
149 { return ScantableWrapper(STMath::smooth(in.getCP(), kernel, width)); }
[457]150
[872]151 ScantableWrapper
152 gainElevation(const ScantableWrapper& in,
153 const std::vector<float>& coeff,
154 const std::string& filename,
[996]155 const std::string& method)
[503]156
[872]157 { return
158 ScantableWrapper(STMath::gainElevation(in.getCP(), coeff, filename, method)); }
[235]159
[872]160 ScantableWrapper
161 convertFlux(const ScantableWrapper& in, float d,
162 float etaap, float jyperk)
163 { return ScantableWrapper(STMath::convertFlux(in.getCP(), d, etaap, jyperk)); }
[49]164
[872]165 ScantableWrapper opacity(const ScantableWrapper& in,
166 float tau)
167 { return ScantableWrapper(STMath::opacity(in.getCP(), tau)); }
[49]168
[872]169 ScantableWrapper
170 merge(const std::vector<ScantableWrapper >& in)
[716]171
[872]172 {
173 std::vector<casa::CountedPtr<Scantable> > sts;
[996]174 for (unsigned int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP());
[872]175 return ScantableWrapper(STMath::merge(sts)); }
[716]176
[912]177 ScantableWrapper rotateXYPhase( const ScantableWrapper& in, float angle)
178 { return ScantableWrapper(STMath::rotateXYPhase(in.getCP(), angle)); }
179
180 ScantableWrapper rotateLinPolPhase( const ScantableWrapper& in, float angle)
181 { return ScantableWrapper(STMath::rotateLinPolPhase(in.getCP(), angle)); }
182
183 ScantableWrapper invertPhase( const ScantableWrapper& in )
184 { return ScantableWrapper(STMath::invertPhase(in.getCP())); }
185
186 ScantableWrapper swapPolarisations( const ScantableWrapper& in )
187 { return ScantableWrapper(STMath::swapPolarisations(in.getCP())); }
188
[927]189 ScantableWrapper frequencyAlign( const ScantableWrapper& in,
190 const std::string& refTime,
191 const std::string& method )
192 { return ScantableWrapper(STMath::frequencyAlign(in.getCP())); }
193
[992]194 ScantableWrapper convertPolarisation( const ScantableWrapper& in,
195 const std::string& newtype )
196 { return ScantableWrapper(STMath::convertPolarisation(in.getCP(),newtype)); }
[1145]197
[1140]198 ScantableWrapper mxExtract( const ScantableWrapper& in,
199 const std::string& scantype="on" )
200 { return ScantableWrapper(STMath::mxExtract(in.getCP(),scantype)); }
[992]201
[1192]202 ScantableWrapper lagFlag( const ScantableWrapper& in,
[1200]203 double frequency, double width )
[1192]204 { return ScantableWrapper(STMath::lagFlag(in.getCP(), frequency, width)); }
205
[1446]206 // test for average spectra with different channel/resolution
207 ScantableWrapper
208 new_average( const std::vector<ScantableWrapper>& in,
209 const bool& compel,
210 const std::vector<bool>& mask,
211 const std::string& weight,
212 const std::string& avmode )
213 {
214 std::vector<casa::CountedPtr<Scantable> > sts;
215 for (unsigned int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP());
216 return ScantableWrapper(STMath::new_average(sts, compel, mask, weight, avmode));
217 }
218
[1633]219 // cwcal
220 ScantableWrapper cwcal( const ScantableWrapper &in,
221 const std::string calmode,
222 const std::string antname )
223 {
224 casa::CountedPtr<Scantable> tab = in.getCP() ;
225 casa::String mode( calmode ) ;
226 casa::String name( antname ) ;
227 return ScantableWrapper( STMath::cwcal( tab, mode, name ) ) ;
228 }
[1673]229 // almacal
230 ScantableWrapper almacal( const ScantableWrapper &in,
231 const std::string calmode )
232 {
233 casa::CountedPtr<Scantable> tab = in.getCP() ;
234 casa::String mode( calmode ) ;
235 return ScantableWrapper( STMath::almacal( tab, mode ) ) ;
236 }
[49]237};
238
[872]239}
240
[49]241#endif
Note: See TracBrowser for help on using the repository browser.