source: trunk/src/STMath.h@ 893

Last change on this file since 893 was 890, checked in by mar637, 19 years ago

asap2 naming changes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.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 "SDLog.h"
27
28namespace asap {
29
30/**
31Mathmatical operations on Scantable objects
32
33@author Malte Marquarding
34*/
35class STMath : private Logger {
36public:
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 std::vector<bool>& mask = std::vector<bool>(),
57 const std::string& weight = "NONE",
58 const std::string& avmode = "SCAN",
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 std::vector<float>& coeff,
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 casa::CountedPtr<Scantable>
99 merge(const std::vector<casa::CountedPtr<Scantable> >& in);
100
101 /// @todo frequency alignment
102
103private:
104 static imethod stringToIMethod(const std::string& in);
105 static WeightType stringToWeight(const std::string& in);
106
107 void scaleByVector(casa::Table& in,
108 const casa::Vector<casa::Float>& factor,
109 bool dotsys);
110
111 void scaleFromAsciiTable(casa::Table& in, const std::string& filename,
112 const std::string& method,
113 const casa::Vector<casa::Float>& xout,
114 bool dotsys);
115
116 void scaleFromTable(casa::Table& in, const casa::Table& table,
117 const std::string& method,
118 const casa::Vector<casa::Float>& xout, bool dotsys);
119
120 void convertBrightnessUnits(casa::CountedPtr<Scantable>& in,
121 bool tokelvin, float cfac);
122
123 casa::CountedPtr< Scantable >
124 getScantable(const casa::CountedPtr< Scantable >& in, bool droprows);
125
126 casa::MaskedArray<casa::Float>
127 maskedArray( const casa::Vector<casa::Float>& s,
128 const casa::Vector<casa::uChar>& f );
129 casa::Vector<casa::uChar>
130 flagsFromMA(const casa::MaskedArray<casa::Float>& ma);
131
132 bool insitu_;
133};
134
135}
136#endif
Note: See TracBrowser for help on using the repository browser.