[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 | }
|
---|
[940] | 49 | ScantableWrapper
|
---|
| 50 | averagePolarisations( const ScantableWrapper& in,
|
---|
| 51 | const std::vector<bool>& mask,
|
---|
| 52 | const std::string& weight)
|
---|
| 53 | { return ScantableWrapper(STMath::averagePolarisations(in.getCP(),mask, weight));}
|
---|
[107] | 54 |
|
---|
[872] | 55 | ScantableWrapper
|
---|
| 56 | unaryOperate( const ScantableWrapper& in, float val,
|
---|
| 57 | const std::string& mode, bool tsys=false )
|
---|
| 58 | { return ScantableWrapper(STMath::unaryOperate(in.getCP(), val, mode, tsys)); }
|
---|
[49] | 59 |
|
---|
[872] | 60 | ScantableWrapper quotient( const ScantableWrapper& in,
|
---|
| 61 | const std::string& mode = "NEAREST",
|
---|
| 62 | bool preserve = true )
|
---|
| 63 | { return ScantableWrapper(STMath::quotient(in.getCP(), mode, preserve)); }
|
---|
[151] | 64 |
|
---|
[872] | 65 | ScantableWrapper
|
---|
| 66 | freqSwitch( const ScantableWrapper& in )
|
---|
| 67 | { return ScantableWrapper(STMath::freqSwitch(in.getCP())); }
|
---|
[300] | 68 |
|
---|
[872] | 69 | std::vector<float> statistic(const ScantableWrapper& in,
|
---|
| 70 | const std::vector<bool>& mask,
|
---|
| 71 | const std::string& which)
|
---|
| 72 | { return STMath::statistic(in.getCP(), mask, which); }
|
---|
[222] | 73 |
|
---|
[872] | 74 | ScantableWrapper bin( const ScantableWrapper& in, int width=5)
|
---|
| 75 | { return ScantableWrapper(STMath::bin(in.getCP(), width)); }
|
---|
[228] | 76 |
|
---|
[872] | 77 | ScantableWrapper
|
---|
| 78 | resample(const ScantableWrapper& in,
|
---|
| 79 | const std::string& method, float width)
|
---|
| 80 | { return ScantableWrapper(STMath::resample(in.getCP(), method, width)); }
|
---|
[262] | 81 |
|
---|
[872] | 82 | ScantableWrapper
|
---|
| 83 | smooth(const ScantableWrapper& in, const std::string& kernel, float width)
|
---|
| 84 | { return ScantableWrapper(STMath::smooth(in.getCP(), kernel, width)); }
|
---|
[457] | 85 |
|
---|
[872] | 86 | ScantableWrapper
|
---|
| 87 | gainElevation(const ScantableWrapper& in,
|
---|
| 88 | const std::vector<float>& coeff,
|
---|
| 89 | const std::string& filename,
|
---|
| 90 | const std::string& method)
|
---|
[503] | 91 |
|
---|
[872] | 92 | { return
|
---|
| 93 | ScantableWrapper(STMath::gainElevation(in.getCP(), coeff, filename, method)); }
|
---|
[235] | 94 |
|
---|
[872] | 95 | ScantableWrapper
|
---|
| 96 | convertFlux(const ScantableWrapper& in, float d,
|
---|
| 97 | float etaap, float jyperk)
|
---|
| 98 | { return ScantableWrapper(STMath::convertFlux(in.getCP(), d, etaap, jyperk)); }
|
---|
[49] | 99 |
|
---|
[872] | 100 | ScantableWrapper opacity(const ScantableWrapper& in,
|
---|
| 101 | float tau)
|
---|
| 102 | { return ScantableWrapper(STMath::opacity(in.getCP(), tau)); }
|
---|
[49] | 103 |
|
---|
[872] | 104 | ScantableWrapper
|
---|
| 105 | merge(const std::vector<ScantableWrapper >& in)
|
---|
[716] | 106 |
|
---|
[872] | 107 | {
|
---|
| 108 | std::vector<casa::CountedPtr<Scantable> > sts;
|
---|
| 109 | for (int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP());
|
---|
| 110 | return ScantableWrapper(STMath::merge(sts)); }
|
---|
[716] | 111 |
|
---|
[912] | 112 | ScantableWrapper rotateXYPhase( const ScantableWrapper& in, float angle)
|
---|
| 113 | { return ScantableWrapper(STMath::rotateXYPhase(in.getCP(), angle)); }
|
---|
| 114 |
|
---|
| 115 | ScantableWrapper rotateLinPolPhase( const ScantableWrapper& in, float angle)
|
---|
| 116 | { return ScantableWrapper(STMath::rotateLinPolPhase(in.getCP(), angle)); }
|
---|
| 117 |
|
---|
| 118 | ScantableWrapper invertPhase( const ScantableWrapper& in )
|
---|
| 119 | { return ScantableWrapper(STMath::invertPhase(in.getCP())); }
|
---|
| 120 |
|
---|
| 121 | ScantableWrapper swapPolarisations( const ScantableWrapper& in )
|
---|
| 122 | { return ScantableWrapper(STMath::swapPolarisations(in.getCP())); }
|
---|
| 123 |
|
---|
[927] | 124 | ScantableWrapper frequencyAlign( const ScantableWrapper& in,
|
---|
| 125 | const std::string& refTime,
|
---|
| 126 | const std::string& method )
|
---|
| 127 | { return ScantableWrapper(STMath::frequencyAlign(in.getCP())); }
|
---|
| 128 |
|
---|
[49] | 129 | };
|
---|
| 130 |
|
---|
[872] | 131 | }
|
---|
| 132 |
|
---|
[49] | 133 | #endif
|
---|