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 "SDDefs.h" |
---|
26 | #include "SDLog.h" |
---|
27 | |
---|
28 | namespace asap { |
---|
29 | |
---|
30 | /** |
---|
31 | Mathmatical operations on Scantable objects |
---|
32 | |
---|
33 | @author Malte Marquarding |
---|
34 | */ |
---|
35 | class STMath : private SDLog { |
---|
36 | public: |
---|
37 | |
---|
38 | typedef casa::InterpolateArray1D<casa::Double, |
---|
39 | casa::Float>::InterpolationMethod imethod; |
---|
40 | |
---|
41 | typedef std::map<std::string, imethod> imap; |
---|
42 | |
---|
43 | STMath(bool insitu=true); |
---|
44 | |
---|
45 | ~STMath(); |
---|
46 | |
---|
47 | /** |
---|
48 | * set the @attr insitu attribute |
---|
49 | * @param b |
---|
50 | */ |
---|
51 | bool insitu() const { return insitu_;}; |
---|
52 | void setInsitu(bool b) { insitu_ = b; }; |
---|
53 | |
---|
54 | casa::CountedPtr<Scantable> |
---|
55 | average( const std::vector<casa::CountedPtr<Scantable> >& in, |
---|
56 | const casa::Vector<casa::Bool>& mask, |
---|
57 | const std::string& weight, |
---|
58 | const std::string& avmode = "", |
---|
59 | bool alignfreq = false ); |
---|
60 | |
---|
61 | casa::CountedPtr<Scantable> |
---|
62 | unaryOperate( const casa::CountedPtr<Scantable>& in, float val, |
---|
63 | const std::string& mode, bool tsys=false ); |
---|
64 | |
---|
65 | casa::CountedPtr<Scantable> quotient( const casa::CountedPtr<Scantable>& in, |
---|
66 | const std::string& mode = "NEAREST", |
---|
67 | bool preserve = true ); |
---|
68 | |
---|
69 | casa::CountedPtr<Scantable> |
---|
70 | freqSwitch( const casa::CountedPtr<Scantable>& in ); |
---|
71 | |
---|
72 | std::vector<float> statistic(const casa::CountedPtr<Scantable>& in, |
---|
73 | const std::vector<bool>& mask, |
---|
74 | const std::string& which); |
---|
75 | |
---|
76 | casa::CountedPtr<Scantable> bin( const casa::CountedPtr<Scantable>& in, |
---|
77 | int width=5); |
---|
78 | casa::CountedPtr<Scantable> |
---|
79 | resample(const casa::CountedPtr<Scantable>& in, |
---|
80 | const std::string& method, float width); |
---|
81 | |
---|
82 | casa::CountedPtr<Scantable> |
---|
83 | smooth(const casa::CountedPtr<Scantable>& in, const std::string& kernel, |
---|
84 | float width); |
---|
85 | |
---|
86 | casa::CountedPtr<Scantable> |
---|
87 | gainElevation(const casa::CountedPtr<Scantable>& in, |
---|
88 | const casa::Vector<casa::Float>& coeffs, |
---|
89 | const std::string& fileName, |
---|
90 | const std::string& method); |
---|
91 | casa::CountedPtr<Scantable> |
---|
92 | convertFlux(const casa::CountedPtr<Scantable>& in, float d, |
---|
93 | float etaap, float jyperk); |
---|
94 | |
---|
95 | casa::CountedPtr<Scantable> opacity(const casa::CountedPtr<Scantable>& in, |
---|
96 | float tau); |
---|
97 | |
---|
98 | /// @todo frequency alignment |
---|
99 | |
---|
100 | private: |
---|
101 | static imethod stringToIMethod(const std::string& in); |
---|
102 | static WeightType stringToWeight(const std::string& in); |
---|
103 | |
---|
104 | void scaleByVector(casa::Table& in, |
---|
105 | const casa::Vector<casa::Float>& factor, |
---|
106 | bool dotsys); |
---|
107 | |
---|
108 | void scaleFromAsciiTable(casa::Table& in, const std::string& filename, |
---|
109 | const std::string& method, |
---|
110 | const casa::Vector<casa::Float>& xout, |
---|
111 | bool dotsys); |
---|
112 | |
---|
113 | void scaleFromTable(casa::Table& in, const casa::Table& table, |
---|
114 | const std::string& method, |
---|
115 | const casa::Vector<casa::Float>& xout, bool dotsys); |
---|
116 | |
---|
117 | void convertBrightnessUnits(casa::CountedPtr<Scantable>& in, |
---|
118 | bool tokelvin, float cfac); |
---|
119 | |
---|
120 | casa::CountedPtr< Scantable > |
---|
121 | getScantable(const casa::CountedPtr< Scantable >& in, bool droprows); |
---|
122 | |
---|
123 | casa::MaskedArray<casa::Float> |
---|
124 | maskedArray( const casa::Vector<casa::Float>& s, |
---|
125 | const casa::Vector<casa::uChar>& f ); |
---|
126 | casa::Vector<casa::uChar> |
---|
127 | flagsFromMA(const casa::MaskedArray<casa::Float>& ma); |
---|
128 | |
---|
129 | bool insitu_; |
---|
130 | }; |
---|
131 | |
---|
132 | } |
---|
133 | #endif |
---|