source: trunk/src/STMath.h@ 977

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

Removed align option from average as it is buggy. The user has to provide a vector of aligned scantables.

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