LatticeStatsBase.h

Go to the documentation of this file.
00001 //# LatticeStatsBase.h: base class for LatticeStatistics class
00002 //# Copyright (C) 1996,1999,2000,2001
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_LATTICESTATSBASE_H
00029 #define LATTICES_LATTICESTATSBASE_H
00030 
00031 #include <casacore/casa/aips.h>
00032 #include <casacore/casa/Arrays/Vector.h>
00033 #include <casacore/casa/BasicSL/String.h>
00034 
00035 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00036 
00037 class IPosition;
00038 class Regex;
00039 
00040 // <summary> Base class for LatticeStatistics class</summary>
00041 // <use visibility=export>
00042 // 
00043 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00044 // </reviewed>
00045 // 
00046 // <prerequisite>
00047 //   <li> Vector
00048 //   <li> String
00049 // </prerequisite>
00050 //
00051 // <etymology>
00052 // A simple base class for the <linkto class="LatticeStatistics">LatticeStatistics</linkto> class
00053 // </etymology>
00054 //
00055 // <synopsis>
00056 // This base class provides an <src>enum</src> defining allowed statistics types 
00057 // and a helper function to convert between a <src>String</src> and a
00058 // <src>Vector<Int></src> describing the desired statistics to plot.  The reason for
00059 // having it as a base class rather than just part of LatticeStatistics is that
00060 // the latter is templated, and it doesn't make much sense to invoke the static function
00061 // <src>setStatisticTypes</src> function with a templated type.
00062 // </synopsis>
00063 //
00064 // <example>
00065 // <srcblock>
00066 //    Vector<Int> statsToPlot = LatticeStatsBase::toStatisticTypes("mean,rms,sigma");
00067 // </srcblock>
00068 // </example>
00069 //
00070 // <todo asof="yyyy/mm/dd">
00071 // </todo>
00072 
00073 
00074 class LatticeStatsBase
00075 {
00076 public:
00077 
00078 // This <src>enum StatisticTypes</src> is provided for use with the
00079 // <src>LatticeStatistics<T>\::setPlotting</src> function.  It gives the allowed 
00080 // statistics types that you can ask for.
00081    
00082 enum StatisticsTypes {
00083  
00084 // The number of points
00085    NPTS,
00086 
00087 // The sum
00088    SUM,
00089 
00090 // The sum squared
00091    SUMSQ,
00092 
00093 // The median - the robust stats does not fit well into storage lattice approach
00094    MEDIAN,
00095 
00096 // median of absolute deviation from median
00097    MEDABSDEVMED,
00098 
00099 // inter-quartile range
00100    QUARTILE, 
00101 
00102    // The first and third quartiles
00103    Q1,
00104    Q3,
00105 
00106 // The minimum
00107    MIN,
00108 
00109 // The maximum
00110    MAX,
00111 
00112 // The mean
00113    MEAN,
00114 
00115 // The variance about the mean
00116    VARIANCE,
00117 
00118 // The standard deviation about the mean
00119    SIGMA,
00120 
00121 // The rms
00122    RMS,
00123 
00124 // The flux density (can't always compute this - needs the beam)
00125    FLUX,
00126 
00127 // The total number of available statistics to plot
00128    NSTATS,
00129 
00130 // The total number of accumulation image items (not for general use:
00131 // note that the accumulation items MUST come first in this enum)
00132    NACCUM = VARIANCE+1
00133 };
00134 
00135 // Helper function to convert a String containing a list of desired statistics to
00136 // the correct Vector<Int> required for the LatticeStatistics<T>::setPlotting
00137 // function.  This may be usful if your user interface involves strings rather than integers.
00138 // A new value is added to the output vector (which is resized appropriately) if any of the
00139 // substrings "npts", "min", "max", "sum", "sumsq", "mean", "sigma", "rms", 
00140 // and "flux" is present.  An empty vector results if there are no matches
00141 // <group>
00142    static Vector<Int> toStatisticTypes (const String& statistics, 
00143                                         const Regex& delimiter);
00144    static Vector<Int> toStatisticTypes (const Vector<String>& statistics);
00145 // </group>
00146 
00147 // Convert type to string.
00148 // <group>
00149    static String toStatisticName (StatisticsTypes type);
00150    static String toStatisticName (Int type);
00151 // </group>
00152 
00153 // Returns -1 if the statistic string is not valid
00154    static Int toStatisticType (const String& statistic);
00155 
00156 // Check and fill in defaults for a <src>Vector<Int></src> containing the 
00157 // number of subplots in x and y to be put on a plot.  The <src>Vector<Int></src> 
00158 // is resized to 2 before assignment.  A return value of <src>False</src> indicates 
00159 // invalid arguments.
00160    static Bool setNxy (Vector<Int>& nxy,
00161                        ostream& os);
00162 
00163 // A storage image is used to accumulate information as a function of the display
00164 // axes as an image is iterated through.  This function sets the storage image shape 
00165 // to that appropriate to the shape of the display axes and the desired size of the first
00166 // or last dimension.  
00167    static void setStorageImageShape (IPosition& storeImageShape,
00168                                      const Bool& last,
00169                                      const Int& axisSize,
00170                                      const Vector<Int>& displayAxes,
00171                                      const IPosition& shape);
00172 
00173 // Stretch a range by 10%
00174    static void stretchMinMax (Float& min, Float& max);
00175 };
00176 
00177 
00178 } //# NAMESPACE CASACORE - END
00179 
00180 #endif
00181 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1