source: tags/Release2.1.1b/src/STMath.h @ 1287

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

doxygen tag fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.7 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/**
[1106]32        * Mathmatical operations on Scantable objects
33        * @author Malte Marquarding
[805]34*/
[890]35class STMath : private Logger {
[716]36public:
[1106]37        // typedef for long method name
[805]38  typedef casa::InterpolateArray1D<casa::Double,
39                                   casa::Float>::InterpolationMethod imethod;
[299]40
[1106]41  // typedef for std::map
[805]42  typedef std::map<std::string, imethod> imap;
[177]43
[1106]44/**
45  * whether to operate on the given Scantable or return a new one
46  * @param insitu the toggle for this behaviour
47  */
[805]48  STMath(bool insitu=true);
[221]49
[995]50  virtual ~STMath();
[227]51
[805]52  /**
[1287]53   * get the currnt @attr inistu_ state
[805]54   */
55  bool insitu() const { return insitu_;};
[1143]56
[1106]57  /**
58   * set the currnt @attr inistu state
59   * @param b the new state
60   */
[805]61  void setInsitu(bool b) { insitu_ = b; };
[262]62
[1106]63
[1140]64  /**
65    * average a vector of Scantables
66    * @param in the vector of Scantables to average
[1287]67    * @param mask an optional mask to apply on specific weights
[1140]68    * @param weight weighting scheme
69    * @param avmode the mode ov averaging. Per "SCAN" or "ALL".
70    * @return a casa::CountedPtr<Scantable> which either holds a new Scantable
71    * or returns the imput pointer.
72    */
[805]73  casa::CountedPtr<Scantable>
74    average( const std::vector<casa::CountedPtr<Scantable> >& in,
[858]75             const std::vector<bool>& mask = std::vector<bool>(),
76             const std::string& weight = "NONE",
[977]77             const std::string& avmode = "SCAN");
[1066]78
[1140]79  /**
80    * median average a vector of Scantables. See also STMath::average
81    * @param in the Scantable to average
82    * @param mode the averaging mode. Currently only "MEDIAN"
83    * @param avmode the mode ov averaging. Per "SCAN" or "ALL".
84    * @return a casa::CountedPtr<Scantable> which either holds a new Scantable
85    * or returns the imput pointer.
86    */
[1069]87  casa::CountedPtr<Scantable>
88    averageChannel( const casa::CountedPtr<Scantable> & in,
[1078]89                    const std::string& mode = "MEDIAN",
90                    const std::string& avmode = "SCAN");
[1069]91
[1140]92  /**
[1145]93    * Average polarisations together. really only useful if only linears are
94    * available.
[1140]95    * @param in the input Scantable
96    * @param mask an optional mask if weight allows one
97    * @param weight weighting scheme
[1143]98    * @return
[1140]99    */
[940]100  casa::CountedPtr< Scantable >
101    averagePolarisations( const casa::CountedPtr< Scantable > & in,
[1140]102                          const std::vector<bool>& mask,
103                          const std::string& weight );
[234]104
[1145]105  /**
106    * Average beams together.
107    * @param in the input Scantable
108    * @param mask an optional mask if weight allows one
109    * @param weight weighting scheme
110    * @return
111    */
112  casa::CountedPtr< Scantable >
113    averageBeams( const casa::CountedPtr< Scantable > & in,
114                   const std::vector<bool>& mask,
115                   const std::string& weight );
116
[805]117  casa::CountedPtr<Scantable>
118    unaryOperate( const casa::CountedPtr<Scantable>& in, float val,
119                  const std::string& mode, bool tsys=false );
[169]120
[1066]121  casa::CountedPtr<Scantable> autoQuotient(const casa::CountedPtr<Scantable>& in,
122                                           const std::string& mode = "NEAREST",
123                                           bool preserve = true);
124
125  casa::CountedPtr<Scantable> quotient( const casa::CountedPtr<Scantable>& on,
126                                        const casa::CountedPtr<Scantable>& off,
[805]127                                        bool preserve = true );
[169]128
[805]129  casa::CountedPtr<Scantable>
130    freqSwitch( const casa::CountedPtr<Scantable>& in );
[716]131
[805]132  std::vector<float> statistic(const casa::CountedPtr<Scantable>& in,
133                               const std::vector<bool>& mask,
134                               const std::string& which);
[457]135
[805]136  casa::CountedPtr<Scantable> bin( const casa::CountedPtr<Scantable>& in,
137                                   int width=5);
138  casa::CountedPtr<Scantable>
139    resample(const casa::CountedPtr<Scantable>& in,
140             const std::string& method, float width);
[457]141
[805]142  casa::CountedPtr<Scantable>
143    smooth(const casa::CountedPtr<Scantable>& in, const std::string& kernel,
[995]144                      float width);
[169]145
[805]146  casa::CountedPtr<Scantable>
147    gainElevation(const casa::CountedPtr<Scantable>& in,
[867]148                  const std::vector<float>& coeff,
[805]149                  const std::string& fileName,
[995]150                  const std::string& method);
[805]151  casa::CountedPtr<Scantable>
152    convertFlux(const casa::CountedPtr<Scantable>& in, float d,
153                float etaap, float jyperk);
[152]154
[805]155  casa::CountedPtr<Scantable> opacity(const casa::CountedPtr<Scantable>& in,
156                                      float tau);
[144]157
[841]158  casa::CountedPtr<Scantable>
159    merge(const std::vector<casa::CountedPtr<Scantable> >& in);
160
[896]161  casa::CountedPtr<Scantable>
162    invertPhase( const casa::CountedPtr<Scantable>& in);
[912]163
[896]164  casa::CountedPtr<Scantable>
165    rotateXYPhase( const casa::CountedPtr<Scantable>& in, float phase);
[912]166
[896]167  casa::CountedPtr<Scantable>
168    rotateLinPolPhase( const casa::CountedPtr<Scantable>& in, float phase);
169
170  casa::CountedPtr<Scantable>
171    swapPolarisations(const casa::CountedPtr<Scantable>& in);
172
[917]173  casa::CountedPtr<Scantable>
174    frequencyAlign( const casa::CountedPtr<Scantable>& in,
[927]175                    const std::string& refTime = "",
176                    const std::string& method = "cubic" );
[917]177
[992]178  casa::CountedPtr<Scantable>
179    convertPolarisation( const casa::CountedPtr<Scantable>& in,
180                         const std::string& newtype);
[1143]181
[1140]182  casa::CountedPtr<Scantable>
[1143]183    mxExtract( const casa::CountedPtr<Scantable>& in,
184               const std::string& srctype = "on");
[992]185
[1192]186  /**
187   * "hard" flag the data, this flags everything selected in setSelection()
188   * @param frequency the frequency to remove
189   * @param width the number of lags to flag left to the side of the frequency
190   */
191  casa::CountedPtr<Scantable>
192    lagFlag( const casa::CountedPtr<Scantable>& in, double frequency,
[1200]193              double width);
[1192]194
[805]195private:
[896]196  casa::CountedPtr<Scantable>  applyToPol( const casa::CountedPtr<Scantable>& in,
197                                           STPol::polOperation fptr,
198                                           casa::Float phase);
199
[805]200  static imethod stringToIMethod(const std::string& in);
201  static WeightType stringToWeight(const std::string& in);
[146]202
[805]203  void scaleByVector(casa::Table& in,
204                     const casa::Vector<casa::Float>& factor,
205                     bool dotsys);
[152]206
[805]207  void scaleFromAsciiTable(casa::Table& in, const std::string& filename,
208                           const std::string& method,
209                           const casa::Vector<casa::Float>& xout,
210                           bool dotsys);
[162]211
[805]212  void scaleFromTable(casa::Table& in, const casa::Table& table,
213                      const std::string& method,
214                      const casa::Vector<casa::Float>& xout, bool dotsys);
[227]215
[805]216  void convertBrightnessUnits(casa::CountedPtr<Scantable>& in,
217                              bool tokelvin, float cfac);
[227]218
[805]219  casa::CountedPtr< Scantable >
220    getScantable(const casa::CountedPtr< Scantable >& in, bool droprows);
[230]221
[805]222  casa::MaskedArray<casa::Float>
223    maskedArray( const casa::Vector<casa::Float>& s,
224                 const casa::Vector<casa::uChar>& f );
225  casa::Vector<casa::uChar>
226    flagsFromMA(const casa::MaskedArray<casa::Float>& ma);
[230]227
[805]228  bool insitu_;
229};
[234]230
[805]231}
[165]232#endif
Note: See TracBrowser for help on using the repository browser.