source: trunk/src/STMath.h@ 913

Last change on this file since 913 was 912, checked in by mar637, 19 years ago

added polarimtery functions

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