source: trunk/src/STMath.h@ 963

Last change on this file since 963 was 940, checked in by mar637, 19 years ago

added averagePolarisations; added log output to frequencyAlign; removed couts; made frequencyAlign non insitu

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 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 ~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 bool alignfreq = false );
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> quotient( const casa::CountedPtr<Scantable>& in,
71 const std::string& mode = "NEAREST",
72 bool preserve = true );
73
74 casa::CountedPtr<Scantable>
75 freqSwitch( const casa::CountedPtr<Scantable>& in );
76
77 std::vector<float> statistic(const casa::CountedPtr<Scantable>& in,
78 const std::vector<bool>& mask,
79 const std::string& which);
80
81 casa::CountedPtr<Scantable> bin( const casa::CountedPtr<Scantable>& in,
82 int width=5);
83 casa::CountedPtr<Scantable>
84 resample(const casa::CountedPtr<Scantable>& in,
85 const std::string& method, float width);
86
87 casa::CountedPtr<Scantable>
88 smooth(const casa::CountedPtr<Scantable>& in, const std::string& kernel,
89 float width);
90
91 casa::CountedPtr<Scantable>
92 gainElevation(const casa::CountedPtr<Scantable>& in,
93 const std::vector<float>& coeff,
94 const std::string& fileName,
95 const std::string& method);
96 casa::CountedPtr<Scantable>
97 convertFlux(const casa::CountedPtr<Scantable>& in, float d,
98 float etaap, float jyperk);
99
100 casa::CountedPtr<Scantable> opacity(const casa::CountedPtr<Scantable>& in,
101 float tau);
102
103 casa::CountedPtr<Scantable>
104 merge(const std::vector<casa::CountedPtr<Scantable> >& in);
105
106 casa::CountedPtr<Scantable>
107 invertPhase( const casa::CountedPtr<Scantable>& in);
108
109 casa::CountedPtr<Scantable>
110 rotateXYPhase( const casa::CountedPtr<Scantable>& in, float phase);
111
112 casa::CountedPtr<Scantable>
113 rotateLinPolPhase( const casa::CountedPtr<Scantable>& in, float phase);
114
115 /// @todo frequency alignment
116
117 casa::CountedPtr<Scantable>
118 swapPolarisations(const casa::CountedPtr<Scantable>& in);
119
120 casa::CountedPtr<Scantable>
121 frequencyAlign( const casa::CountedPtr<Scantable>& in,
122 const std::string& refTime = "",
123 const std::string& method = "cubic" );
124
125private:
126 casa::CountedPtr<Scantable> applyToPol( const casa::CountedPtr<Scantable>& in,
127 STPol::polOperation fptr,
128 casa::Float phase);
129
130 static imethod stringToIMethod(const std::string& in);
131 static WeightType stringToWeight(const std::string& in);
132
133 void scaleByVector(casa::Table& in,
134 const casa::Vector<casa::Float>& factor,
135 bool dotsys);
136
137 void scaleFromAsciiTable(casa::Table& in, const std::string& filename,
138 const std::string& method,
139 const casa::Vector<casa::Float>& xout,
140 bool dotsys);
141
142 void scaleFromTable(casa::Table& in, const casa::Table& table,
143 const std::string& method,
144 const casa::Vector<casa::Float>& xout, bool dotsys);
145
146 void convertBrightnessUnits(casa::CountedPtr<Scantable>& in,
147 bool tokelvin, float cfac);
148
149 casa::CountedPtr< Scantable >
150 getScantable(const casa::CountedPtr< Scantable >& in, bool droprows);
151
152 casa::MaskedArray<casa::Float>
153 maskedArray( const casa::Vector<casa::Float>& s,
154 const casa::Vector<casa::uChar>& f );
155 casa::Vector<casa::uChar>
156 flagsFromMA(const casa::MaskedArray<casa::Float>& ma);
157
158 bool insitu_;
159};
160
161}
162#endif
Note: See TracBrowser for help on using the repository browser.