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