source: trunk/src/STMath.h@ 1089

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

added scan averaging to average_channel

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.6 KB
RevLine 
[805]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
[2]14
[38]15#include <string>
[805]16#include <map>
17
[130]18#include <casa/aips.h>
[81]19#include <casa/Utilities/CountedPtr.h>
[805]20#include <casa/BasicSL/String.h>
21#include <casa/Arrays/Vector.h>
22#include <scimath/Mathematics/InterpolateArray1D.h>
[294]23
[805]24#include "Scantable.h"
[834]25#include "STDefs.h"
[896]26#include "STPol.h"
[894]27#include "Logger.h"
[2]28
[83]29namespace asap {
[2]30
[805]31/**
32Mathmatical operations on Scantable objects
[2]33
[805]34@author Malte Marquarding
35*/
[890]36class STMath : private Logger {
[716]37public:
[171]38
[805]39 typedef casa::InterpolateArray1D<casa::Double,
40 casa::Float>::InterpolationMethod imethod;
[299]41
[805]42 typedef std::map<std::string, imethod> imap;
[177]43
[805]44 STMath(bool insitu=true);
[221]45
[995]46 virtual ~STMath();
[227]47
[805]48 /**
49 * set the @attr insitu attribute
50 * @param b
51 */
52 bool insitu() const { return insitu_;};
53 void setInsitu(bool b) { insitu_ = b; };
[262]54
[805]55 casa::CountedPtr<Scantable>
56 average( const std::vector<casa::CountedPtr<Scantable> >& in,
[858]57 const std::vector<bool>& mask = std::vector<bool>(),
58 const std::string& weight = "NONE",
[977]59 const std::string& avmode = "SCAN");
[1066]60
[1069]61 casa::CountedPtr<Scantable>
62 averageChannel( const casa::CountedPtr<Scantable> & in,
[1078]63 const std::string& mode = "MEDIAN",
64 const std::string& avmode = "SCAN");
[1069]65
[940]66 casa::CountedPtr< Scantable >
67 averagePolarisations( const casa::CountedPtr< Scantable > & in,
68 const std::vector<bool>& mask,
69 const std::string& weight );
[234]70
[805]71 casa::CountedPtr<Scantable>
72 unaryOperate( const casa::CountedPtr<Scantable>& in, float val,
73 const std::string& mode, bool tsys=false );
[169]74
[1066]75 casa::CountedPtr<Scantable> autoQuotient(const casa::CountedPtr<Scantable>& in,
76 const std::string& mode = "NEAREST",
77 bool preserve = true);
78
79 casa::CountedPtr<Scantable> quotient( const casa::CountedPtr<Scantable>& on,
80 const casa::CountedPtr<Scantable>& off,
[805]81 bool preserve = true );
[169]82
[805]83 casa::CountedPtr<Scantable>
84 freqSwitch( const casa::CountedPtr<Scantable>& in );
[716]85
[805]86 std::vector<float> statistic(const casa::CountedPtr<Scantable>& in,
87 const std::vector<bool>& mask,
88 const std::string& which);
[457]89
[805]90 casa::CountedPtr<Scantable> bin( const casa::CountedPtr<Scantable>& in,
91 int width=5);
92 casa::CountedPtr<Scantable>
93 resample(const casa::CountedPtr<Scantable>& in,
94 const std::string& method, float width);
[457]95
[805]96 casa::CountedPtr<Scantable>
97 smooth(const casa::CountedPtr<Scantable>& in, const std::string& kernel,
[995]98 float width);
[169]99
[805]100 casa::CountedPtr<Scantable>
101 gainElevation(const casa::CountedPtr<Scantable>& in,
[867]102 const std::vector<float>& coeff,
[805]103 const std::string& fileName,
[995]104 const std::string& method);
[805]105 casa::CountedPtr<Scantable>
106 convertFlux(const casa::CountedPtr<Scantable>& in, float d,
107 float etaap, float jyperk);
[152]108
[805]109 casa::CountedPtr<Scantable> opacity(const casa::CountedPtr<Scantable>& in,
110 float tau);
[144]111
[841]112 casa::CountedPtr<Scantable>
113 merge(const std::vector<casa::CountedPtr<Scantable> >& in);
114
[896]115 casa::CountedPtr<Scantable>
116 invertPhase( const casa::CountedPtr<Scantable>& in);
[912]117
[896]118 casa::CountedPtr<Scantable>
119 rotateXYPhase( const casa::CountedPtr<Scantable>& in, float phase);
[912]120
[896]121 casa::CountedPtr<Scantable>
122 rotateLinPolPhase( const casa::CountedPtr<Scantable>& in, float phase);
123
[805]124 /// @todo frequency alignment
[152]125
[896]126 casa::CountedPtr<Scantable>
127 swapPolarisations(const casa::CountedPtr<Scantable>& in);
128
[917]129 casa::CountedPtr<Scantable>
130 frequencyAlign( const casa::CountedPtr<Scantable>& in,
[927]131 const std::string& refTime = "",
132 const std::string& method = "cubic" );
[917]133
[992]134 casa::CountedPtr<Scantable>
135 convertPolarisation( const casa::CountedPtr<Scantable>& in,
136 const std::string& newtype);
137
[805]138private:
[896]139 casa::CountedPtr<Scantable> applyToPol( const casa::CountedPtr<Scantable>& in,
140 STPol::polOperation fptr,
141 casa::Float phase);
142
[805]143 static imethod stringToIMethod(const std::string& in);
144 static WeightType stringToWeight(const std::string& in);
[146]145
[805]146 void scaleByVector(casa::Table& in,
147 const casa::Vector<casa::Float>& factor,
148 bool dotsys);
[152]149
[805]150 void scaleFromAsciiTable(casa::Table& in, const std::string& filename,
151 const std::string& method,
152 const casa::Vector<casa::Float>& xout,
153 bool dotsys);
[162]154
[805]155 void scaleFromTable(casa::Table& in, const casa::Table& table,
156 const std::string& method,
157 const casa::Vector<casa::Float>& xout, bool dotsys);
[227]158
[805]159 void convertBrightnessUnits(casa::CountedPtr<Scantable>& in,
160 bool tokelvin, float cfac);
[227]161
[805]162 casa::CountedPtr< Scantable >
163 getScantable(const casa::CountedPtr< Scantable >& in, bool droprows);
[230]164
[805]165 casa::MaskedArray<casa::Float>
166 maskedArray( const casa::Vector<casa::Float>& s,
167 const casa::Vector<casa::uChar>& f );
168 casa::Vector<casa::uChar>
169 flagsFromMA(const casa::MaskedArray<casa::Float>& ma);
[230]170
[805]171 bool insitu_;
172};
[234]173
[805]174}
[165]175#endif
Note: See TracBrowser for help on using the repository browser.