File: LatticeHistSpecialize.h

package info (click to toggle)
casacore 3.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 44,728 kB
  • sloc: cpp: 455,618; fortran: 16,301; ansic: 7,403; yacc: 4,547; lex: 2,327; sh: 1,679; python: 704; perl: 523; sed: 499; csh: 34; makefile: 24
file content (148 lines) | stat: -rw-r--r-- 5,379 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//# LatticeHistSpecialize.h:  specialized functions for LatticeHistograms
//# Copyright (C) 1996,1997,1999,2000
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//#        Internet email: aips2-request@nrao.edu.
//#        Postal address: AIPS++ Project Office
//#                        National Radio Astronomy Observatory
//#                        520 Edgemont Road
//#                        Charlottesville, VA 22903-2475 USA
//#
//# $Id$

#ifndef LATTICES_LATTICEHISTSPECIALIZE_H
#define LATTICES_LATTICEHISTSPECIALIZE_H

//# Includes
#include <casacore/casa/aips.h>
#include <casacore/casa/BasicSL/Complex.h>
#include <casacore/scimath/Mathematics/NumericTraits.h>

namespace casacore { //# NAMESPACE CASACORE - BEGIN

//# Forward Declarations
template <class T> class Vector;
template <class T> class Block;
class PGPlotter;

// <summary> Specialized functions for LatticeHistograms</summary>
// <use visibility=export>
//
// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
// </reviewed>
//
// <prerequisite>
//   <li> <linkto class=LatticeHistograms>LatticeHistograms</linkto>
// </prerequisite>
//
// <etymology>
//  Specialized code is type specific.  This code is for LatticeHistograms.
// </etymology>
//
// <synopsis>
// This class provides specialized static functions to handle Type
// dependent (Float, Complex) processing for LatticeHistograms.
// I couldn't do it all with templated functions.
// </synopsis>
//
// <motivation>
// </motivation>
//
// <todo asof="1999/10/18">
// </todo>
  

class LatticeHistSpecialize
{
public:
// Make historgam cumulative
   template <class T> static void makeCumulative (Vector<T>& counts,
                               T& yMax, uInt nBins,
                               typename NumericTraits<T>::BaseType scale);
   static void makeCumulative (Vector<Complex>& counts,
                               Complex& yMax, uInt nBins,
                               Float scale);

// Make histogram logarithmic
   template <class T> static void makeLogarithmic (Vector<T>& counts,
                                T& yMax,
                                uInt nBins);
   static void makeLogarithmic (Vector<Complex>& counts,
                                Complex& yMax,
                                uInt nBins);

// Multiply.  Real and imaginary treated as independent
// C1*C2 = (r1*r2,i1*i2)
   static Float mul(Float v1, Float v2);
   static Complex mul(Complex v1, Complex v2);

// Plot histograms
   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);
   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);

// Process data chunk creating histogram.
   template <class T> 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
   );
//
   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
   );

// Set bin width.  For complex, real and imaginary treated separately
   static Float setBinWidth (Float dmin, Float dmax, uInt nBins);
//
   static Complex setBinWidth(Complex dmin, Complex dmax, uInt nBins);

private:
   static uInt bin(Float datum, Float min, Float width, uInt nBins);
//
   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 plotHist (const Vector<Float>& x,
                         const Vector<Float>& y,
                         PGPlotter& plotter);
};


} //# NAMESPACE CASACORE - END

#ifndef CASACORE_NO_AUTO_TEMPLATES
#include <casacore/lattices/LatticeMath/LatticeHistSpecialize2.tcc>
#endif 

#endif