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 //# $Id: Array.h 21545 2015-01-22 19:36:35Z gervandiepen $
26 
27 #ifndef SCIMATH_CHAUVENETCRITERIONSTATISTICS_H
28 #define SCIMATH_CHAUVENETCRITERIONSTATISTICS_H
29 
30 #include <casacore/casa/aips.h>
31 
32 #include <casacore/scimath/Mathematics/ConstrainedRangeStatistics.h>
33 
34 #include <set>
35 #include <vector>
36 #include <utility>
37 
38 namespace casacore {
39 
40 // Class to calculate statistics using the so-called Chauvenet criterion. This method
41 // iteratively calculates statistics by discarding outliers on the basis of Chauvenet's
42 // criterion, until the specified maximum number of iterations is reached, or the final
43 // iteration results in no additional points being discarded.
44 // Alternatively, one can specify a z score which indicates the number of standard deviations
45 // beyond which to discard points, which is held fixed while iterating.
46 
47 template <class AccumType, class DataIterator, class MaskIterator=const Bool*, class WeightsIterator=DataIterator>
49  : public ConstrainedRangeStatistics<CASA_STATP> {
50 public:
51 
52  // If <src>zscore</src> is not negative, use that value to discard outliers beyond
53  // zscore standard deviations from the mean, and compute statistics based on the
54  // remaining data. If <src>zscore</src> is negative, use Chauvenet's Criterion to
55  // determine which outliers to discard. <src>maxIterations</src> is the maximum
56  // number of iterations to use before stopping. If negative, continue iterating until the
57  // set zscore or Chauvenet's criterion is met (ie that there are no remaining outliers).
58  ChauvenetCriterionStatistics(Double zscore=-1, Int maxIterations=0);
59 
61 
62  // copy semantics
65  );
66 
67  // get the algorithm that this object uses for computing stats
70  };
71 
72  // reset object to initial state. Clears all private fields including data,
73  // accumulators, global range. It does not affect the fence factor (_f), which was
74  // set at object construction.
75  virtual void reset();
76 
77  // This class does not allow statistics to be calculated as datasets are added, so
78  // an exception will be thrown if <src>c</src> is True.
80 
81  // get the number of iterations
82  uInt getNiter() const { return _niter; }
83 
84 private:
85 
90 
91  void _setRange();
92 };
93 
94 }
95 
96 #ifndef CASACORE_NO_AUTO_TEMPLATES
97 #include <casacore/scimath/Mathematics/ChauvenetCriterionStatistics.tcc>
98 #endif //# CASACORE_NO_AUTO_TEMPLATES
99 
100 #endif
int Int
Definition: aipstype.h:50
ChauvenetCriterionStatistics(Double zscore=-1, Int maxIterations=0)
If zscore is not negative, use that value to discard outliers beyond zscore standard deviations from ...
uInt getNiter() const
get the number of iterations
ALGORITHM
implemented algorithms
double Double
Definition: aipstype.h:55
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Abstract base class for statistics algorithms which are characterized by a range of good values...
ChauvenetCriterionStatistics< CASA_STATP > & operator=(const ChauvenetCriterionStatistics< CASA_STATP > &other)
copy semantics
virtual StatisticsData::ALGORITHM algorithm() const
get the algorithm that this object uses for computing stats
const Double c
Fundamental physical constants (SI units):
void setCalculateAsAdded(Bool c)
This class does not allow statistics to be calculated as datasets are added, so an exception will be ...
virtual void reset()
reset object to initial state.
Class to calculate statistics using the so-called Chauvenet criterion.
this file contains all the compiler specific defines
Definition: mainpage.dox:28
unsigned int uInt
Definition: aipstype.h:51