LattStatsSpecialize.h

Go to the documentation of this file.
00001 //# LattStatsSpecialize.h: specialized functions for LatticeStatistics
00002 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
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$
00027 
00028 #ifndef LATTICES_LATTSTATSSPECIALIZE_H
00029 #define LATTICES_LATTSTATSSPECIALIZE_H
00030 
00031 
00032 //# Includes
00033 #include <casacore/casa/aips.h>
00034 #include <casacore/casa/BasicSL/Complex.h>
00035 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00036 
00037 template <class T> class Vector;
00038 template <class T> class Array;
00039 template <class T> class Lattice;
00040 template <class T> class MaskedLattice;
00041 class LatticeExprNode;
00042 class String;
00043 class IPosition;
00044 
00045 
00046 
00047 // <summary>  </summary>
00048 // <use visibility=export>
00049 //
00050 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00051 // </reviewed>
00052 //
00053 // <prerequisite>
00054 // </prerequisite>
00055 //
00056 // <etymology>
00057 // </etymology>
00058 //
00059 // <synopsis>
00060 // </synopsis>
00061 // 
00062 // <motivation>
00063 // </motivation>
00064 // 
00065 // <todo asof="1998/01/10">
00066 // </todo>
00067  
00068 
00069 class LattStatsSpecialize
00070 {
00071 public:
00072         // !!! WARNING !!!
00073         // BOTH accumulate() METHODS ARE DEPRECATED AND NO LONGER USED BY CASACORE NOR
00074         // CASA. THESE METHODS WILL BE REMOVED IN THE NEAR FUTURE. PLEASE MODIFY EXISTING
00075         // CODE WHICH USES THEM. CURRENT STATISTIC CLASSES MAY BE FOUND IN scimath/Mathematics.
00076 
00077    // in this version we maintain a running mean and variance to avoid catastrophic round-off
00078    // issues that can happen in some cases, CAS-2226. Removing old versions in which these
00079         // quantities were not accumulated - dmehring 2011mar01
00080 
00081    static void accumulate (
00082                 Double& nPts, Double& sum,
00083                 Double& mean, Double& nvariance, Double& variance,
00084                 Double& sumSq, Float& dataMin,
00085                 Float& dataMax, Int& minPos,
00086                 Int& maxPos, Bool& minMaxInit,
00087                 const Bool fixedMinMax, const Float datum,
00088                 const uInt& pos, const Float useIt
00089         );
00090 
00091    static void accumulate (DComplex& nPts, DComplex& sum,
00092                                                    DComplex& mean, DComplex& nvariance,DComplex& variance,
00093                            DComplex& sumSq, Complex& dataMin,
00094                            Complex& dataMax, const Int& minPos,
00095                            const Int& maxPos, Bool& minMaxInit,
00096                            const Bool fixedMinMax, const Complex datum,
00097                            const uInt& pos, const Complex useIt);
00098 
00099    static Bool hasSomePoints (Double npts);
00100    static Bool hasSomePoints (DComplex npts);
00101 //
00102    static void setUseItTrue (Float& useIt);
00103    static void setUseItTrue (Complex& useIt);
00104 //
00105    static Float usePixelInc (Float dMin, Float dMax, Float datum);
00106    static Complex usePixelInc (Complex dMin, Complex dMax, Complex datum);
00107 //
00108    static Float usePixelExc (Float dMin, Float dMax, Float datum);
00109    static Complex usePixelExc (Complex dMin, Complex dMax, Complex datum);
00110 //
00111    static Double getMean (Double sum, Double n);
00112    static DComplex getMean (DComplex sum, DComplex n);
00113 //
00114    static Double getVariance (Double sum, Double sumsq, Double n);
00115    static DComplex getVariance (DComplex sum, DComplex sumsq, DComplex n);
00116 //
00117    static Double getSigma (Double sum, Double sumsq, Double n);
00118    static DComplex getSigma (DComplex sum, DComplex sumsq, DComplex n);
00119 //
00120    static Double getSigma (Double var);
00121    static DComplex getSigma (DComplex var);
00122 //
00123    static Double getRms (Double sumsq, Double n);
00124    static DComplex getRms (DComplex sumsq, DComplex n);
00125 //
00126    static Float min(Float v1, Float v2);
00127    static Complex min(Complex v1, Complex v2);
00128 //
00129    static Float max(Float v1, Float v2);
00130    static Complex max(Complex v1, Complex v2);
00131 //
00132    static Float getNodeScalarValue(const LatticeExprNode& node, Float);
00133    static Complex getNodeScalarValue(const LatticeExprNode& node, Complex);
00134 //
00135    static Bool setIncludeExclude (String& errorMessage,
00136                                   Vector<Float>& range,
00137                                   Bool& noInclude, Bool& noExclude,
00138                                   const Vector<Float>& include,  
00139                                   const Vector<Float>& exclude);
00140    static Bool setIncludeExclude (String& errorMessage,
00141                                   Vector<Complex>& range,
00142                                   Bool& noInclude, Bool& noExclude,
00143                                   const Vector<Complex>& include,  
00144                                   const Vector<Complex>& exclude);
00145 //
00146    static Bool minMax (Float& dataMin, Float& dataMax, const MaskedLattice<Float>* pLattice,
00147                        const Vector<Float>& range, Bool noInclude, Bool noExclude);
00148    static Bool minMax (Complex& dataMin, Complex& dataMax, const MaskedLattice<Complex>* pLattice,
00149                        const Vector<Complex>& range, Bool noInclude, Bool noExclude);
00150 };
00151 
00152 
00153 } //# NAMESPACE CASACORE - END
00154 
00155 #endif
00156 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1