[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] | 24 | namespace asap {
|
---|
[49] | 25 |
|
---|
[872] | 26 | /**
|
---|
| 27 | Wrapper class to handle ScantableWrapper
|
---|
[49] | 28 |
|
---|
[872] | 29 | @author Malte Marquarding
|
---|
| 30 | */
|
---|
| 31 | class STMathWrapper : public STMath {
|
---|
| 32 | public:
|
---|
| 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,
|
---|
| 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 | }
|
---|
[107] | 49 |
|
---|
[872] | 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)); }
|
---|
[49] | 54 |
|
---|
[872] | 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)); }
|
---|
[151] | 59 |
|
---|
[872] | 60 | ScantableWrapper
|
---|
| 61 | freqSwitch( const ScantableWrapper& in )
|
---|
| 62 | { return ScantableWrapper(STMath::freqSwitch(in.getCP())); }
|
---|
[300] | 63 |
|
---|
[872] | 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); }
|
---|
[222] | 68 |
|
---|
[872] | 69 | ScantableWrapper bin( const ScantableWrapper& in, int width=5)
|
---|
| 70 | { return ScantableWrapper(STMath::bin(in.getCP(), width)); }
|
---|
[228] | 71 |
|
---|
[872] | 72 | ScantableWrapper
|
---|
| 73 | resample(const ScantableWrapper& in,
|
---|
| 74 | const std::string& method, float width)
|
---|
| 75 | { return ScantableWrapper(STMath::resample(in.getCP(), method, width)); }
|
---|
[262] | 76 |
|
---|
[872] | 77 | ScantableWrapper
|
---|
| 78 | smooth(const ScantableWrapper& in, const std::string& kernel, float width)
|
---|
| 79 | { return ScantableWrapper(STMath::smooth(in.getCP(), kernel, width)); }
|
---|
[457] | 80 |
|
---|
[872] | 81 | ScantableWrapper
|
---|
| 82 | gainElevation(const ScantableWrapper& in,
|
---|
| 83 | const std::vector<float>& coeff,
|
---|
| 84 | const std::string& filename,
|
---|
| 85 | const std::string& method)
|
---|
[503] | 86 |
|
---|
[872] | 87 | { return
|
---|
| 88 | ScantableWrapper(STMath::gainElevation(in.getCP(), coeff, filename, method)); }
|
---|
[235] | 89 |
|
---|
[872] | 90 | ScantableWrapper
|
---|
| 91 | convertFlux(const ScantableWrapper& in, float d,
|
---|
| 92 | float etaap, float jyperk)
|
---|
| 93 | { return ScantableWrapper(STMath::convertFlux(in.getCP(), d, etaap, jyperk)); }
|
---|
[49] | 94 |
|
---|
[872] | 95 | ScantableWrapper opacity(const ScantableWrapper& in,
|
---|
| 96 | float tau)
|
---|
| 97 | { return ScantableWrapper(STMath::opacity(in.getCP(), tau)); }
|
---|
[49] | 98 |
|
---|
[872] | 99 | ScantableWrapper
|
---|
| 100 | merge(const std::vector<ScantableWrapper >& in)
|
---|
[716] | 101 |
|
---|
[872] | 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)); }
|
---|
[716] | 106 |
|
---|
[49] | 107 | };
|
---|
| 108 |
|
---|
[872] | 109 | }
|
---|
| 110 |
|
---|
[49] | 111 | #endif
|
---|