casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LattStatsSpecialize.h
Go to the documentation of this file.
1 //# LattStatsSpecialize.h: specialized functions for LatticeStatistics
2 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef LATTICES_LATTSTATSSPECIALIZE_H
29 #define LATTICES_LATTSTATSSPECIALIZE_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37 template <class T> class Vector;
38 template <class T> class Array;
39 template <class T> class Lattice;
40 template <class T> class MaskedLattice;
41 class LatticeExprNode;
42 class String;
43 class IPosition;
44 
45 
46 
47 // <summary> </summary>
48 // <use visibility=export>
49 //
50 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
51 // </reviewed>
52 //
53 // <prerequisite>
54 // </prerequisite>
55 //
56 // <etymology>
57 // </etymology>
58 //
59 // <synopsis>
60 // </synopsis>
61 //
62 // <motivation>
63 // </motivation>
64 //
65 // <todo asof="1998/01/10">
66 // </todo>
67 
68 
70 {
71 public:
72  // !!! WARNING !!!
73  // BOTH accumulate() METHODS ARE DEPRECATED AND NO LONGER USED BY CASACORE NOR
74  // CASA. THESE METHODS WILL BE REMOVED IN THE NEAR FUTURE. PLEASE MODIFY EXISTING
75  // CODE WHICH USES THEM. CURRENT STATISTIC CLASSES MAY BE FOUND IN scimath/StatsFramework.
76 
77  // in this version we maintain a running mean and variance to avoid catastrophic round-off
78  // issues that can happen in some cases, CAS-2226. Removing old versions in which these
79  // quantities were not accumulated - dmehring 2011mar01
80 
81  static void accumulate (
82  Double& nPts, Double& sum,
83  Double& mean, Double& nvariance, Double& variance,
84  Double& sumSq, Float& dataMin,
85  Float& dataMax, Int& minPos,
86  Int& maxPos, Bool& minMaxInit,
87  const Bool fixedMinMax, const Float datum,
88  const uInt& pos, const Float useIt
89  );
90 
91  static void accumulate (DComplex& nPts, DComplex& sum,
92  DComplex& mean, DComplex& nvariance,DComplex& variance,
93  DComplex& sumSq, Complex& dataMin,
94  Complex& dataMax, const Int& minPos,
95  const Int& maxPos, Bool& minMaxInit,
96  const Bool fixedMinMax, const Complex datum,
97  const uInt& pos, const Complex useIt);
98 
99  static Bool hasSomePoints (Double npts);
100  static Bool hasSomePoints (DComplex npts);
101 //
102  static void setUseItTrue (Float& useIt);
103  static void setUseItTrue (Complex& useIt);
104 //
105  static Float usePixelInc (Float dMin, Float dMax, Float datum);
106  static Complex usePixelInc (Complex dMin, Complex dMax, Complex datum);
107 //
108  static Float usePixelExc (Float dMin, Float dMax, Float datum);
109  static Complex usePixelExc (Complex dMin, Complex dMax, Complex datum);
110 //
111  static Double getMean (Double sum, Double n);
112  static DComplex getMean (DComplex sum, DComplex n);
113 //
114  static Double getVariance (Double sum, Double sumsq, Double n);
115  static DComplex getVariance (DComplex sum, DComplex sumsq, DComplex n);
116 //
117  static Double getSigma (Double sum, Double sumsq, Double n);
118  static DComplex getSigma (DComplex sum, DComplex sumsq, DComplex n);
119 //
120  static Double getSigma (Double var);
121  static DComplex getSigma (DComplex var);
122 //
123  static Double getRms (Double sumsq, Double n);
124  static DComplex getRms (DComplex sumsq, DComplex n);
125 //
126  static Float min(Float v1, Float v2);
127  static Complex min(Complex v1, Complex v2);
128 //
129  static Float max(Float v1, Float v2);
130  static Complex max(Complex v1, Complex v2);
131 //
132  static Float getNodeScalarValue(const LatticeExprNode& node, Float);
133  static Complex getNodeScalarValue(const LatticeExprNode& node, Complex);
134 
135  template <class T> static Bool setIncludeExclude (String& errorMessage,
136  Vector<T>& range,
137  Bool& noInclude, Bool& noExclude,
138  const Vector<T>& include,
139  const Vector<T>& exclude);
140  static Bool setIncludeExclude (String& errorMessage,
141  Vector<Complex>& range,
142  Bool& noInclude, Bool& noExclude,
143  const Vector<Complex>& include,
144  const Vector<Complex>& exclude);
145 //
146  static Bool minMax (Float& dataMin, Float& dataMax, const MaskedLattice<Float>* pLattice,
147  const Vector<Float>& range, Bool noInclude, Bool noExclude);
148  static Bool minMax (Complex& dataMin, Complex& dataMax, const MaskedLattice<Complex>* pLattice,
149  const Vector<Complex>& range, Bool noInclude, Bool noExclude);
150 };
151 
152 
153 } //# NAMESPACE CASACORE - END
154 
155 #ifndef CASACORE_NO_AUTO_TEMPLATES
156 #include <casacore/lattices/LatticeMath/LattStatsSpecialize2.tcc>
157 #endif //# CASACORE_NO_AUTO_TEMPLATES
158 
159 #endif
160 
static Float getNodeScalarValue(const LatticeExprNode &node, Float)
A 1-D Specialization of the Array class.
int Int
Definition: aipstype.h:50
std::vector< double > Vector
Definition: ds9context.h:24
static Bool setIncludeExclude(String &errorMessage, Vector< T > &range, Bool &noInclude, Bool &noExclude, const Vector< T > &include, const Vector< T > &exclude)
static Float usePixelExc(Float dMin, Float dMax, Float datum)
LatticeExprNode sum(const LatticeExprNode &expr)
A templated, abstract base class for array-like objects with masks.
static Float max(Float v1, Float v2)
static Double getVariance(Double sum, Double sumsq, Double n)
static void accumulate(Double &nPts, Double &sum, Double &mean, Double &nvariance, Double &variance, Double &sumSq, Float &dataMin, Float &dataMax, Int &minPos, Int &maxPos, Bool &minMaxInit, const Bool fixedMinMax, const Float datum, const uInt &pos, const Float useIt)
!!! WARNING !!! BOTH accumulate() METHODS ARE DEPRECATED AND NO LONGER USED BY CASACORE NOR CASA...
static Bool hasSomePoints(Double npts)
static Float min(Float v1, Float v2)
static void setUseItTrue(Float &useIt)
static Float usePixelInc(Float dMin, Float dMax, Float datum)
double Double
Definition: aipstype.h:55
static Double getSigma(Double sum, Double sumsq, Double n)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
static Bool minMax(Float &dataMin, Float &dataMax, const MaskedLattice< Float > *pLattice, const Vector< Float > &range, Bool noInclude, Bool noExclude)
float Float
Definition: aipstype.h:54
static Double getMean(Double sum, Double n)
static Double getRms(Double sumsq, Double n)
Bridging class to allow C++ expressions involving lattices.
LatticeExprNode mean(const LatticeExprNode &expr)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
LatticeExprNode variance(const LatticeExprNode &expr)
unsigned int uInt
Definition: aipstype.h:51
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42