source: trunk/src/STMath.h@ 948

Last change on this file since 948 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
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
[805]46 ~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",
59 const std::string& avmode = "SCAN",
[805]60 bool alignfreq = false );
[940]61 casa::CountedPtr< Scantable >
62 averagePolarisations( const casa::CountedPtr< Scantable > & in,
63 const std::vector<bool>& mask,
64 const std::string& weight );
[234]65
[805]66 casa::CountedPtr<Scantable>
67 unaryOperate( const casa::CountedPtr<Scantable>& in, float val,
68 const std::string& mode, bool tsys=false );
[169]69
[805]70 casa::CountedPtr<Scantable> quotient( const casa::CountedPtr<Scantable>& in,
71 const std::string& mode = "NEAREST",
72 bool preserve = true );
[169]73
[805]74 casa::CountedPtr<Scantable>
75 freqSwitch( const casa::CountedPtr<Scantable>& in );
[716]76
[805]77 std::vector<float> statistic(const casa::CountedPtr<Scantable>& in,
78 const std::vector<bool>& mask,
79 const std::string& which);
[457]80
[805]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);
[457]86
[805]87 casa::CountedPtr<Scantable>
88 smooth(const casa::CountedPtr<Scantable>& in, const std::string& kernel,
89 float width);
[169]90
[805]91 casa::CountedPtr<Scantable>
92 gainElevation(const casa::CountedPtr<Scantable>& in,
[867]93 const std::vector<float>& coeff,
[805]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);
[152]99
[805]100 casa::CountedPtr<Scantable> opacity(const casa::CountedPtr<Scantable>& in,
101 float tau);
[144]102
[841]103 casa::CountedPtr<Scantable>
104 merge(const std::vector<casa::CountedPtr<Scantable> >& in);
105
[896]106 casa::CountedPtr<Scantable>
107 invertPhase( const casa::CountedPtr<Scantable>& in);
[912]108
[896]109 casa::CountedPtr<Scantable>
110 rotateXYPhase( const casa::CountedPtr<Scantable>& in, float phase);
[912]111
[896]112 casa::CountedPtr<Scantable>
113 rotateLinPolPhase( const casa::CountedPtr<Scantable>& in, float phase);
114
[805]115 /// @todo frequency alignment
[152]116
[896]117 casa::CountedPtr<Scantable>
118 swapPolarisations(const casa::CountedPtr<Scantable>& in);
119
[917]120 casa::CountedPtr<Scantable>
121 frequencyAlign( const casa::CountedPtr<Scantable>& in,
[927]122 const std::string& refTime = "",
123 const std::string& method = "cubic" );
[917]124
[805]125private:
[896]126 casa::CountedPtr<Scantable> applyToPol( const casa::CountedPtr<Scantable>& in,
127 STPol::polOperation fptr,
128 casa::Float phase);
129
[805]130 static imethod stringToIMethod(const std::string& in);
131 static WeightType stringToWeight(const std::string& in);
[146]132
[805]133 void scaleByVector(casa::Table& in,
134 const casa::Vector<casa::Float>& factor,
135 bool dotsys);
[152]136
[805]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);
[162]141
[805]142 void scaleFromTable(casa::Table& in, const casa::Table& table,
143 const std::string& method,
144 const casa::Vector<casa::Float>& xout, bool dotsys);
[227]145
[805]146 void convertBrightnessUnits(casa::CountedPtr<Scantable>& in,
147 bool tokelvin, float cfac);
[227]148
[805]149 casa::CountedPtr< Scantable >
150 getScantable(const casa::CountedPtr< Scantable >& in, bool droprows);
[230]151
[805]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);
[230]157
[805]158 bool insitu_;
159};
[234]160
[805]161}
[165]162#endif
Note: See TracBrowser for help on using the repository browser.