casacore
Loading...
Searching...
No Matches
casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator > Class Template Reference

Class to calculate statistics using the so-called Chauvenet criterion. More...

#include <ChauvenetCriterionStatistics.h>

Public Member Functions

 ChauvenetCriterionStatistics ()=delete
 ChauvenetCriterionStatistics (Double zscore=-1, Int maxIterations=0)
 If zscore is not negative, use that value to discard outliers beyond zscore standard deviations from the mean, and compute statistics based on the remaining data.
 ChauvenetCriterionStatistics (const ChauvenetCriterionStatistics< CASA_STATP > &other)
virtual ~ChauvenetCriterionStatistics ()
ChauvenetCriterionStatistics< CASA_STATP > & operator= (const ChauvenetCriterionStatistics< CASA_STATP > &other)
 copy semantics
virtual StatisticsAlgorithm< CASA_STATP > * clone () const
 Clone this instance.
virtual StatisticsData::ALGORITHM algorithm () const
 get the algorithm that this object uses for computing stats
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 thrown if c is True.
uInt getNiter () const
 get the number of iterations
Public Member Functions inherited from casacore::ConstrainedRangeStatistics< CASA_STATP >
 ConstrainedRangeStatistics ()=delete
virtual ~ConstrainedRangeStatistics ()
virtual CASA_STATP getMedian (std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< CASA_STATP > knownMin=nullptr, std::shared_ptr< CASA_STATP > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
 In the following group of methods, if the size of the composite dataset is smaller than binningThreshholdSizeBytes, the composite dataset will be (perhaps partially) sorted and persisted in memory during the call.
virtual CASA_STATP getMedianAbsDevMed (std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< CASA_STATP > knownMin=nullptr, std::shared_ptr< CASA_STATP > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
 get the median of the absolute deviation about the median of the data.
virtual CASA_STATP getMedianAndQuantiles (std::map< Double, CASA_STATP > &quantileToValue, const std::set< Double > &quantiles, std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< CASA_STATP > knownMin=nullptr, std::shared_ptr< CASA_STATP > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
 If one needs to compute both the median and quantile values, it is better to call getMedianAndQuantiles() rather than getMedian() and getQuantiles() separately, as the first will scan large data sets fewer times than calling the seperate methods.
virtual std::map< Double, CASA_STATPgetQuantiles (const std::set< Double > &quantiles, std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< CASA_STATP > knownMin=nullptr, std::shared_ptr< CASA_STATP > knownMax=NULL, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
 Get the specified quantiles.
virtual void getMinMax (CASA_STATP &mymin, CASA_STATP &mymax)
 get the min and max of the data set
virtual uInt64 getNPts ()
 scan the dataset(s) that have been added, and find the number of good points.
virtual LocationType getStatisticIndex (StatisticsData::STATS stat)
 see base class description
Public Member Functions inherited from casacore::ClassicalStatistics< CASA_STATP >
 ClassicalStatistics ()
virtual ~ClassicalStatistics ()
ClassicalStatisticsoperator= (const ClassicalStatistics &other)
 copy semantics
virtual void getMinMaxNpts (uInt64 &npts, CASA_STATP &mymin, CASA_STATP &mymax)
virtual void setDataProvider (StatsDataProvider< CASA_STATP > *dataProvider)
 An exception will be thrown if setCalculateAsAdded(True) has been called.
void setQuantileComputer (std::shared_ptr< ClassicalQuantileComputer< CASA_STATP > > qc)
 Allow derived objects to set the quantile computer object.
virtual void setStatsToCalculate (std::set< StatisticsData::STATS > &stats)
 Provide guidance to algorithms by specifying a priori which statistics the caller would like calculated.
Public Member Functions inherited from casacore::StatisticsAlgorithm< CASA_STATP >
virtual ~StatisticsAlgorithm ()
void addData (const DataIterator &first, uInt nr, uInt dataStride=1, Bool nrAccountsForStride=False)
 Add a dataset to an existing set of datasets on which statistics are to be calculated.
CASA_STATP getQuantile (Double quantile, std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< CASA_STATP > knownMin=nullptr, std::shared_ptr< CASA_STATP > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
 Purposefully not virtual.
CASA_STATP getStatistic (StatisticsData::STATS stat)
 get the value of the specified statistic.
StatsData< CASA_STATPgetStatistics ()
 Return statistics.
void setData (const DataIterator &first, uInt nr, uInt dataStride=1, Bool nrAccountsForStride=False)
 setdata() clears any current datasets or data provider and then adds the specified data set as the first dataset in the (possibly new) set of data sets for which statistics are to be calculated.

Private Member Functions

void _setRange ()

Private Attributes

Double _zscore
Int _maxIterations
Bool _rangeIsSet
uInt _niter

Additional Inherited Members

Protected Member Functions inherited from casacore::ConstrainedRangeStatistics< CASA_STATP >
ConstrainedRangeStatistics< CASA_STATP > & operator= (const ConstrainedRangeStatistics< CASA_STATP > &other)
 copy semantics
virtual void _accumNpts (uInt64 &npts, const DataIterator &dataStart, uInt64 nr, uInt dataStride) const
 scan through the data set to determine the number of good (unmasked, weight > 0, within range) points.
virtual CASA_STATP _getStatistic (StatisticsData::STATS stat)
virtual StatsData< CASA_STATP_getStatistics ()
virtual void _minMax (std::shared_ptr< CASA_STATP > &mymin, std::shared_ptr< CASA_STATP > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
virtual void _minMaxNpts (uInt64 &npts, std::shared_ptr< CASA_STATP > &mymin, std::shared_ptr< CASA_STATP > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
 Sometimes we want the min, max, and npts all in one scan.
void _setRange (std::shared_ptr< std::pair< CASA_STATP, CASA_STATP > > r)
 This method is purposefully non-virtual.
virtual void _unweightedStats (StatsData< CASA_STATP > &stats, uInt64 &ngood, LocationType &location, const DataIterator &dataBegin, uInt64 nr, uInt dataStride)
 no weights, no mask, no ranges
virtual void _weightedStats (StatsData< CASA_STATP > &stats, LocationType &location, const DataIterator &dataBegin, const DataIterator &weightsBegin, uInt64 nr, uInt dataStride)
 has weights, but no mask, no ranges
Protected Member Functions inherited from casacore::ClassicalStatistics< CASA_STATP >
void _accumulate (StatsData< CASA_STATP > &stats, const CASA_STATP &datum, const LocationType &location)
void _addData ()
 Allows derived classes to do things after data is set or added.
void _clearStats ()
Bool _getDoMaxMin () const
virtual StatsData< CASA_STATP_getInitialStats () const
virtual StatsData< CASA_STATP > & _getStatsData ()
 Retrieve stats structure.
std::shared_ptr< StatisticsAlgorithmQuantileComputer< CASA_STATP > > _getQuantileComputer ()
virtual void _updateDataProviderMaxMin (const StatsData< CASA_STATP > &threadStats)
Protected Member Functions inherited from casacore::StatisticsAlgorithm< CASA_STATP >
 StatisticsAlgorithm ()
StatisticsAlgorithmoperator= (const StatisticsAlgorithm &other)
 use copy semantics, except for the data provider which uses reference semantics
const StatisticsDataset< CASA_STATP > & _getDataset () const
 These methods are purposefully not virtual.
const std::set< StatisticsData::STATS_getStatsToCalculate () const
virtual const std::set< StatisticsData::STATS > & _getUnsupportedStatistics () const
void _setUnsupportedStatistics (const std::set< StatisticsData::STATS > &stats)
 Derived classes should normally call this in their constructors, if applicable.

Detailed Description

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>
class casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >

Class to calculate statistics using the so-called Chauvenet criterion.

This method iteratively calculates statistics by discarding outliers on the basis of Chauvenet's criterion, until the specified maximum number of iterations is reached, or the final iteration results in no additional points being discarded. Alternatively, one can specify a z-score which indicates the number of standard deviations beyond which to discard points, which is held fixed while iterating.

When instantiated, objects of this class use a ConstrainedRangeQuantileComputer object for computing quantile-like statistics. See class documentation for StatisticsAlgorithm for details of QuantileComputer classes.

Definition at line 55 of file ChauvenetCriterionStatistics.h.

Constructor & Destructor Documentation

◆ ChauvenetCriterionStatistics() [1/3]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>
casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::ChauvenetCriterionStatistics ( )
delete

◆ ChauvenetCriterionStatistics() [2/3]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>
casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::ChauvenetCriterionStatistics ( Double zscore = -1,
Int maxIterations = 0 )

If zscore is not negative, use that value to discard outliers beyond zscore standard deviations from the mean, and compute statistics based on the remaining data.

If zscore is negative, use Chauvenet's Criterion to determine which outliers to discard. maxIterations is the maximum number of iterations to use before stopping. If negative, continue iterating until the set zscore or Chauvenet's criterion is met (ie that there are no remaining outliers).

◆ ChauvenetCriterionStatistics() [3/3]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>
casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::ChauvenetCriterionStatistics ( const ChauvenetCriterionStatistics< CASA_STATP > & other)

◆ ~ChauvenetCriterionStatistics()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>
virtual casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::~ChauvenetCriterionStatistics ( )
virtual

Member Function Documentation

◆ _setRange()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>
void casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_setRange ( )
private

◆ algorithm()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>
virtual StatisticsData::ALGORITHM casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::algorithm ( ) const
inlinevirtual

get the algorithm that this object uses for computing stats

Reimplemented from casacore::ClassicalStatistics< CASA_STATP >.

Definition at line 85 of file ChauvenetCriterionStatistics.h.

References casacore::StatisticsData::CHAUVENETCRITERION.

◆ clone()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>
virtual StatisticsAlgorithm< CASA_STATP > * casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::clone ( ) const
virtual

Clone this instance.

Reimplemented from casacore::ClassicalStatistics< CASA_STATP >.

◆ getNiter()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>
uInt casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::getNiter ( ) const
inline

get the number of iterations

Definition at line 99 of file ChauvenetCriterionStatistics.h.

References _niter.

◆ operator=()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>
ChauvenetCriterionStatistics< CASA_STATP > & casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::operator= ( const ChauvenetCriterionStatistics< CASA_STATP > & other)

copy semantics

References ChauvenetCriterionStatistics().

◆ reset()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>
virtual void casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::reset ( )
virtual

reset object to initial state.

Clears all private fields including data, accumulators, global range. It does not affect the fence factor (_f), which was set at object construction.

Reimplemented from casacore::ConstrainedRangeStatistics< CASA_STATP >.

◆ setCalculateAsAdded()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>
void casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::setCalculateAsAdded ( Bool c)
virtual

This class does not allow statistics to be calculated as datasets are added, so an exception will be thrown if c is True.

Reimplemented from casacore::ClassicalStatistics< CASA_STATP >.

Member Data Documentation

◆ _maxIterations

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>
Int casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_maxIterations
private

Definition at line 104 of file ChauvenetCriterionStatistics.h.

◆ _niter

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>
uInt casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_niter
private

Definition at line 106 of file ChauvenetCriterionStatistics.h.

Referenced by getNiter().

◆ _rangeIsSet

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>
Bool casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_rangeIsSet
private

Definition at line 105 of file ChauvenetCriterionStatistics.h.

◆ _zscore

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>
Double casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_zscore
private

Definition at line 103 of file ChauvenetCriterionStatistics.h.


The documentation for this class was generated from the following file: