casacore
ClassicalStatistics.h
Go to the documentation of this file.
1 //# Copyright (C) 2000,2001
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 
26 #ifndef SCIMATH_CLASSICALSTATISTICSS_H
27 #define SCIMATH_CLASSICALSTATISTICSS_H
28 
29 #include <casacore/casa/aips.h>
30 
31 #include <casacore/scimath/StatsFramework/StatisticsAlgorithm.h>
32 
33 #include <casacore/scimath/StatsFramework/ClassicalQuantileComputer.h>
34 #include <casacore/scimath/StatsFramework/StatisticsTypes.h>
35 #include <casacore/scimath/StatsFramework/StatisticsUtilities.h>
36 #include <set>
37 #include <vector>
38 #include <utility>
39 
40 namespace casacore {
41 
42 template <class T> class PtrHolder;
43 
44 // Class to calculate statistics in a "classical" sense, ie using accumulators
45 // with no special filtering beyond optional range filtering etc.
46 //
47 // setCalculateAsAdded() allows one to specify if statistics should be
48 // calculated and updated on upon each call to set/addData(). If False,
49 // statistics will be calculated only when getStatistic(), getStatistics(), or
50 // similar statistics computing methods are called. Setting this value to True
51 // allows the caller to not have to keep all the data accessible at once. Note
52 // however, that all data must be simultaneously accessible if quantile-like
53 // (eg median) calculations are desired.
54 //
55 // Objects of this class are instantiated using a ClassicalQuantileComputer
56 // object for computation of quantile-like statistics. See the documentation
57 // of StatisticsAlgorithm for details relating QuantileComputer classes.
58 
59 template <
60  class AccumType, class DataIterator, class MaskIterator=const Bool*,
61  class WeightsIterator=DataIterator
62 >
64  : public StatisticsAlgorithm<CASA_STATP> {
65 
67 
68 public:
69 
71 
72  // copy semantics
74 
76 
77  // copy semantics
79 
80  // Clone this instance
82 
83  // get the algorithm that this object uses for computing stats
86  };
87 
88  // <group>
89  // In the following group of methods, if the size of the composite dataset
90  // is smaller than <src>binningThreshholdSizeBytes</src>, the composite
91  // dataset will be (perhaps partially) sorted and persisted in memory during
92  // the call. In that case, and if <src>persistSortedArray</src> is True,
93  // this sorted array will remain in memory after the call and will be used
94  // on subsequent calls of this method when
95  // <src>binningThreshholdSizeBytes</src> is greater than the size of the
96  // composite dataset. If <src>persistSortedArray</src> is False, the sorted
97  // array will not be stored after this call completes and so any subsequent
98  // calls for which the dataset size is less than
99  // <src>binningThreshholdSizeBytes</src>, the dataset will be sorted from
100  // scratch. Values which are not included due to non-unity strides, are not
101  // included in any specified ranges, are masked, or have associated weights
102  // of zero are not considered as dataset members for quantile computations.
103  // If one has a priori information regarding the number of points (npts)
104  // and/or the minimum and maximum values of the data set, these can be
105  // supplied to improve performance. Note however, that if these values are
106  // not correct, the resulting median and/or quantile values will also not be
107  // correct (although see the following notes regarding max/min). Note that
108  // if this object has already had getStatistics() called, and the min and
109  // max were calculated, there is no need to pass these values in as they
110  // have been stored internally and used (although passing them in shouldn't
111  // hurt anything). If provided, npts, the number of points falling in the
112  // specified ranges which are not masked and have weights > 0, should be
113  // exactly correct. <src>min</src> can be less than the true minimum, and
114  // <src>max</src> can be greater than the True maximum, but for best
115  // performance, these should be as close to the actual min and max as
116  // possible. In order for quantile computations to occur over multiple
117  // datasets, all datasets must be available. This means that if
118  // setCalculateAsAdded() was previously called by passing in a value of
119  // True, these methods will throw an exception as the previous call
120  // indicate