source: trunk/src/SDMath.h@ 160

Last change on this file since 160 was 155, checked in by kil064, 20 years ago

doc cxhanges
previous entry should also have said that added 'insitu' capability
to function 'add' as well

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1//#---------------------------------------------------------------------------
2//# SDMath.h: A collection of single dish mathematical operations
3//#---------------------------------------------------------------------------
4//# Copyright (C) 2004
5//# ATNF
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//#---------------------------------------------------------------------------
31#ifndef SDMATH_H
32#define SDMATH_H
33
34#include <string>
35#include <vector>
36#include <casa/aips.h>
37#include <casa/Utilities/CountedPtr.h>
38
39namespace asap {
40
41class SDMemTable;
42
43namespace SDMath {
44
45// Quotient
46
47 casa::CountedPtr<SDMemTable> quotient(const casa::CountedPtr<SDMemTable>& on,
48 const casa::CountedPtr<SDMemTable>& off);
49
50// Multiply
51
52 void multiplyInSitu(SDMemTable* in, casa::Float factor, casa::Bool all);
53 casa::CountedPtr<SDMemTable> multiply(const casa::CountedPtr<SDMemTable>& in,
54 casa::Float factor, casa::Bool all);
55
56// Addition
57
58 void addInSitu (SDMemTable* in, casa::Float offset, casa::Bool all);
59 casa::CountedPtr<SDMemTable> add(const casa::CountedPtr<SDMemTable>& in,
60 casa::Float offset, casa::Bool all);
61
62// Hanning
63
64 casa::CountedPtr<SDMemTable> hanning(const casa::CountedPtr<SDMemTable>& in);
65
66// Bin up
67
68 casa::CountedPtr<SDMemTable> bin(const casa::CountedPtr<SDMemTable>& in,
69 casa::Int width);
70
71// Average in time
72
73 casa::CountedPtr<SDMemTable>
74 average (const casa::Block<casa::CountedPtr<SDMemTable> >& in,
75 const casa::Vector<casa::Bool>& mask,
76 bool scanAverage, const std::string& weightStr);
77
78// Average polarizations
79
80 casa::CountedPtr<SDMemTable>
81 averagePol(const casa::CountedPtr<SDMemTable>& in, const casa::Vector<casa::Bool>& mask);
82
83// Statistics
84
85 std::vector<float> statistic(const casa::CountedPtr<SDMemTable>& in,
86 const std::vector<bool>& mask, const std::string& which);
87
88// private like functions (this is not a class so can't make them private)
89
90// Weighting type for time averaging
91
92 enum weightType {NONE,VAR,TSYS};
93
94// Function to use accumulate data during time averaging
95
96 void accumulate (casa::Double& timeSum, casa::Double& intSum, casa::Int& nAccum,
97 casa::MaskedArray<casa::Float>& sum, casa::Array<casa::Float>& sumSq,
98 casa::Array<casa::Float>& nPts, casa::Array<casa::Float>& tSysSum,
99 const casa::Array<casa::Float>& tSys, const casa::Array<casa::Float>& nInc,
100 const casa::Vector<casa::Bool>& mask, casa::Double time, casa::Double interval,
101 const casa::Block<casa::CountedPtr<SDMemTable> >& in,
102 casa::uInt iTab, casa::uInt iRow, casa::uInt axis, casa::uInt nAxesSub,
103 casa::Bool useMask, weightType wtType);
104
105// Function to fill Scan Container when averaging in time
106
107 void fillSDC (SDContainer& sc, const casa::Array<casa::Bool>& mask,
108 const casa::Array<casa::Float>& data,
109 const casa::Array<casa::Float>& tSys,
110 casa::Int scanID, casa::Double timeStamp,
111 casa::Double interval, const casa::String& sourceName,
112 const casa::Vector<casa::uInt>& freqID);
113
114// Function to normalize data when averaging in time
115
116 void normalize (casa::MaskedArray<casa::Float>& data,
117 const casa::Array<casa::Float>& sumSq,
118 const casa::Array<casa::Float>& nPts,
119 weightType wtType, casa::Int axis, casa::Int nAxes);
120
121// Functions for simple mathematical operations. what=0 (mul) or 1 (add)
122
123 SDMemTable* localOperate (const SDMemTable& in, casa::Float offset,
124 casa::Bool doAll, casa::uInt what);
125
126// Function to get the current cursor location
127 void getCursorLocation (casa::IPosition& start, casa::IPosition& end,
128 const SDMemTable& in);
129};
130
131} // namespace
132
133#endif
134
135
136
137
138
Note: See TracBrowser for help on using the repository browser.