casacore
ChauvenetCriterionStatistics.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_CHAUVENETCRITERIONSTATISTICS_H
27 #define SCIMATH_CHAUVENETCRITERIONSTATISTICS_H
28 
29 #include <casacore/casa/aips.h>
30 
31 #include <casacore/scimath/StatsFramework/ConstrainedRangeStatistics.h>
32 
33 #include <set>
34 #include <utility>
35 
36 namespace casacore {
37 
38 // Class to calculate statistics using the so-called Chauvenet criterion. This
39 // method iteratively calculates statistics by discarding outliers on the basis
40 // of Chauvenet's criterion, until the specified maximum number of iterations is
41 // reached, or the final iteration results in no additional points being
42 // discarded. Alternatively, one can specify a z-score which indicates the
43 // number of standard deviations beyond which to discard points, which is held
44 // fixed while iterating.
45 //
46 // When instantiated, objects of this class use a
47 // ConstrainedRangeQuantileComputer object for computing quantile-like
48 // statistics. See class documentation for StatisticsAlgorithm for details of
49 // QuantileComputer classes.
50 
51 template <
52  class AccumType, class DataIterator, class MaskIterator=const Bool*,
53  class WeightsIterator=DataIterator
54 >
56  : public ConstrainedRangeStatistics<CASA_STATP> {
57 public:
58 
60 
61  // If <src>zscore</src> is not negative, use that value to discard outliers
62  // beyond zscore standard deviations from the mean, and compute statistics
63  // based on the remaining data. If <src>zscore</src> is negative, use
64  // Chauvenet's Criterion to determine which outliers to discard.
65  // <src>maxIterations</src> is the maximum number of iterations to use
66  // before stopping. If negative, continue iterating until the set zscore or
67  // Chauvenet's criterion is met (ie that there are no remaining outliers).
68  ChauvenetCriterionStatistics(Double zscore=-1, Int maxIterations=0);
69 
72  );
73 
75 
76  // copy semantics
79  );
80 
81  // Clone this instance
83 
84  // get the algorithm that this object uses for computing stats
87  };
88 
89  // reset object to initial state. Clears all private fields including data,
90  // accumulators, global range. It does not affect the fence factor (_f),
91  // which was set at object construction.
92  virtual void reset();
93 
94  // This class does not allow statistics to be calculated as datasets are
95  // added, so an exception will be thrown if <src>c</src> is True.
97 
98  // get the number of iterations
99  uInt getNiter() const { return _niter; }
100 
101 private:
102 
107 
108  void _setRange();
109 };
110 
111 }
112 
113 #ifndef CASACORE_NO_AUTO_TEMPLATES
114 #include <casacore/scimath/StatsFramework/ChauvenetCriterionStatistics.tcc>
115 #endif
116 
117 #endif
Class to calculate statistics using the so-called Chauvenet criterion.
ChauvenetCriterionStatistics< CASA_STATP > & operator=(const ChauvenetCriterionStatistics< CASA_STATP > &other)
copy semantics
ChauvenetCriterionStatistics(const ChauvenetCriterionStatistics< CASA_STATP > &other)
uInt getNiter() const
get the number of iterations
ChauvenetCriterionStatistics(Double zscore=-1, Int maxIterations=0)
If zscore is not negative, use that value to discard outliers beyond zscore standard deviations from ...
virtual void reset()
reset object to initial state.
void setCalculateAsAdded(Bool c)
This class does not allow statistics to be calculated as datasets are added, so an exception will be ...
virtual StatisticsData::ALGORITHM algorithm() const
get the algorithm that this object uses for computing stats
virtual StatisticsAlgorithm< CASA_STATP > * clone() const
Clone this instance.
void _setRange()
derived classes need to implement how to set their respective range
Abstract base class for statistics algorithms which are characterized by a range of good values.
ALGORITHM
implemented algorithms
const Double c
Fundamental physical constants (SI units):
this file contains all the compiler specific defines
Definition: mainpage.dox:28
const Bool False
Definition: aipstype.h:44
unsigned int uInt
Definition: aipstype.h:51
int Int
Definition: aipstype.h:50
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
double Double
Definition: aipstype.h:55