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
67
69{
70public:
71// Make historgam cumulative
72 template <class T> static void makeCumulative (Vector<T>& counts,
73 T& yMax, uInt nBins,
74 typename NumericTraits<T>::BaseType scale);
75 static void makeCumulative (Vector<Complex>& counts,
76 Complex& yMax, uInt nBins,
77 Float scale);
78
79// Make histogram logarithmic
80 template <class T> static void makeLogarithmic (Vector<T>& counts,
81 T& yMax,
82 uInt nBins);
83 static void makeLogarithmic (Vector<Complex>& counts,
84 Complex& yMax,
85 uInt nBins);
86
87// Multiply. Real and imaginary treated as independent
88// C1*C2 = (r1*r2,i1*i2)
89 static Float mul(Float v1, Float v2);
90 static Complex mul(Complex v1, Complex v2);
91
92// Plot histograms
93 static void plot(PGPlotter& plot, Bool doGauss, Bool doCumu, Bool doLog,
94 Float linearSum, Float yMax, Float binWidth,
95 const Vector<Float>& values,
96 const Vector<Float>& counts, const Vector<Float>& stats,
97 uInt whereLabel, uInt ci, Bool page);
98 static void plot(PGPlotter& plot, Bool doGauss, Bool doCumu, Bool doLog,
99 Complex linearSum, Complex yMax, Complex binWidth,
100 const Vector<Complex>& values,
101 const Vector<Complex>& counts, const Vector<Complex>& stats,
102 uInt whereLabel, uInt ci, Bool page);
103
104// Process data chunk creating histogram.
105 template <class T> static void process(
106 const T* pInData, const Bool* pInMask,
107 Block<T>* pHist, const Vector<T>& clip,
108 T binWidth, uInt offset, uInt nrval,
109 uInt nBins, uInt dataIncr, uInt maskIncr
110 );
111//
112 static void process (
113 const Complex* pInData, const Bool* pInMask,
114 Block<Complex>* pHist, const Vector<Complex>& clip,
115 Complex binWidth, uInt offset, uInt nrval,
116 uInt nBins, uInt dataIncr, uInt maskIncr
117 );
118
119// Set bin width. For complex, real and imaginary treated separately
120 static Float setBinWidth (Float dmin, Float dmax, uInt nBins);
121//
122 static Complex setBinWidth(Complex dmin, Complex dmax, uInt nBins);
123
124private:
125 static uInt bin(Float datum, Float min, Float width, uInt nBins);
126//
127 static void makeGauss(uInt& nGPts, Float& gMax,
129 Float dMean, Float dSigma,
130 Float dSum, Float xMin,
131 Float xMax, Float binWidth,
132 Bool doCumu, Bool doLog);
133//
134 static void plotHist (const Vector<Float>& x,
135 const Vector<Float>& y,
136 PGPlotter& plotter);
137};
138
139
140} //# NAMESPACE CASACORE - END
141
142#ifndef CASACORE_NO_AUTO_TEMPLATES
143#include <casacore/lattices/LatticeMath/LatticeHistSpecialize2.tcc>
144#endif
145
146#endif
simple 1-D array
Definition Block.h:198
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.
this file contains all the compiler specific defines
Definition mainpage.dox:28
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