[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" |
---|
[234] | 25 | #include "SDDefs.h" |
---|
[716] | 26 | #include "SDLog.h" |
---|
[2] | 27 | |
---|
[83] | 28 | namespace asap { |
---|
[2] | 29 | |
---|
[805] | 30 | /** |
---|
| 31 | Mathmatical operations on Scantable objects |
---|
[2] | 32 | |
---|
[805] | 33 | @author Malte Marquarding |
---|
| 34 | */ |
---|
| 35 | class STMath : private SDLog { |
---|
[716] | 36 | public: |
---|
[171] | 37 | |
---|
[805] | 38 | typedef casa::InterpolateArray1D<casa::Double, |
---|
| 39 | casa::Float>::InterpolationMethod imethod; |
---|
[299] | 40 | |
---|
[805] | 41 | typedef std::map<std::string, imethod> imap; |
---|
[177] | 42 | |
---|
[805] | 43 | STMath(bool insitu=true); |
---|
[221] | 44 | |
---|
[805] | 45 | ~STMath(); |
---|
[227] | 46 | |
---|
[805] | 47 | /** |
---|
| 48 | * set the @attr insitu attribute |
---|
| 49 | * @param b |
---|
| 50 | */ |
---|
| 51 | bool insitu() const { return insitu_;}; |
---|
| 52 | void setInsitu(bool b) { insitu_ = b; }; |
---|
[262] | 53 | |
---|
[805] | 54 | casa::CountedPtr<Scantable> |
---|
| 55 | average( const std::vector<casa::CountedPtr<Scantable> >& in, |
---|
| 56 | const casa::Vector<casa::Bool>& mask, |
---|
| 57 | const std::string& weight, |
---|
| 58 | const std::string& avmode = "", |
---|
| 59 | bool alignfreq = false ); |
---|
[234] | 60 | |
---|
[805] | 61 | casa::CountedPtr<Scantable> |
---|
| 62 | unaryOperate( const casa::CountedPtr<Scantable>& in, float val, |
---|
| 63 | const std::string& mode, bool tsys=false ); |
---|
[169] | 64 | |
---|
[805] | 65 | casa::CountedPtr<Scantable> quotient( const casa::CountedPtr<Scantable>& in, |
---|
| 66 | const std::string& mode = "NEAREST", |
---|
| 67 | bool preserve = true ); |
---|
[169] | 68 | |
---|
[805] | 69 | casa::CountedPtr<Scantable> |
---|
| 70 | freqSwitch( const casa::CountedPtr<Scantable>& in ); |
---|
[716] | 71 | |
---|
[805] | 72 | std::vector<float> statistic(const casa::CountedPtr<Scantable>& in, |
---|
| 73 | const std::vector<bool>& mask, |
---|
| 74 | const std::string& which); |
---|
[457] | 75 | |
---|
[805] | 76 | casa::CountedPtr<Scantable> bin( const casa::CountedPtr<Scantable>& in, |
---|
| 77 | int width=5); |
---|
| 78 | casa::CountedPtr<Scantable> |
---|
| 79 | resample(const casa::CountedPtr<Scantable>& in, |
---|
| 80 | const std::string& method, float width); |
---|
[457] | 81 | |
---|
[805] | 82 | casa::CountedPtr<Scantable> |
---|
| 83 | smooth(const casa::CountedPtr<Scantable>& in, const std::string& kernel, |
---|
| 84 | float width); |
---|
[169] | 85 | |
---|
[805] | 86 | casa::CountedPtr<Scantable> |
---|
| 87 | gainElevation(const casa::CountedPtr<Scantable>& in, |
---|
| 88 | const casa::Vector<casa::Float>& coeffs, |
---|
| 89 | const std::string& fileName, |
---|
| 90 | const std::string& method); |
---|
| 91 | casa::CountedPtr<Scantable> |
---|
| 92 | convertFlux(const casa::CountedPtr<Scantable>& in, float d, |
---|
| 93 | float etaap, float jyperk); |
---|
[152] | 94 | |
---|
[805] | 95 | casa::CountedPtr<Scantable> opacity(const casa::CountedPtr<Scantable>& in, |
---|
| 96 | float tau); |
---|
[144] | 97 | |
---|
[805] | 98 | /// @todo frequency alignment |
---|
[152] | 99 | |
---|
[805] | 100 | private: |
---|
| 101 | static imethod stringToIMethod(const std::string& in); |
---|
| 102 | static WeightType stringToWeight(const std::string& in); |
---|
[146] | 103 | |
---|
[805] | 104 | void scaleByVector(casa::Table& in, |
---|
| 105 | const casa::Vector<casa::Float>& factor, |
---|
| 106 | bool dotsys); |
---|
[152] | 107 | |
---|
[805] | 108 | void scaleFromAsciiTable(casa::Table& in, const std::string& filename, |
---|
| 109 | const std::string& method, |
---|
| 110 | const casa::Vector<casa::Float>& xout, |
---|
| 111 | bool dotsys); |
---|
[162] | 112 | |
---|
[805] | 113 | void scaleFromTable(casa::Table& in, const casa::Table& table, |
---|
| 114 | const std::string& method, |
---|
| 115 | const casa::Vector<casa::Float>& xout, bool dotsys); |
---|
[227] | 116 | |
---|
[805] | 117 | void convertBrightnessUnits(casa::CountedPtr<Scantable>& in, |
---|
| 118 | bool tokelvin, float cfac); |
---|
[227] | 119 | |
---|
[805] | 120 | casa::CountedPtr< Scantable > |
---|
| 121 | getScantable(const casa::CountedPtr< Scantable >& in, bool droprows); |
---|
[230] | 122 | |
---|
[805] | 123 | casa::MaskedArray<casa::Float> |
---|
| 124 | maskedArray( const casa::Vector<casa::Float>& s, |
---|
| 125 | const casa::Vector<casa::uChar>& f ); |
---|
| 126 | casa::Vector<casa::uChar> |
---|
| 127 | flagsFromMA(const casa::MaskedArray<casa::Float>& ma); |
---|
[230] | 128 | |
---|
[805] | 129 | bool insitu_; |
---|
| 130 | }; |
---|
[234] | 131 | |
---|
[805] | 132 | } |
---|
[165] | 133 | #endif |
---|