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

Last change on this file since 1673 was 1673, checked in by Takeshi Nakazato, 14 years ago

New Development: No

JIRA Issue: Yes CAS-1799

Ready to Release: No

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...

Calibration algorithm for ALMA data (data from OSF) is updated.


  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.5 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
[1308]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
[1066]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,
[872]89                             bool preserve = true )
[1066]90  { return ScantableWrapper( STMath::quotient( on.getCP(), off.getCP(),
91                                               preserve ) ); }
[151]92
[1388]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
[872]114  ScantableWrapper
115    freqSwitch( const ScantableWrapper& in )
116  { return ScantableWrapper(STMath::freqSwitch(in.getCP())); }
[300]117
[872]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); }
[222]122
[1516]123  std::vector<int> minMaxChan(const ScantableWrapper& in,
[1514]124                               const std::vector<bool>& mask,
125                               const std::string& which)
[1516]126  { return STMath::minMaxChan(in.getCP(), mask, which); }
[1514]127
[872]128  ScantableWrapper bin( const ScantableWrapper& in, int width=5)
129  { return ScantableWrapper(STMath::bin(in.getCP(), width)); }
[228]130
[872]131  ScantableWrapper
132    resample(const ScantableWrapper& in,
133             const std::string& method, float width)
134  { return ScantableWrapper(STMath::resample(in.getCP(), method, width)); }
[262]135
[872]136  ScantableWrapper
137    smooth(const ScantableWrapper& in, const std::string& kernel, float width)
138  { return ScantableWrapper(STMath::smooth(in.getCP(), kernel, width)); }
[457]139
[872]140  ScantableWrapper
141    gainElevation(const ScantableWrapper& in,
142                  const std::vector<float>& coeff,
143                  const std::string& filename,
[996]144                  const std::string& method)
[503]145
[872]146  { return
147      ScantableWrapper(STMath::gainElevation(in.getCP(), coeff, filename, method)); }
[235]148
[872]149  ScantableWrapper
150    convertFlux(const ScantableWrapper& in, float d,
151                float etaap, float jyperk)
152  { return ScantableWrapper(STMath::convertFlux(in.getCP(), d, etaap, jyperk)); }
[49]153
[872]154  ScantableWrapper opacity(const ScantableWrapper& in,
155                                      float tau)
156  { return ScantableWrapper(STMath::opacity(in.getCP(), tau)); }
[49]157
[872]158  ScantableWrapper
159    merge(const std::vector<ScantableWrapper >& in)
[716]160
[872]161  {
162    std::vector<casa::CountedPtr<Scantable> > sts;
[996]163    for (unsigned int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP());
[872]164    return ScantableWrapper(STMath::merge(sts)); }
[716]165
[912]166  ScantableWrapper rotateXYPhase( const ScantableWrapper& in, float angle)
167  { return ScantableWrapper(STMath::rotateXYPhase(in.getCP(), angle)); }
168
169  ScantableWrapper rotateLinPolPhase( const ScantableWrapper& in, float angle)
170  { return ScantableWrapper(STMath::rotateLinPolPhase(in.getCP(), angle)); }
171
172  ScantableWrapper invertPhase( const ScantableWrapper& in )
173  { return ScantableWrapper(STMath::invertPhase(in.getCP())); }
174
175  ScantableWrapper swapPolarisations( const ScantableWrapper& in )
176  { return ScantableWrapper(STMath::swapPolarisations(in.getCP())); }
177
[927]178  ScantableWrapper frequencyAlign( const ScantableWrapper& in,
179                                   const std::string& refTime,
180                                   const std::string& method  )
181  { return ScantableWrapper(STMath::frequencyAlign(in.getCP())); }
182
[992]183  ScantableWrapper convertPolarisation( const ScantableWrapper& in,
184                                        const std::string& newtype )
185  { return ScantableWrapper(STMath::convertPolarisation(in.getCP(),newtype)); }
[1145]186
[1140]187  ScantableWrapper mxExtract( const ScantableWrapper& in,
188                              const std::string& scantype="on" )
189  { return ScantableWrapper(STMath::mxExtract(in.getCP(),scantype)); }
[992]190
[1192]191  ScantableWrapper lagFlag( const ScantableWrapper& in,
[1200]192                            double frequency, double width )
[1192]193  { return ScantableWrapper(STMath::lagFlag(in.getCP(), frequency, width)); }
194
[1446]195  // test for average spectra with different channel/resolution
196  ScantableWrapper
197    new_average( const std::vector<ScantableWrapper>& in,
198                 const bool& compel,
199                 const std::vector<bool>& mask,
200                 const std::string& weight,
201                 const std::string& avmode )
202  {
203    std::vector<casa::CountedPtr<Scantable> > sts;
204    for (unsigned int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP());
205    return ScantableWrapper(STMath::new_average(sts, compel, mask, weight, avmode));
206  }
207
[1633]208  // cwcal
209  ScantableWrapper cwcal( const ScantableWrapper &in,
210                          const std::string calmode,
211                          const std::string antname )
212  {
213    casa::CountedPtr<Scantable> tab = in.getCP() ;
214    casa::String mode( calmode ) ;
215    casa::String name( antname ) ;
216    return ScantableWrapper( STMath::cwcal( tab, mode, name ) ) ;
217  }
[1673]218  // almacal
219  ScantableWrapper almacal( const ScantableWrapper &in,
220                          const std::string calmode )
221  {
222    casa::CountedPtr<Scantable> tab = in.getCP() ;
223    casa::String mode( calmode ) ;
224    return ScantableWrapper( STMath::almacal( tab, mode ) ) ;
225  }
[49]226};
227
[872]228}
229
[49]230#endif
Note: See TracBrowser for help on using the repository browser.