source: trunk/src/STMathWrapper.h @ 1078

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

added scan averaging to average_channel

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.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() {;}
34  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
64    unaryOperate( const ScantableWrapper& in, float val,
65                  const std::string& mode, bool tsys=false )
66  { return ScantableWrapper(STMath::unaryOperate(in.getCP(), val, mode, tsys)); }
[49]67
[1066]68  ScantableWrapper autoQuotient( const ScantableWrapper& in,
69                                 const std::string& mode = "NEAREST",
70                                 bool preserve = true )
71  { return ScantableWrapper(STMath::autoQuotient(in.getCP(), mode, preserve)); }
72
73  ScantableWrapper quotient( const ScantableWrapper& on,
74                             const ScantableWrapper& off,
[872]75                             bool preserve = true )
[1066]76  { return ScantableWrapper( STMath::quotient( on.getCP(), off.getCP(),
77                                               preserve ) ); }
[151]78
[872]79  ScantableWrapper
80    freqSwitch( const ScantableWrapper& in )
81  { return ScantableWrapper(STMath::freqSwitch(in.getCP())); }
[300]82
[872]83  std::vector<float> statistic(const ScantableWrapper& in,
84                               const std::vector<bool>& mask,
85                               const std::string& which)
86  { return STMath::statistic(in.getCP(), mask, which); }
[222]87
[872]88  ScantableWrapper bin( const ScantableWrapper& in, int width=5)
89  { return ScantableWrapper(STMath::bin(in.getCP(), width)); }
[228]90
[872]91  ScantableWrapper
92    resample(const ScantableWrapper& in,
93             const std::string& method, float width)
94  { return ScantableWrapper(STMath::resample(in.getCP(), method, width)); }
[262]95
[872]96  ScantableWrapper
97    smooth(const ScantableWrapper& in, const std::string& kernel, float width)
98  { return ScantableWrapper(STMath::smooth(in.getCP(), kernel, width)); }
[457]99
[872]100  ScantableWrapper
101    gainElevation(const ScantableWrapper& in,
102                  const std::vector<float>& coeff,
103                  const std::string& filename,
[996]104                  const std::string& method)
[503]105
[872]106  { return
107      ScantableWrapper(STMath::gainElevation(in.getCP(), coeff, filename, method)); }
[235]108
[872]109  ScantableWrapper
110    convertFlux(const ScantableWrapper& in, float d,
111                float etaap, float jyperk)
112  { return ScantableWrapper(STMath::convertFlux(in.getCP(), d, etaap, jyperk)); }
[49]113
[872]114  ScantableWrapper opacity(const ScantableWrapper& in,
115                                      float tau)
116  { return ScantableWrapper(STMath::opacity(in.getCP(), tau)); }
[49]117
[872]118  ScantableWrapper
119    merge(const std::vector<ScantableWrapper >& in)
[716]120
[872]121  {
122    std::vector<casa::CountedPtr<Scantable> > sts;
[996]123    for (unsigned int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP());
[872]124    return ScantableWrapper(STMath::merge(sts)); }
[716]125
[912]126  ScantableWrapper rotateXYPhase( const ScantableWrapper& in, float angle)
127  { return ScantableWrapper(STMath::rotateXYPhase(in.getCP(), angle)); }
128
129  ScantableWrapper rotateLinPolPhase( const ScantableWrapper& in, float angle)
130  { return ScantableWrapper(STMath::rotateLinPolPhase(in.getCP(), angle)); }
131
132  ScantableWrapper invertPhase( const ScantableWrapper& in )
133  { return ScantableWrapper(STMath::invertPhase(in.getCP())); }
134
135  ScantableWrapper swapPolarisations( const ScantableWrapper& in )
136  { return ScantableWrapper(STMath::swapPolarisations(in.getCP())); }
137
[927]138  ScantableWrapper frequencyAlign( const ScantableWrapper& in,
139                                   const std::string& refTime,
140                                   const std::string& method  )
141  { return ScantableWrapper(STMath::frequencyAlign(in.getCP())); }
142
[992]143  ScantableWrapper convertPolarisation( const ScantableWrapper& in,
144                                        const std::string& newtype )
145  { return ScantableWrapper(STMath::convertPolarisation(in.getCP(),newtype)); }
146
[49]147};
148
[872]149}
150
[49]151#endif
Note: See TracBrowser for help on using the repository browser.