casa
$Rev:20696$
|
00001 //# LatticeHistSpecialize.h: specialized functions for LatticeHistograms 00002 //# Copyright (C) 1996,1997,1999,2000 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id: LatticeHistSpecialize.h 19909 2007-02-23 02:08:02Z Malte.Marquarding $ 00027 00028 #ifndef LATTICES_LATTICEHISTSPECIALIZE_H 00029 #define LATTICES_LATTICEHISTSPECIALIZE_H 00030 00031 00032 //# Includes 00033 #include <casa/aips.h> 00034 #include <casa/BasicSL/Complex.h> 00035 00036 namespace casa { //# NAMESPACE CASA - BEGIN 00037 00038 //# Forward Declarations 00039 template <class T> class Vector; 00040 template <class T> class Block; 00041 class PGPlotter; 00042 00043 // <summary> Specialized functions for LatticeHistograms</summary> 00044 // <use visibility=export> 00045 // 00046 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00047 // </reviewed> 00048 // 00049 // <prerequisite> 00050 // <li> <linkto class=LatticeHistograms>LatticeHistograms</linkto> 00051 // </prerequisite> 00052 // 00053 // <etymology> 00054 // Specialized code is type specific. This code is for LatticeHistograms. 00055 // </etymology> 00056 // 00057 // <synopsis> 00058 // This class provides specialized static functions to handle Type 00059 // dependent (Float, Complex) processing for LatticeHistograms. 00060 // I couldn't do it all with templated functions. 00061 // </synopsis> 00062 // 00063 // <motivation> 00064 // </motivation> 00065 // 00066 // <todo asof="1999/10/18"> 00067 // </todo> 00068 00069 00070 class LatticeHistSpecialize 00071 { 00072 public: 00073 // Make historgam cumulative 00074 static void makeCumulative (Vector<Float>& counts, 00075 Float& yMax, uInt nBins, 00076 Float scale); 00077 static void makeCumulative (Vector<Complex>& counts, 00078 Complex& yMax, uInt nBins, 00079 Float scale); 00080 00081 // Make histogram logarithmic 00082 static void makeLogarithmic (Vector<Float>& counts, 00083 Float& yMax, 00084 uInt nBins); 00085 static void makeLogarithmic (Vector<Complex>& counts, 00086 Complex& yMax, 00087 uInt nBins); 00088 00089 // Multiply. Real and imaginary treated as independent 00090 // C1*C2 = (r1*r2,i1*i2) 00091 static Float mul(Float v1, Float v2); 00092 static Complex mul(Complex v1, Complex v2); 00093 00094 // Plot histograms 00095 static void plot(PGPlotter& plot, Bool doGauss, Bool doCumu, Bool doLog, 00096 Float linearSum, Float yMax, Float binWidth, 00097 const Vector<Float>& values, 00098 const Vector<Float>& counts, const Vector<Float>& stats, 00099 uInt whereLabel, uInt ci, Bool page); 00100 static void plot(PGPlotter& plot, Bool doGauss, Bool doCumu, Bool doLog, 00101 Complex linearSum, Complex yMax, Complex binWidth, 00102 const Vector<Complex>& values, 00103 const Vector<Complex>& counts, const Vector<Complex>& stats, 00104 uInt whereLabel, uInt ci, Bool page); 00105 00106 // Process data chunk creating histogram. 00107 static void process( 00108 const Float* pInData, const Bool* pInMask, 00109 Block<Float>* pHist, const Vector<Float>& clip, 00110 Float binWidth, uInt offset, uInt nrval, 00111 uInt nBins, uInt dataIncr, uInt maskIncr 00112 ); 00113 // 00114 static void process ( 00115 const Complex* pInData, const Bool* pInMask, 00116 Block<Complex>* pHist, const Vector<Complex>& clip, 00117 Complex binWidth, uInt offset, uInt nrval, 00118 uInt nBins, uInt dataIncr, uInt maskIncr 00119 ); 00120 00121 // Set bin width. For complex, real and imaginary treated separately 00122 static Float setBinWidth (Float dmin, Float dmax, uInt nBins); 00123 // 00124 static Complex setBinWidth(Complex dmin, Complex dmax, uInt nBins); 00125 00126 private: 00127 static uInt bin(Float datum, Float min, Float width, uInt nBins); 00128 // 00129 static void makeGauss(uInt& nGPts, Float& gMax, 00130 Vector<Float>& gX, Vector<Float>& gY, 00131 Float dMean, Float dSigma, 00132 Float dSum, Float xMin, 00133 Float xMax, Float binWidth, 00134 Bool doCumu, Bool doLog); 00135 // 00136 static void plotHist (const Vector<Float>& x, 00137 const Vector<Float>& y, 00138 PGPlotter& plotter); 00139 }; 00140 00141 00142 } //# NAMESPACE CASA - END 00143 00144 #endif