source: trunk/src/STMath.h@ 1074

Last change on this file since 1074 was 1069, checked in by mar637, 18 years ago

enhancement ticket #35. median scantable

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.6 KB
Line 
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
29namespace asap {
30
31/**
32Mathmatical operations on Scantable objects
33
34@author Malte Marquarding
35*/
36class STMath : private Logger {
37public:
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 averageChannel( const casa::CountedPtr<Scantable> & in,
63 const std::string& mode = "MEDIAN");
64
65 casa::CountedPtr< Scantable >
66 averagePolarisations( const casa::CountedPtr< Scantable > & in,
67 const std::vector<bool>& mask,
68 const std::string& weight );
69
70 casa::CountedPtr<Scantable>
71 unaryOperate( const casa::CountedPtr<Scantable>& in, float val,
72 const std::string& mode, bool tsys=false );
73
74 casa::CountedPtr<Scantable> autoQuotient(const casa::CountedPtr<Scantable>& in,
75 const std::string& mode = "NEAREST",
76 bool preserve = true);
77
78 casa::CountedPtr<Scantable> quotient( const casa::CountedPtr<Scantable>& on,
79 const casa::CountedPtr<Scantable>& off,
80 bool preserve = true );
81
82 casa::CountedPtr<Scantable>
83 freqSwitch( const casa::CountedPtr<Scantable>& in );
84
85 std::vector<float> statistic(const casa::CountedPtr<Scantable>& in,
86 const std::vector<bool>& mask,
87 const std::string& which);
88
89 casa::CountedPtr<Scantable> bin( const casa::CountedPtr<Scantable>& in,
90 int width=5);
91 casa::CountedPtr<Scantable>
92 resample(const casa::CountedPtr<Scantable>& in,
93 const std::string& method, float width);
94
95 casa::CountedPtr<Scantable>
96 smooth(const casa::CountedPtr<Scantable>& in, const std::string& kernel,
97 float width);
98
99 casa::CountedPtr<Scantable>
100 gainElevation(const casa::CountedPtr<Scantable>& in,
101 const std::vector<float>& coeff,
102 const std::string& fileName,
103 const std::string& method);
104 casa::CountedPtr<Scantable>
105 convertFlux(const casa::CountedPtr<Scantable>& in, float d,
106 float etaap, float jyperk);
107
108 casa::CountedPtr<Scantable> opacity(const casa::CountedPtr<Scantable>& in,
109 float tau);
110
111 casa::CountedPtr<Scantable>
112 merge(const std::vector<casa::CountedPtr<Scantable> >& in);
113
114 casa::CountedPtr<Scantable>
115 invertPhase( const casa::CountedPtr<Scantable>& in);
116
117 casa::CountedPtr<Scantable>
118 rotateXYPhase( const casa::CountedPtr<Scantable>& in, float phase);
119
120 casa::CountedPtr<Scantable>
121 rotateLinPolPhase( const casa::CountedPtr<Scantable>& in, float phase);
122
123 /// @todo frequency alignment
124
125 casa::CountedPtr<Scantable>
126 swapPolarisations(const casa::CountedPtr<Scantable>& in);
127
128 casa::CountedPtr<Scantable>
129 frequencyAlign( const casa::CountedPtr<Scantable>& in,
130 const std::string& refTime = "",
131 const std::string& method = "cubic" );
132
133 casa::CountedPtr<Scantable>
134 convertPolarisation( const casa::CountedPtr<Scantable>& in,
135 const std::string& newtype);
136
137private:
138 casa::CountedPtr<Scantable> applyToPol( const casa::CountedPtr<Scantable>& in,
139 STPol::polOperation fptr,
140 casa::Float phase);
141
142 static imethod stringToIMethod(const std::string& in);
143 static WeightType stringToWeight(const std::string& in);
144
145 void scaleByVector(casa::Table& in,
146 const casa::Vector<casa::Float>& factor,
147 bool dotsys);
148
149 void scaleFromAsciiTable(casa::Table& in, const std::string& filename,
150 const std::string& method,
151 const casa::Vector<casa::Float>& xout,
152 bool dotsys);
153
154 void scaleFromTable(casa::Table& in, const casa::Table& table,
155 const std::string& method,
156 const casa::Vector<casa::Float>& xout, bool dotsys);
157
158 void convertBrightnessUnits(casa::CountedPtr<Scantable>& in,
159 bool tokelvin, float cfac);
160
161 casa::CountedPtr< Scantable >
162 getScantable(const casa::CountedPtr< Scantable >& in, bool droprows);
163
164 casa::MaskedArray<casa::Float>
165 maskedArray( const casa::Vector<casa::Float>& s,
166 const casa::Vector<casa::uChar>& f );
167 casa::Vector<casa::uChar>
168 flagsFromMA(const casa::MaskedArray<casa::Float>& ma);
169
170 bool insitu_;
171};
172
173}
174#endif
Note: See TracBrowser for help on using the repository browser.