[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"
|
---|
[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 |
|
---|
[841] | 98 | casa::CountedPtr<Scantable>
|
---|
| 99 | merge(const std::vector<casa::CountedPtr<Scantable> >& in);
|
---|
| 100 |
|
---|
[805] | 101 | /// @todo frequency alignment
|
---|
[152] | 102 |
|
---|
[805] | 103 | private:
|
---|
| 104 | static imethod stringToIMethod(const std::string& in);
|
---|
| 105 | static WeightType stringToWeight(const std::string& in);
|
---|
[146] | 106 |
|
---|
[805] | 107 | void scaleByVector(casa::Table& in,
|
---|
| 108 | const casa::Vector<casa::Float>& factor,
|
---|
| 109 | bool dotsys);
|
---|
[152] | 110 |
|
---|
[805] | 111 | void scaleFromAsciiTable(casa::Table& in, const std::string& filename,
|
---|
| 112 | const std::string& method,
|
---|
| 113 | const casa::Vector<casa::Float>& xout,
|
---|
| 114 | bool dotsys);
|
---|
[162] | 115 |
|
---|
[805] | 116 | void scaleFromTable(casa::Table& in, const casa::Table& table,
|
---|
| 117 | const std::string& method,
|
---|
| 118 | const casa::Vector<casa::Float>& xout, bool dotsys);
|
---|
[227] | 119 |
|
---|
[805] | 120 | void convertBrightnessUnits(casa::CountedPtr<Scantable>& in,
|
---|
| 121 | bool tokelvin, float cfac);
|
---|
[227] | 122 |
|
---|
[805] | 123 | casa::CountedPtr< Scantable >
|
---|
| 124 | getScantable(const casa::CountedPtr< Scantable >& in, bool droprows);
|
---|
[230] | 125 |
|
---|
[805] | 126 | casa::MaskedArray<casa::Float>
|
---|
| 127 | maskedArray( const casa::Vector<casa::Float>& s,
|
---|
| 128 | const casa::Vector<casa::uChar>& f );
|
---|
| 129 | casa::Vector<casa::uChar>
|
---|
| 130 | flagsFromMA(const casa::MaskedArray<casa::Float>& ma);
|
---|
[230] | 131 |
|
---|
[805] | 132 | bool insitu_;
|
---|
| 133 | };
|
---|
[234] | 134 |
|
---|
[805] | 135 | }
|
---|
[165] | 136 | #endif
|
---|