casacore
Loading...
Searching...
No Matches
LatticeHistSpecialize.h
Go to the documentation of this file.
1// # LatticeHistSpecialize.h: specialized functions for LatticeHistograms
2// # Copyright (C) 1996,1997,1999,2000
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: casa-feedback@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#ifndef LATTICES_LATTICEHISTSPECIALIZE_H
27#define LATTICES_LATTICEHISTSPECIALIZE_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/ArrayFwd.h>
32#include <casacore/casa/BasicSL/Complex.h>
33#include <casacore/scimath/Mathematics/NumericTraits.h>
34#include <casacore/casa/Containers/Block.h>
35
36namespace casacore { // # NAMESPACE CASACORE - BEGIN
37
38// # Forward Declarations
39class PGPlotter;
40
41// <summary> Specialized functions for LatticeHistograms</summary>
42// <use visibility=export>
43//
44// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
45// </reviewed>
46//
47// <prerequisite>
48// <li> <linkto class=LatticeHistograms>LatticeHistograms</linkto>
49// </prerequisite>
50//
51// <etymology>
52// Specialized code is type specific. This code is for LatticeHistograms.
53// </etymology>
54//
55// <synopsis>
56// This class provides specialized static functions to handle Type
57// dependent (Float, Complex) processing for LatticeHistograms.
58// I couldn't do it all with templated functions.
59// </synopsis>
60//
61// <motivation>
62// </motivation>
63//
64// <todo asof="1999/10/18">
65// </todo>
66
68 public:
69 // Make historgam cumulative
70 template <class T>
71 static void makeCumulative(Vector<T>& counts, T& yMax, uInt nBins,
72 typename NumericTraits<T>::BaseType scale);
73 static void makeCumulative(Vector<Complex>& counts, Complex& yMax, uInt nBins, Float scale);
74
75 // Make histogram logarithmic
76 template <class T>
77 static void makeLogarithmic(Vector<T>& counts, T& yMax, uInt nBins);
78 static void makeLogarithmic(Vector<Complex>& counts, Complex& yMax, uInt nBins);
79
80 // Multiply. Real and imaginary treated as independent
81 // C1*C2 = (r1*r2,i1*i2)
82 static Float mul(Float v1, Float v2);
83 static Complex mul(Complex v1, Complex v2);
84
85 // Plot histograms
86 static void plot(PGPlotter& plot, Bool doGauss, Bool doCumu, Bool doLog, Float linearSum,
87 Float yMax, Float binWidth, const Vector<Float>& values,
88 const Vector<Float>& counts, const Vector<Float>& stats, uInt whereLabel,
89 uInt ci, Bool page);
90 static void plot(PGPlotter& plot, Bool doGauss, Bool doCumu, Bool doLog, Complex linearSum,
91 Complex yMax, Complex binWidth, const Vector<Complex>& values,
92 const Vector<Complex>& counts, const Vector<Complex>& stats, uInt whereLabel,
93 uInt ci, Bool page);
94
95 // Process data chunk creating histogram.
96 template <class T>
97 static void process(const T* pInData, const Bool* pInMask, Block<T>* pHist, const Vector<T>& clip,
98 T binWidth, uInt offset, uInt nrval, uInt nBins, uInt dataIncr,
99 uInt maskIncr);
100 //
101 static void process(const Complex* pInData, const Bool* pInMask, Block<Complex>* pHist,
102 const Vector<Complex>& clip, Complex binWidth, uInt offset, uInt nrval,
103 uInt nBins, uInt dataIncr, uInt maskIncr);
104
105 // Set bin width. For complex, real and imaginary treated separately
106 static Float setBinWidth(Float dmin, Float dmax, uInt nBins);
107 //
108 static Complex setBinWidth(Complex dmin, Complex dmax, uInt nBins);
109
110 private:
111 static uInt bin(Float datum, Float min, Float width, uInt nBins);
112 //
113 static void makeGauss(uInt& nGPts, Float& gMax, Vector<Float>& gX, Vector<Float>& gY, Float dMean,
114 Float dSigma, Float dSum, Float xMin, Float xMax, Float binWidth,
115 Bool doCumu, Bool doLog);
116 //
117 static void plotHist(const Vector<Float>& x, const Vector<Float>& y, PGPlotter& plotter);
118};
119
120} // namespace casacore
121
122#ifndef CASACORE_NO_AUTO_TEMPLATES
123#include <casacore/lattices/LatticeMath/LatticeHistSpecialize2.tcc>
124#endif
125
126#endif
static void process(const Complex *pInData, const Bool *pInMask, Block< Complex > *pHist, const Vector< Complex > &clip, Complex binWidth, uInt offset, uInt nrval, uInt nBins, uInt dataIncr, uInt maskIncr)
static void makeCumulative(Vector< Complex > &counts, Complex &yMax, uInt nBins, Float scale)
static Complex setBinWidth(Complex dmin, Complex dmax, uInt nBins)
static void makeCumulative(Vector< T > &counts, T &yMax, uInt nBins, typename NumericTraits< T >::BaseType scale)
Make historgam cumulative.
static void makeLogarithmic(Vector< Complex > &counts, Complex &yMax, uInt nBins)
static Complex mul(Complex v1, Complex v2)
static Float setBinWidth(Float dmin, Float dmax, uInt nBins)
Set bin width.
static Float mul(Float v1, Float v2)
Multiply.
static void makeLogarithmic(Vector< T > &counts, T &yMax, uInt nBins)
Make histogram logarithmic.
static void plotHist(const Vector< Float > &x, const Vector< Float > &y, PGPlotter &plotter)
static void plot(PGPlotter &plot, Bool doGauss, Bool doCumu, Bool doLog, Float linearSum, Float yMax, Float binWidth, const Vector< Float > &values, const Vector< Float > &counts, const Vector< Float > &stats, uInt whereLabel, uInt ci, Bool page)
Plot histograms.
static uInt bin(Float datum, Float min, Float width, uInt nBins)
static void plot(PGPlotter &plot, Bool doGauss, Bool doCumu, Bool doLog, Complex linearSum, Complex yMax, Complex binWidth, const Vector< Complex > &values, const Vector< Complex > &counts, const Vector< Complex > &stats, uInt whereLabel, uInt ci, Bool page)
static void makeGauss(uInt &nGPts, Float &gMax, Vector< Float > &gX, Vector< Float > &gY, Float dMean, Float dSigma, Float dSum, Float xMin, Float xMax, Float binWidth, Bool doCumu, Bool doLog)
static void process(const T *pInData, const Bool *pInMask, Block< T > *pHist, const Vector< T > &clip, T binWidth, uInt offset, uInt nrval, uInt nBins, uInt dataIncr, uInt maskIncr)
Process data chunk creating histogram.
Char BaseType
Numeric type.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
int offset(int, int) const
compute a linear offset from array indicies
unsigned int uInt
Definition aipstype.h:49
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
float Float
Definition aipstype.h:52
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40