source: trunk/src/STMathWrapper.h @ 872

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

SDMemTable -> Scnatable handling (asap2)

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