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