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