source: trunk/src/STMathWrapper.h @ 996

Last change on this file since 996 was 996, checked in by mar637, 18 years ago

more fixes after compiling with -Wall.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 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  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  ScantableWrapper
49    averagePolarisations( const ScantableWrapper& in,
50                          const std::vector<bool>& mask,
51                          const std::string& weight)
52  { return ScantableWrapper(STMath::averagePolarisations(in.getCP(),mask, weight));}
53
54  ScantableWrapper
55    unaryOperate( const ScantableWrapper& in, float val,
56                  const std::string& mode, bool tsys=false )
57  { return ScantableWrapper(STMath::unaryOperate(in.getCP(), val, mode, tsys)); }
58
59  ScantableWrapper quotient( const ScantableWrapper& in,
60                             const std::string& mode = "NEAREST",
61                             bool preserve = true )
62  { return ScantableWrapper(STMath::quotient(in.getCP(), mode, preserve)); }
63
64  ScantableWrapper
65    freqSwitch( const ScantableWrapper& in )
66  { return ScantableWrapper(STMath::freqSwitch(in.getCP())); }
67
68  std::vector<float> statistic(const ScantableWrapper& in,
69                               const std::vector<bool>& mask,
70                               const std::string& which)
71  { return STMath::statistic(in.getCP(), mask, which); }
72
73  ScantableWrapper bin( const ScantableWrapper& in, int width=5)
74  { return ScantableWrapper(STMath::bin(in.getCP(), width)); }
75
76  ScantableWrapper
77    resample(const ScantableWrapper& in,
78             const std::string& method, float width)
79  { return ScantableWrapper(STMath::resample(in.getCP(), method, width)); }
80
81  ScantableWrapper
82    smooth(const ScantableWrapper& in, const std::string& kernel, float width)
83  { return ScantableWrapper(STMath::smooth(in.getCP(), kernel, width)); }
84
85  ScantableWrapper
86    gainElevation(const ScantableWrapper& in,
87                  const std::vector<float>& coeff,
88                  const std::string& filename,
89                  const std::string& method)
90
91  { return
92      ScantableWrapper(STMath::gainElevation(in.getCP(), coeff, filename, method)); }
93
94  ScantableWrapper
95    convertFlux(const ScantableWrapper& in, float d,
96                float etaap, float jyperk)
97  { return ScantableWrapper(STMath::convertFlux(in.getCP(), d, etaap, jyperk)); }
98
99  ScantableWrapper opacity(const ScantableWrapper& in,
100                                      float tau)
101  { return ScantableWrapper(STMath::opacity(in.getCP(), tau)); }
102
103  ScantableWrapper
104    merge(const std::vector<ScantableWrapper >& in)
105
106  {
107    std::vector<casa::CountedPtr<Scantable> > sts;
108    for (unsigned int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP());
109    return ScantableWrapper(STMath::merge(sts)); }
110
111  ScantableWrapper rotateXYPhase( const ScantableWrapper& in, float angle)
112  { return ScantableWrapper(STMath::rotateXYPhase(in.getCP(), angle)); }
113
114  ScantableWrapper rotateLinPolPhase( const ScantableWrapper& in, float angle)
115  { return ScantableWrapper(STMath::rotateLinPolPhase(in.getCP(), angle)); }
116
117  ScantableWrapper invertPhase( const ScantableWrapper& in )
118  { return ScantableWrapper(STMath::invertPhase(in.getCP())); }
119
120  ScantableWrapper swapPolarisations( const ScantableWrapper& in )
121  { return ScantableWrapper(STMath::swapPolarisations(in.getCP())); }
122
123  ScantableWrapper frequencyAlign( const ScantableWrapper& in,
124                                   const std::string& refTime,
125                                   const std::string& method  )
126  { return ScantableWrapper(STMath::frequencyAlign(in.getCP())); }
127
128  ScantableWrapper convertPolarisation( const ScantableWrapper& in,
129                                        const std::string& newtype )
130  { return ScantableWrapper(STMath::convertPolarisation(in.getCP(),newtype)); }
131
132};
133
134}
135
136#endif
Note: See TracBrowser for help on using the repository browser.