[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,
|
---|
[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 |
|
---|
[1066] | 75 | ScantableWrapper autoQuotient( const ScantableWrapper& in,
|
---|
| 76 | const std::string& mode = "NEAREST",
|
---|
| 77 | bool preserve = true )
|
---|
| 78 | { return ScantableWrapper(STMath::autoQuotient(in.getCP(), mode, preserve)); }
|
---|
| 79 |
|
---|
| 80 | ScantableWrapper quotient( const ScantableWrapper& on,
|
---|
| 81 | const ScantableWrapper& off,
|
---|
[872] | 82 | bool preserve = true )
|
---|
[1066] | 83 | { return ScantableWrapper( STMath::quotient( on.getCP(), off.getCP(),
|
---|
| 84 | preserve ) ); }
|
---|
[151] | 85 |
|
---|
[872] | 86 | ScantableWrapper
|
---|
| 87 | freqSwitch( const ScantableWrapper& in )
|
---|
| 88 | { return ScantableWrapper(STMath::freqSwitch(in.getCP())); }
|
---|
[300] | 89 |
|
---|
[872] | 90 | std::vector<float> statistic(const ScantableWrapper& in,
|
---|
| 91 | const std::vector<bool>& mask,
|
---|
| 92 | const std::string& which)
|
---|
| 93 | { return STMath::statistic(in.getCP(), mask, which); }
|
---|
[222] | 94 |
|
---|
[872] | 95 | ScantableWrapper bin( const ScantableWrapper& in, int width=5)
|
---|
| 96 | { return ScantableWrapper(STMath::bin(in.getCP(), width)); }
|
---|
[228] | 97 |
|
---|
[872] | 98 | ScantableWrapper
|
---|
| 99 | resample(const ScantableWrapper& in,
|
---|
| 100 | const std::string& method, float width)
|
---|
| 101 | { return ScantableWrapper(STMath::resample(in.getCP(), method, width)); }
|
---|
[262] | 102 |
|
---|
[872] | 103 | ScantableWrapper
|
---|
| 104 | smooth(const ScantableWrapper& in, const std::string& kernel, float width)
|
---|
| 105 | { return ScantableWrapper(STMath::smooth(in.getCP(), kernel, width)); }
|
---|
[457] | 106 |
|
---|
[872] | 107 | ScantableWrapper
|
---|
| 108 | gainElevation(const ScantableWrapper& in,
|
---|
| 109 | const std::vector<float>& coeff,
|
---|
| 110 | const std::string& filename,
|
---|
[996] | 111 | const std::string& method)
|
---|
[503] | 112 |
|
---|
[872] | 113 | { return
|
---|
| 114 | ScantableWrapper(STMath::gainElevation(in.getCP(), coeff, filename, method)); }
|
---|
[235] | 115 |
|
---|
[872] | 116 | ScantableWrapper
|
---|
| 117 | convertFlux(const ScantableWrapper& in, float d,
|
---|
| 118 | float etaap, float jyperk)
|
---|
| 119 | { return ScantableWrapper(STMath::convertFlux(in.getCP(), d, etaap, jyperk)); }
|
---|
[49] | 120 |
|
---|
[872] | 121 | ScantableWrapper opacity(const ScantableWrapper& in,
|
---|
| 122 | float tau)
|
---|
| 123 | { return ScantableWrapper(STMath::opacity(in.getCP(), tau)); }
|
---|
[49] | 124 |
|
---|
[872] | 125 | ScantableWrapper
|
---|
| 126 | merge(const std::vector<ScantableWrapper >& in)
|
---|
[716] | 127 |
|
---|
[872] | 128 | {
|
---|
| 129 | std::vector<casa::CountedPtr<Scantable> > sts;
|
---|
[996] | 130 | for (unsigned int i=0; i<in.size(); ++i) sts.push_back(in[i].getCP());
|
---|
[872] | 131 | return ScantableWrapper(STMath::merge(sts)); }
|
---|
[716] | 132 |
|
---|
[912] | 133 | ScantableWrapper rotateXYPhase( const ScantableWrapper& in, float angle)
|
---|
| 134 | { return ScantableWrapper(STMath::rotateXYPhase(in.getCP(), angle)); }
|
---|
| 135 |
|
---|
| 136 | ScantableWrapper rotateLinPolPhase( const ScantableWrapper& in, float angle)
|
---|
| 137 | { return ScantableWrapper(STMath::rotateLinPolPhase(in.getCP(), angle)); }
|
---|
| 138 |
|
---|
| 139 | ScantableWrapper invertPhase( const ScantableWrapper& in )
|
---|
| 140 | { return ScantableWrapper(STMath::invertPhase(in.getCP())); }
|
---|
| 141 |
|
---|
| 142 | ScantableWrapper swapPolarisations( const ScantableWrapper& in )
|
---|
| 143 | { return ScantableWrapper(STMath::swapPolarisations(in.getCP())); }
|
---|
| 144 |
|
---|
[927] | 145 | ScantableWrapper frequencyAlign( const ScantableWrapper& in,
|
---|
| 146 | const std::string& refTime,
|
---|
| 147 | const std::string& method )
|
---|
| 148 | { return ScantableWrapper(STMath::frequencyAlign(in.getCP())); }
|
---|
| 149 |
|
---|
[992] | 150 | ScantableWrapper convertPolarisation( const ScantableWrapper& in,
|
---|
| 151 | const std::string& newtype )
|
---|
| 152 | { return ScantableWrapper(STMath::convertPolarisation(in.getCP(),newtype)); }
|
---|
[1145] | 153 |
|
---|
[1140] | 154 | ScantableWrapper mxExtract( const ScantableWrapper& in,
|
---|
| 155 | const std::string& scantype="on" )
|
---|
| 156 | { return ScantableWrapper(STMath::mxExtract(in.getCP(),scantype)); }
|
---|
[992] | 157 |
|
---|
[1192] | 158 | ScantableWrapper lagFlag( const ScantableWrapper& in,
|
---|
[1200] | 159 | double frequency, double width )
|
---|
[1192] | 160 | { return ScantableWrapper(STMath::lagFlag(in.getCP(), frequency, width)); }
|
---|
| 161 |
|
---|
[49] | 162 | };
|
---|
| 163 |
|
---|
[872] | 164 | }
|
---|
| 165 |
|
---|
[49] | 166 | #endif
|
---|