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