1 | //
|
---|
2 | // C++ Interface: STMath
|
---|
3 | //
|
---|
4 | // Description:
|
---|
5 | //
|
---|
6 | //
|
---|
7 | // Author: Malte Marquarding <asap@atnf.csiro.au>, (C) 2006
|
---|
8 | //
|
---|
9 | // Copyright: See COPYING file that comes with this distribution
|
---|
10 | //
|
---|
11 | //
|
---|
12 | #ifndef ASAPSTMATH_H
|
---|
13 | #define ASAPSTMATH_H
|
---|
14 |
|
---|
15 | #include <string>
|
---|
16 | #include <map>
|
---|
17 |
|
---|
18 | #include <casa/aips.h>
|
---|
19 | #include <casa/Utilities/CountedPtr.h>
|
---|
20 | #include <casa/BasicSL/String.h>
|
---|
21 | #include <casa/Arrays/Vector.h>
|
---|
22 | #include <scimath/Mathematics/InterpolateArray1D.h>
|
---|
23 |
|
---|
24 | #include "Scantable.h"
|
---|
25 | #include "STDefs.h"
|
---|
26 | #include "STPol.h"
|
---|
27 | #include "Logger.h"
|
---|
28 |
|
---|
29 | namespace asap {
|
---|
30 |
|
---|
31 | /**
|
---|
32 | Mathmatical operations on Scantable objects
|
---|
33 |
|
---|
34 | @author Malte Marquarding
|
---|
35 | */
|
---|
36 | class STMath : private Logger {
|
---|
37 | public:
|
---|
38 |
|
---|
39 | typedef casa::InterpolateArray1D<casa::Double,
|
---|
40 | casa::Float>::InterpolationMethod imethod;
|
---|
41 |
|
---|
42 | typedef std::map<std::string, imethod> imap;
|
---|
43 |
|
---|
44 | STMath(bool insitu=true);
|
---|
45 |
|
---|
46 | virtual ~STMath();
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * set the @attr insitu attribute
|
---|
50 | * @param b
|
---|
51 | */
|
---|
52 | bool insitu() const { return insitu_;};
|
---|
53 | void setInsitu(bool b) { insitu_ = b; };
|
---|
54 |
|
---|
55 | casa::CountedPtr<Scantable>
|
---|
56 | average( const std::vector<casa::CountedPtr<Scantable> >& in,
|
---|
57 | const std::vector<bool>& mask = std::vector<bool>(),
|
---|
58 | const std::string& weight = "NONE",
|
---|
59 | const std::string& avmode = "SCAN");
|
---|
60 |
|
---|
61 | casa::CountedPtr< Scantable >
|
---|
62 | averagePolarisations( const casa::CountedPtr< Scantable > & in,
|
---|
63 | const std::vector<bool>& mask,
|
---|
64 | const std::string& weight );
|
---|
65 |
|
---|
66 | casa::CountedPtr<Scantable>
|
---|
67 | unaryOperate( const casa::CountedPtr<Scantable>& in, float val,
|
---|
68 | const std::string& mode, bool tsys=false );
|
---|
69 |
|
---|
70 | casa::CountedPtr<Scantable> autoQuotient(const casa::CountedPtr<Scantable>& in,
|
---|
71 | const std::string& mode = "NEAREST",
|
---|
72 | bool preserve = true);
|
---|
73 |
|
---|
74 | casa::CountedPtr<Scantable> quotient( const casa::CountedPtr<Scantable>& on,
|
---|
75 | const casa::CountedPtr<Scantable>& off,
|
---|
76 | bool preserve = true );
|
---|
77 |
|
---|
78 | casa::CountedPtr<Scantable>
|
---|
79 | freqSwitch( const casa::CountedPtr<Scantable>& in );
|
---|
80 |
|
---|
81 | std::vector<float> statistic(const casa::CountedPtr<Scantable>& in,
|
---|
82 | const std::vector<bool>& mask,
|
---|
83 | const std::string& which);
|
---|
84 |
|
---|
85 | casa::CountedPtr<Scantable> bin( const casa::CountedPtr<Scantable>& in,
|
---|
86 | int width=5);
|
---|
87 | casa::CountedPtr<Scantable>
|
---|
88 | resample(const casa::CountedPtr<Scantable>& in,
|
---|
89 | const std::string& method, float width);
|
---|
90 |
|
---|
91 | casa::CountedPtr<Scantable>
|
---|
92 | smooth(const casa::CountedPtr<Scantable>& in, const std::string& kernel,
|
---|
93 | float width);
|
---|
94 |
|
---|
95 | casa::CountedPtr<Scantable>
|
---|
96 | gainElevation(const casa::CountedPtr<Scantable>& in,
|
---|
97 | const std::vector<float>& coeff,
|
---|
98 | const std::string& fileName,
|
---|
99 | const std::string& method);
|
---|
100 | casa::CountedPtr<Scantable>
|
---|
101 | convertFlux(const casa::CountedPtr<Scantable>& in, float d,
|
---|
102 | float etaap, float jyperk);
|
---|
103 |
|
---|
104 | casa::CountedPtr<Scantable> opacity(const casa::CountedPtr<Scantable>& in,
|
---|
105 | float tau);
|
---|
106 |
|
---|
107 | casa::CountedPtr<Scantable>
|
---|
108 | merge(const std::vector<casa::CountedPtr<Scantable> >& in);
|
---|
109 |
|
---|
110 | casa::CountedPtr<Scantable>
|
---|
111 | invertPhase( const casa::CountedPtr<Scantable>& in);
|
---|
112 |
|
---|
113 | casa::CountedPtr<Scantable>
|
---|
114 | rotateXYPhase( const casa::CountedPtr<Scantable>& in, float phase);
|
---|
115 |
|
---|
116 | casa::CountedPtr<Scantable>
|
---|
117 | rotateLinPolPhase( const casa::CountedPtr<Scantable>& in, float phase);
|
---|
118 |
|
---|
119 | /// @todo frequency alignment
|
---|
120 |
|
---|
121 | casa::CountedPtr<Scantable>
|
---|
122 | swapPolarisations(const casa::CountedPtr<Scantable>& in);
|
---|
123 |
|
---|
124 | casa::CountedPtr<Scantable>
|
---|
125 | frequencyAlign( const casa::CountedPtr<Scantable>& in,
|
---|
126 | const std::string& refTime = "",
|
---|
127 | const std::string& method = "cubic" );
|
---|
128 |
|
---|
129 | casa::CountedPtr<Scantable>
|
---|
130 | convertPolarisation( const casa::CountedPtr<Scantable>& in,
|
---|
131 | const std::string& newtype);
|
---|
132 |
|
---|
133 | private:
|
---|
134 | casa::CountedPtr<Scantable> applyToPol( const casa::CountedPtr<Scantable>& in,
|
---|
135 | STPol::polOperation fptr,
|
---|
136 | casa::Float phase);
|
---|
137 |
|
---|
138 | static imethod stringToIMethod(const std::string& in);
|
---|
139 | static WeightType stringToWeight(const std::string& in);
|
---|
140 |
|
---|
141 | void scaleByVector(casa::Table& in,
|
---|
142 | const casa::Vector<casa::Float>& factor,
|
---|
143 | bool dotsys);
|
---|
144 |
|
---|
145 | void scaleFromAsciiTable(casa::Table& in, const std::string& filename,
|
---|
146 | const std::string& method,
|
---|
147 | const casa::Vector<casa::Float>& xout,
|
---|
148 | bool dotsys);
|
---|
149 |
|
---|
150 | void scaleFromTable(casa::Table& in, const casa::Table& table,
|
---|
151 | const std::string& method,
|
---|
152 | const casa::Vector<casa::Float>& xout, bool dotsys);
|
---|
153 |
|
---|
154 | void convertBrightnessUnits(casa::CountedPtr<Scantable>& in,
|
---|
155 | bool tokelvin, float cfac);
|
---|
156 |
|
---|
157 | casa::CountedPtr< Scantable >
|
---|
158 | getScantable(const casa::CountedPtr< Scantable >& in, bool droprows);
|
---|
159 |
|
---|
160 | casa::MaskedArray<casa::Float>
|
---|
161 | maskedArray( const casa::Vector<casa::Float>& s,
|
---|
162 | const casa::Vector<casa::uChar>& f );
|
---|
163 | casa::Vector<casa::uChar>
|
---|
164 | flagsFromMA(const casa::MaskedArray<casa::Float>& ma);
|
---|
165 |
|
---|
166 | bool insitu_;
|
---|
167 | };
|
---|
168 |
|
---|
169 | }
|
---|
170 | #endif
|
---|