[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] | 29 | namespace asap {
|
---|
[2] | 30 |
|
---|
[805] | 31 | /**
|
---|
| 32 | Mathmatical operations on Scantable objects
|
---|
[2] | 33 |
|
---|
[805] | 34 | @author Malte Marquarding
|
---|
| 35 | */
|
---|
[890] | 36 | class STMath : private Logger {
|
---|
[716] | 37 | public:
|
---|
[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");
|
---|
[940] | 60 | casa::CountedPtr< Scantable >
|
---|
| 61 | averagePolarisations( const casa::CountedPtr< Scantable > & in,
|
---|
| 62 | const std::vector<bool>& mask,
|
---|
| 63 | const std::string& weight );
|
---|
[234] | 64 |
|
---|
[805] | 65 | casa::CountedPtr<Scantable>
|
---|
| 66 | unaryOperate( const casa::CountedPtr<Scantable>& in, float val,
|
---|
| 67 | const std::string& mode, bool tsys=false );
|
---|
[169] | 68 |
|
---|
[805] | 69 | casa::CountedPtr<Scantable> quotient( const casa::CountedPtr<Scantable>& in,
|
---|
| 70 | const std::string& mode = "NEAREST",
|
---|
| 71 | bool preserve = true );
|
---|
[169] | 72 |
|
---|
[805] | 73 | casa::CountedPtr<Scantable>
|
---|
| 74 | freqSwitch( const casa::CountedPtr<Scantable>& in );
|
---|
[716] | 75 |
|
---|
[805] | 76 | std::vector<float> statistic(const casa::CountedPtr<Scantable>& in,
|
---|
| 77 | const std::vector<bool>& mask,
|
---|
| 78 | const std::string& which);
|
---|
[457] | 79 |
|
---|
[805] | 80 | casa::CountedPtr<Scantable> bin( const casa::CountedPtr<Scantable>& in,
|
---|
| 81 | int width=5);
|
---|
| 82 | casa::CountedPtr<Scantable>
|
---|
| 83 | resample(const casa::CountedPtr<Scantable>& in,
|
---|
| 84 | const std::string& method, float width);
|
---|
[457] | 85 |
|
---|
[805] | 86 | casa::CountedPtr<Scantable>
|
---|
| 87 | smooth(const casa::CountedPtr<Scantable>& in, const std::string& kernel,
|
---|
[995] | 88 | float width);
|
---|
[169] | 89 |
|
---|
[805] | 90 | casa::CountedPtr<Scantable>
|
---|
| 91 | gainElevation(const casa::CountedPtr<Scantable>& in,
|
---|
[867] | 92 | const std::vector<float>& coeff,
|
---|
[805] | 93 | const std::string& fileName,
|
---|
[995] | 94 | const std::string& method);
|
---|
[805] | 95 | casa::CountedPtr<Scantable>
|
---|
| 96 | convertFlux(const casa::CountedPtr<Scantable>& in, float d,
|
---|
| 97 | float etaap, float jyperk);
|
---|
[152] | 98 |
|
---|
[805] | 99 | casa::CountedPtr<Scantable> opacity(const casa::CountedPtr<Scantable>& in,
|
---|
| 100 | float tau);
|
---|
[144] | 101 |
|
---|
[841] | 102 | casa::CountedPtr<Scantable>
|
---|
| 103 | merge(const std::vector<casa::CountedPtr<Scantable> >& in);
|
---|
| 104 |
|
---|
[896] | 105 | casa::CountedPtr<Scantable>
|
---|
| 106 | invertPhase( const casa::CountedPtr<Scantable>& in);
|
---|
[912] | 107 |
|
---|
[896] | 108 | casa::CountedPtr<Scantable>
|
---|
| 109 | rotateXYPhase( const casa::CountedPtr<Scantable>& in, float phase);
|
---|
[912] | 110 |
|
---|
[896] | 111 | casa::CountedPtr<Scantable>
|
---|
| 112 | rotateLinPolPhase( const casa::CountedPtr<Scantable>& in, float phase);
|
---|
| 113 |
|
---|
[805] | 114 | /// @todo frequency alignment
|
---|
[152] | 115 |
|
---|
[896] | 116 | casa::CountedPtr<Scantable>
|
---|
| 117 | swapPolarisations(const casa::CountedPtr<Scantable>& in);
|
---|
| 118 |
|
---|
[917] | 119 | casa::CountedPtr<Scantable>
|
---|
| 120 | frequencyAlign( const casa::CountedPtr<Scantable>& in,
|
---|
[927] | 121 | const std::string& refTime = "",
|
---|
| 122 | const std::string& method = "cubic" );
|
---|
[917] | 123 |
|
---|
[992] | 124 | casa::CountedPtr<Scantable>
|
---|
| 125 | convertPolarisation( const casa::CountedPtr<Scantable>& in,
|
---|
| 126 | const std::string& newtype);
|
---|
| 127 |
|
---|
[805] | 128 | private:
|
---|
[896] | 129 | casa::CountedPtr<Scantable> applyToPol( const casa::CountedPtr<Scantable>& in,
|
---|
| 130 | STPol::polOperation fptr,
|
---|
| 131 | casa::Float phase);
|
---|
| 132 |
|
---|
[805] | 133 | static imethod stringToIMethod(const std::string& in);
|
---|
| 134 | static WeightType stringToWeight(const std::string& in);
|
---|
[146] | 135 |
|
---|
[805] | 136 | void scaleByVector(casa::Table& in,
|
---|
| 137 | const casa::Vector<casa::Float>& factor,
|
---|
| 138 | bool dotsys);
|
---|
[152] | 139 |
|
---|
[805] | 140 | void scaleFromAsciiTable(casa::Table& in, const std::string& filename,
|
---|
| 141 | const std::string& method,
|
---|
| 142 | const casa::Vector<casa::Float>& xout,
|
---|
| 143 | bool dotsys);
|
---|
[162] | 144 |
|
---|
[805] | 145 | void scaleFromTable(casa::Table& in, const casa::Table& table,
|
---|
| 146 | const std::string& method,
|
---|
| 147 | const casa::Vector<casa::Float>& xout, bool dotsys);
|
---|
[227] | 148 |
|
---|
[805] | 149 | void convertBrightnessUnits(casa::CountedPtr<Scantable>& in,
|
---|
| 150 | bool tokelvin, float cfac);
|
---|
[227] | 151 |
|
---|
[805] | 152 | casa::CountedPtr< Scantable >
|
---|
| 153 | getScantable(const casa::CountedPtr< Scantable >& in, bool droprows);
|
---|
[230] | 154 |
|
---|
[805] | 155 | casa::MaskedArray<casa::Float>
|
---|
| 156 | maskedArray( const casa::Vector<casa::Float>& s,
|
---|
| 157 | const casa::Vector<casa::uChar>& f );
|
---|
| 158 | casa::Vector<casa::uChar>
|
---|
| 159 | flagsFromMA(const casa::MaskedArray<casa::Float>& ma);
|
---|
[230] | 160 |
|
---|
[805] | 161 | bool insitu_;
|
---|
| 162 | };
|
---|
[234] | 163 |
|
---|
[805] | 164 | }
|
---|
[165] | 165 | #endif
|
---|