[49] | 1 | //#---------------------------------------------------------------------------
|
---|
| 2 | //# SDMathWrapper.h: Wrapper classes to use CountedPtr
|
---|
| 3 | //#---------------------------------------------------------------------------
|
---|
| 4 | //# Copyright (C) 2004
|
---|
[125] | 5 | //# ATNF
|
---|
[49] | 6 | //#
|
---|
| 7 | //# This program is free software; you can redistribute it and/or modify it
|
---|
| 8 | //# under the terms of the GNU General Public License as published by the Free
|
---|
| 9 | //# Software Foundation; either version 2 of the License, or (at your option)
|
---|
| 10 | //# any later version.
|
---|
| 11 | //#
|
---|
| 12 | //# This program is distributed in the hope that it will be useful, but
|
---|
| 13 | //# WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
---|
| 15 | //# Public License for more details.
|
---|
| 16 | //#
|
---|
| 17 | //# You should have received a copy of the GNU General Public License along
|
---|
| 18 | //# with this program; if not, write to the Free Software Foundation, Inc.,
|
---|
| 19 | //# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
|
---|
| 20 | //#
|
---|
| 21 | //# Correspondence concerning this software should be addressed as follows:
|
---|
| 22 | //# Internet email: Malte.Marquarding@csiro.au
|
---|
| 23 | //# Postal address: Malte Marquarding,
|
---|
| 24 | //# Australia Telescope National Facility,
|
---|
| 25 | //# P.O. Box 76,
|
---|
| 26 | //# Epping, NSW, 2121,
|
---|
| 27 | //# AUSTRALIA
|
---|
| 28 | //#
|
---|
| 29 | //# $Id:
|
---|
| 30 | //#---------------------------------------------------------------------------
|
---|
[125] | 31 | #ifndef SDMATHWRAPPER_H
|
---|
| 32 | #define SDMATHWRAPPER_H
|
---|
[49] | 33 |
|
---|
| 34 | #include <vector>
|
---|
| 35 | #include <string>
|
---|
| 36 |
|
---|
| 37 | #include <boost/python/tuple.hpp>
|
---|
| 38 |
|
---|
| 39 | #include "SDMemTableWrapper.h"
|
---|
[716] | 40 | #include "SDMath.h"
|
---|
[49] | 41 |
|
---|
[83] | 42 | namespace asap {
|
---|
[49] | 43 |
|
---|
[69] | 44 | namespace SDMathWrapper {
|
---|
[49] | 45 |
|
---|
[716] | 46 |
|
---|
| 47 | static SDMath sdmath;
|
---|
| 48 | // Quotient
|
---|
[49] | 49 | SDMemTableWrapper quotient(const SDMemTableWrapper& on,
|
---|
[244] | 50 | const SDMemTableWrapper& off,
|
---|
| 51 | casa::Bool preserveContinuum);
|
---|
[49] | 52 |
|
---|
[716] | 53 | // Simple binary operations
|
---|
| 54 | SDMemTableWrapper binaryOperate(const SDMemTableWrapper& left,
|
---|
| 55 | const SDMemTableWrapper& right,
|
---|
| 56 | const std::string& op, bool doTSys);
|
---|
| 57 |
|
---|
| 58 | // Multiply
|
---|
| 59 | void scaleInSitu(SDMemTableWrapper& in, float factor, bool doAll,
|
---|
| 60 | bool doTSys);
|
---|
| 61 | SDMemTableWrapper scale(const SDMemTableWrapper& in, float factor,
|
---|
| 62 | bool all, bool doTSys);
|
---|
| 63 |
|
---|
| 64 | // Add
|
---|
[175] | 65 | void addInSitu(SDMemTableWrapper& in, float offset, bool doAall);
|
---|
[170] | 66 | SDMemTableWrapper add(const SDMemTableWrapper& in, float offset, bool all);
|
---|
[107] | 67 |
|
---|
[178] | 68 | // Smooth
|
---|
[209] | 69 | void smoothInSitu(SDMemTableWrapper& in, const std::string& kernel,
|
---|
| 70 | float width, bool doAll);
|
---|
| 71 | SDMemTableWrapper smooth(const SDMemTableWrapper& in,
|
---|
| 72 | const std::string& kernel, float width, bool doAll);
|
---|
[49] | 73 |
|
---|
[151] | 74 | // Bin up
|
---|
[209] | 75 | void binInSitu(SDMemTableWrapper& in, int width);
|
---|
[169] | 76 | SDMemTableWrapper bin(const SDMemTableWrapper& in, int width);
|
---|
[151] | 77 |
|
---|
[300] | 78 | // Resample
|
---|
[716] | 79 | void resampleInSitu(SDMemTableWrapper& in, const std::string& method,
|
---|
| 80 | float width);
|
---|
| 81 | SDMemTableWrapper resample(const SDMemTableWrapper& in,
|
---|
| 82 | const std::string& method,
|
---|
[300] | 83 | float width);
|
---|
| 84 |
|
---|
[228] | 85 | // Convert brightness between Jy and K
|
---|
[716] | 86 | void convertFluxInSitu(SDMemTableWrapper& in, float D, float eta,
|
---|
| 87 | float JyPerK, bool doAll);
|
---|
| 88 | SDMemTableWrapper convertFlux(const SDMemTableWrapper& in, float D,
|
---|
| 89 | float eta, float JyPerK, bool doAll);
|
---|
[222] | 90 |
|
---|
[228] | 91 | // Apply gain elevation correction
|
---|
[235] | 92 | void gainElevationInSitu (SDMemTableWrapper& in, const std::vector<float>& coeffs,
|
---|
| 93 | const std::string& fileName,
|
---|
[228] | 94 | const std::string& method, bool doAll);
|
---|
[235] | 95 | SDMemTableWrapper gainElevation(const SDMemTableWrapper& in, const std::vector<float>& coeffs,
|
---|
| 96 | const std::string& fileName,
|
---|
[228] | 97 | const std::string& method, bool doAll);
|
---|
| 98 |
|
---|
[312] | 99 | // Apply frequency alignment
|
---|
[318] | 100 | void frequencyAlignmentInSitu (SDMemTableWrapper& in, const std::string& refTime,
|
---|
[398] | 101 | const std::string& method, bool perFreqID);
|
---|
[318] | 102 | SDMemTableWrapper frequencyAlignment(const SDMemTableWrapper& in, const std::string& refTime,
|
---|
[398] | 103 | const std::string& method, bool perFreqID);
|
---|
[262] | 104 |
|
---|
[457] | 105 | // XY Phase rotation
|
---|
| 106 | void rotateXYPhaseInSitu(SDMemTableWrapper& in, float angle, bool doAll);
|
---|
| 107 |
|
---|
[503] | 108 | // LinPol Phase rotation
|
---|
| 109 | void rotateLinPolPhaseInSitu(SDMemTableWrapper& in, float angle, bool doAll);
|
---|
| 110 |
|
---|
[235] | 111 | // Apply opacity correction
|
---|
[716] | 112 | void opacityInSitu(SDMemTableWrapper& in, float tau, bool doAll);
|
---|
| 113 | SDMemTableWrapper opacity(const SDMemTableWrapper& in, float tau,
|
---|
| 114 | bool doAll);
|
---|
[235] | 115 |
|
---|
[151] | 116 | // Average in time
|
---|
[209] | 117 | SDMemTableWrapper average(boost::python::tuple tpl,
|
---|
| 118 | const std::vector<bool>& mask,
|
---|
| 119 | bool scanAv, const std::string& wt);
|
---|
[49] | 120 |
|
---|
[151] | 121 | // Average polarizations
|
---|
[315] | 122 | void averagePolInSitu(SDMemTableWrapper& in, const std::vector<bool>& mask,
|
---|
| 123 | const std::string& weightStr);
|
---|
[209] | 124 | SDMemTableWrapper averagePol(const SDMemTableWrapper& in,
|
---|
[315] | 125 | const std::vector<bool>& mask,
|
---|
| 126 | const std::string& weightStr);
|
---|
[49] | 127 |
|
---|
[716] | 128 | // Frequency Switching
|
---|
| 129 | void SDMathWrapper::frequencySwitchInSitu(SDMemTableWrapper& in);
|
---|
| 130 |
|
---|
| 131 | SDMemTableWrapper
|
---|
| 132 | SDMathWrapper::frequencySwitch(const SDMemTableWrapper& in);
|
---|
| 133 |
|
---|
| 134 | // Statistics
|
---|
[131] | 135 | std::vector<float> statistic(const SDMemTableWrapper& in,
|
---|
[169] | 136 | const std::vector<bool>& mask,
|
---|
[235] | 137 | const std::string& which, int row);
|
---|
[716] | 138 |
|
---|
[49] | 139 | };
|
---|
| 140 |
|
---|
| 141 | } // namespace
|
---|
| 142 | #endif
|
---|