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