Abstract base class for statistics algorithms which are characterized by a range of good values. More...
#include <ConstrainedRangeStatistics.h>
Public Member Functions | |
virtual | ~ConstrainedRangeStatistics () |
ConstrainedRangeStatistics < CASA_STATP > & | operator= (const ConstrainedRangeStatistics< CASA_STATP > &other) |
copy semantics | |
AccumType | getMedian (CountedPtr< uInt64 > knownNpts=NULL, CountedPtr< AccumType > knownMin=NULL, CountedPtr< AccumType > knownMax=NULL, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt64 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. | |
AccumType | getMedianAbsDevMed (CountedPtr< uInt64 > knownNpts=NULL, CountedPtr< AccumType > knownMin=NULL, CountedPtr< AccumType > knownMax=NULL, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt64 nBins=10000) |
get the median of the absolute deviation about the median of the data. | |
AccumType | getMedianAndQuantiles (std::map< Double, AccumType > &quantileToValue, const std::set< Double > &quantiles, CountedPtr< uInt64 > knownNpts=NULL, CountedPtr< AccumType > knownMin=NULL, CountedPtr< AccumType > knownMax=NULL, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt64 nBins=10000) |
If one needs to compute both the median and quantile values, it is better to call getMedianAndQuantiles() rather than getMedian() and getQuantiles() seperately, as the first will scan large data sets fewer times than calling the seperate methods. | |
std::map< Double, AccumType > | getQuantiles (const std::set< Double > &quantiles, CountedPtr< uInt64 > knownNpts=NULL, CountedPtr< AccumType > knownMin=NULL, CountedPtr< AccumType > knownMax=NULL, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt64 nBins=10000) |
Get the specified quantiles. | |
virtual void | getMinMax (AccumType &mymin, AccumType &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. | |
std::pair< Int64, Int64 > | getStatisticIndex (StatisticsData::STATS stat) |
see base class description | |
virtual void | reset () |
reset object to initial state. | |
Protected Member Functions | |
ConstrainedRangeStatistics () | |
void | _accumNpts (uInt64 &npts, const DataIterator &dataStart, Int64 nr, uInt dataStride) const |
scan through the data set to determine the number of good (unmasked, weight > 0, within range) points. | |
void | _accumNpts (uInt64 &npts, const DataIterator &dataStart, Int64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const |
void | _accumNpts (uInt64 &npts, const DataIterator &dataBegin, Int64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const |
void | _accumNpts (uInt64 &npts, const DataIterator &dataBegin, Int64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const |
void | _accumNpts (uInt64 &npts, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, Int64 nr, uInt dataStride) const |
void | _accumNpts (uInt64 &npts, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, Int64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const |
void | _accumNpts (uInt64 &npts, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, Int64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const |
void | _accumNpts (uInt64 &npts, const DataIterator &dataBegin, const WeightsIterator &weightBegin, Int64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const |
virtual void | _findBins (vector< vector< uInt64 > > &binCounts, vector< CountedPtr< AccumType > > &sameVal, vector< Bool > &allSame, const DataIterator &dataBegin, Int64 nr, uInt dataStride, const vector< typename StatisticsUtilities< AccumType >::BinDesc > &binDesc, const vector< AccumType > &maxLimit) const |
virtual void | _findBins (vector< vector< uInt64 > > &binCounts, vector< CountedPtr< AccumType > > &sameVal, vector< Bool > &allSame, const DataIterator &dataBegin, Int64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude, const vector< typename StatisticsUtilities< AccumType >::BinDesc > &binDesc, const vector< AccumType > &maxLimit) const |
virtual void | _findBins (vector< vector< uInt64 > > &binCounts, vector< CountedPtr< AccumType > > &sameVal, vector< Bool > &allSame, const DataIterator &dataBegin, Int64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const vector< typename StatisticsUtilities< AccumType >::BinDesc > &binDesc, const vector< AccumType > &maxLimit) const |
virtual void | _findBins (vector< vector< uInt64 > > &binCounts, vector< CountedPtr< AccumType > > &sameVal, vector< Bool > &allSame, const DataIterator &dataBegin, Int64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude, const vector< typename StatisticsUtilities< AccumType >::BinDesc > &binDesc, const vector< AccumType > &maxLimit) const |
virtual void | _findBins (vector< vector< uInt64 > > &binCounts, vector< CountedPtr< AccumType > > &sameVal, vector< Bool > &allSame, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, Int64 nr, uInt dataStride, const vector< typename StatisticsUtilities< AccumType >::BinDesc > &binDesc, const vector< AccumType > &maxLimit) const |
virtual void | _findBins (vector< vector< uInt64 > > &binCounts, vector< CountedPtr< AccumType > > &sameVal, vector< Bool > &allSame, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, Int64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude, const vector< typename StatisticsUtilities< AccumType >::BinDesc > &binDesc, const vector< AccumType > &maxLimit) const |
virtual void | _findBins (vector< vector< uInt64 > > &binCounts, vector< CountedPtr< AccumType > > &sameVal, vector< Bool > &allSame, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, Int64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude, const vector< typename StatisticsUtilities< AccumType >::BinDesc > &binDesc, const vector< AccumType > &maxLimit) const |
virtual void | _findBins (vector< vector< uInt64 > > &binCounts, vector< CountedPtr< AccumType > > &sameVal, vector< Bool > &allSame, const DataIterator &dataBegin, const WeightsIterator &weightBegin, Int64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const vector< typename StatisticsUtilities< AccumType >::BinDesc > &binDesc, const vector< AccumType > &maxLimit) const |
Abstract base class for statistics algorithms which are characterized by a range of good values.
The range is usually calculated dynamically based on the entire distribution.
Definition at line 44 of file ConstrainedRangeStatistics.h.
virtual casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::~ConstrainedRangeStatistics | ( | ) | [virtual] |
casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::ConstrainedRangeStatistics | ( | ) | [protected] |
void casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_accumNpts | ( | uInt64 & | npts, | |
const DataIterator & | dataBegin, | |||
const WeightsIterator & | weightBegin, | |||
Int64 | nr, | |||
uInt | dataStride, | |||
const MaskIterator & | maskBegin, | |||
uInt | maskStride | |||
) | const [protected] |
void casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_accumNpts | ( | uInt64 & | npts, | |
const DataIterator & | dataBegin, | |||
const WeightsIterator & | weightsBegin, | |||
Int64 | nr, | |||
uInt | dataStride, | |||
const MaskIterator & | maskBegin, | |||
uInt | maskStride, | |||
const DataRanges & | ranges, | |||
Bool | isInclude | |||
) | const [protected] |
void casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_accumNpts | ( | uInt64 & | npts, | |
const DataIterator & | dataBegin, | |||
const WeightsIterator & | weightsBegin, | |||
Int64 | nr, | |||
uInt | dataStride, | |||
const DataRanges & | ranges, | |||
Bool | isInclude | |||
) | const [protected] |
void casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_accumNpts | ( | uInt64 & | npts, | |
const DataIterator & | dataBegin, | |||
const WeightsIterator & | weightsBegin, | |||
Int64 | nr, | |||
uInt | dataStride | |||
) | const [protected] |
void casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_accumNpts | ( | uInt64 & | npts, | |
const DataIterator & | dataBegin, | |||
Int64 | nr, | |||
uInt | dataStride, | |||
const MaskIterator & | maskBegin, | |||
uInt | maskStride, | |||
const DataRanges & | ranges, | |||
Bool | isInclude | |||
) | const [protected] |
void casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_accumNpts | ( | uInt64 & | npts, | |
const DataIterator & | dataBegin, | |||
Int64 | nr, | |||
uInt | dataStride, | |||
const MaskIterator & | maskBegin, | |||
uInt | maskStride | |||
) | const [protected] |
void casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_accumNpts | ( | uInt64 & | npts, | |
const DataIterator & | dataStart, | |||
Int64 | nr, | |||
uInt | dataStride, | |||
const DataRanges & | ranges, | |||
Bool | isInclude | |||
) | const [protected, virtual] |
Reimplemented from casacore::ClassicalStatistics< CASA_STATP >.
Reimplemented in casacore::HingesFencesStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >.
void casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_accumNpts | ( | uInt64 & | npts, | |
const DataIterator & | dataStart, | |||
Int64 | nr, | |||
uInt | dataStride | |||
) | const [inline, protected, virtual] |
scan through the data set to determine the number of good (unmasked, weight > 0, within range) points.
The first with no mask, no ranges, and no weights is trivial with npts = nr in this class, but is implemented here so that derived classes may override it.
Reimplemented from casacore::ClassicalStatistics< CASA_STATP >.
Reimplemented in casacore::HingesFencesStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >.
virtual void casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_findBins | ( | vector< vector< uInt64 > > & | binCounts, | |
vector< CountedPtr< AccumType > > & | sameVal, | |||
vector< Bool > & | allSame, | |||
const DataIterator & | dataBegin, | |||
const WeightsIterator & | weightBegin, | |||
Int64 | nr, | |||
uInt | dataStride, | |||
const MaskIterator & | maskBegin, | |||
uInt | maskStride, | |||
const vector< typename StatisticsUtilities< AccumType >::BinDesc > & | binDesc, | |||
const vector< AccumType > & | maxLimit | |||
) | const [protected, virtual] |
virtual void casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_findBins | ( | vector< vector< uInt64 > > & | binCounts, | |
vector< CountedPtr< AccumType > > & | sameVal, | |||
vector< Bool > & | allSame, | |||
const DataIterator & | dataBegin, | |||
const WeightsIterator & | weightsBegin, | |||
Int64 | nr, | |||
uInt | dataStride, | |||
const MaskIterator & | maskBegin, | |||
uInt | maskStride, | |||
const DataRanges & | ranges, | |||
Bool | isInclude, | |||
const vector< typename StatisticsUtilities< AccumType >::BinDesc > & | binDesc, | |||
const vector< AccumType > & | maxLimit | |||
) | const [protected, virtual] |
virtual void casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_findBins | ( | vector< vector< uInt64 > > & | binCounts, | |
vector< CountedPtr< AccumType > > & | sameVal, | |||
vector< Bool > & | allSame, | |||
const DataIterator & | dataBegin, | |||
const WeightsIterator & | weightsBegin, | |||
Int64 | nr, | |||
uInt | dataStride, | |||
const DataRanges & | ranges, | |||
Bool | isInclude, | |||
const vector< typename StatisticsUtilities< AccumType >::BinDesc > & | binDesc, | |||
const vector< AccumType > & | maxLimit | |||
) | const [protected, virtual] |
virtual void casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_findBins | ( | vector< vector< uInt64 > > & | binCounts, | |
vector< CountedPtr< AccumType > > & | sameVal, | |||
vector< Bool > & | allSame, | |||
const DataIterator & | dataBegin, | |||
const WeightsIterator & | weightsBegin, | |||
Int64 | nr, | |||
uInt | dataStride, | |||
const vector< typename StatisticsUtilities< AccumType >::BinDesc > & | binDesc, | |||
const vector< AccumType > & | maxLimit | |||
) | const [protected, virtual] |
virtual void casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_findBins | ( | vector< vector< uInt64 > > & | binCounts, | |
vector< CountedPtr< AccumType > > & | sameVal, | |||
vector< Bool > & | allSame, | |||
const DataIterator & | dataBegin, | |||
Int64 | nr, | |||
uInt | dataStride, | |||
const MaskIterator & | maskBegin, | |||
uInt | maskStride, | |||
const DataRanges & | ranges, | |||
Bool | isInclude, | |||
const vector< typename StatisticsUtilities< AccumType >::BinDesc > & | binDesc, | |||
const vector< AccumType > & | maxLimit | |||
) | const [protected, virtual] |
virtual void casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_findBins | ( | vector< vector< uInt64 > > & | binCounts, | |
vector< CountedPtr< AccumType > > & | sameVal, | |||
vector< Bool > & | allSame, | |||
const DataIterator & | dataBegin, | |||
Int64 | nr, | |||
uInt | dataStride, | |||
const MaskIterator & | maskBegin, | |||
uInt | maskStride, | |||
const vector< typename StatisticsUtilities< AccumType >::BinDesc > & | binDesc, | |||
const vector< AccumType > & | maxLimit | |||
) | const [protected, virtual] |
virtual void casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_findBins | ( | vector< vector< uInt64 > > & | binCounts, | |
vector< CountedPtr< AccumType > > & | sameVal, | |||
vector< Bool > & | allSame, | |||
const DataIterator & | dataBegin, | |||
Int64 | nr, | |||
uInt | dataStride, | |||
const DataRanges & | ranges, | |||
Bool | isInclude, | |||
const vector< typename StatisticsUtilities< AccumType >::BinDesc > & | binDesc, | |||
const vector< AccumType > & | maxLimit | |||
) | const [protected, virtual] |
virtual void casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_findBins | ( | vector< vector< uInt64 > > & | binCounts, | |
vector< CountedPtr< AccumType > > & | sameVal, | |||
vector< Bool > & | allSame, | |||
const DataIterator & | dataBegin, | |||
Int64 | nr, | |||
uInt | dataStride, | |||
const vector< typename StatisticsUtilities< AccumType >::BinDesc > & | binDesc, | |||
const vector< AccumType > & | maxLimit | |||
) | const [protected, virtual] |
AccumType casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::getMedian | ( | CountedPtr< uInt64 > | knownNpts = NULL , |
|
CountedPtr< AccumType > | knownMin = NULL , |
|||
CountedPtr< AccumType > | knownMax = NULL , |
|||
uInt | binningThreshholdSizeBytes = 4096 *4096 , |
|||
Bool | persistSortedArray = False , |
|||
uInt64 | 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.
In that case, and if persistSortedArray
is True, this sorted array will remain in memory after the call and will be used on subsequent calls of this method when binningThreshholdSizeBytes
is greater than the size of the composite dataset. If persistSortedArray
is False, the sorted array will not be stored after this call completes and so any subsequent calls for which the dataset size is less than binningThreshholdSizeBytes
, the dataset will be sorted from scratch. Values which are not included due to non-unity strides, are not included in any specified ranges, are masked, or have associated weights of zero are not considered as dataset members for quantile computations. If one has a priori information regarding the number of points (npts) and/or the minimum and maximum values of the data set, these can be supplied to improve performance. Note however, that if these values are not correct, the resulting median and/or quantile values will also not be correct (although see the following notes regarding max/min). Note that if this object has already had getStatistics() called, and the min and max were calculated, there is no need to pass these values in as they have been stored internally and used (although passing them in shouldn't hurt anything). If provided, npts, the number of points falling in the specified ranges which are not masked and have weights > 0, should be exactly correct. min
can be less than the true minimum, and max
can be greater than the True maximum, but for best performance, these should be as close to the actual min and max as possible. In order for quantile computations to occur over multiple datasets, all datasets must be available. This means that if setCalculateAsAdded() was previously called by passing in a value of True, these methods will throw an exception as the previous call indicates that there is no guarantee that all datasets will be available. If one uses a data provider (by having called setDataProvider()), then this should not be an issue.
get the median of the distribution. For a dataset with an odd number of good points, the median is just the value at index int(N/2) in the equivalent sorted dataset, where N is the number of points. For a dataset with an even number of points, the median is the mean of the values at indices int(N/2)-1 and int(N/2) in the sorted dataset.
AccumType casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::getMedianAbsDevMed | ( | CountedPtr< uInt64 > | knownNpts = NULL , |
|
CountedPtr< AccumType > | knownMin = NULL , |
|||
CountedPtr< AccumType > | knownMax = NULL , |
|||
uInt | binningThreshholdSizeBytes = 4096 *4096 , |
|||
Bool | persistSortedArray = False , |
|||
uInt64 | nBins = 10000 | |||
) |
get the median of the absolute deviation about the median of the data.
AccumType casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::getMedianAndQuantiles | ( | std::map< Double, AccumType > & | quantileToValue, | |
const std::set< Double > & | quantiles, | |||
CountedPtr< uInt64 > | knownNpts = NULL , |
|||
CountedPtr< AccumType > | knownMin = NULL , |
|||
CountedPtr< AccumType > | knownMax = NULL , |
|||
uInt | binningThreshholdSizeBytes = 4096 *4096 , |
|||
Bool | persistSortedArray = False , |
|||
uInt64 | nBins = 10000 | |||
) |
If one needs to compute both the median and quantile values, it is better to call getMedianAndQuantiles() rather than getMedian() and getQuantiles() seperately, as the first will scan large data sets fewer times than calling the seperate methods.
The return value is the median; the quantiles are returned in the quantileToValue
map.
virtual void casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::getMinMax | ( | AccumType & | mymin, | |
AccumType & | mymax | |||
) | [virtual] |
get the min and max of the data set
virtual uInt64 casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::getNPts | ( | ) | [virtual] |
scan the dataset(s) that have been added, and find the number of good points.
This method may be called even if setStatsToCaclulate has been called and NPTS has been excluded. If setCalculateAsAdded(True) has previously been called after this object has been (re)initialized, an exception will be thrown.
Reimplemented from casacore::ClassicalStatistics< CASA_STATP >.
Reimplemented in casacore::FitToHalfStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >.
std::map<Double, AccumType> casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::getQuantiles | ( | const std::set< Double > & | quantiles, | |
CountedPtr< uInt64 > | knownNpts = NULL , |
|||
CountedPtr< AccumType > | knownMin = NULL , |
|||
CountedPtr< AccumType > | knownMax = NULL , |
|||
uInt | binningThreshholdSizeBytes = 4096 *4096 , |
|||
Bool | persistSortedArray = False , |
|||
uInt64 | nBins = 10000 | |||
) |
Get the specified quantiles.
quantiles
must be between 0 and 1, noninclusive.
std::pair<Int64, Int64> casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::getStatisticIndex | ( | StatisticsData::STATS | stat | ) | [virtual] |
see base class description
Reimplemented from casacore::ClassicalStatistics< CASA_STATP >.
ConstrainedRangeStatistics<CASA_STATP>& casacore::ConstrainedRangeStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::operator= | ( | const ConstrainedRangeStatistics< CASA_STATP > & | other | ) |
copy semantics
Reimplemented in casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >, casacore::FitToHalfStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >, and casacore::HingesFencesStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >.
virtual void casacore::ConstrainedRangeStatistics< 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::ClassicalStatistics< CASA_STATP >.
Reimplemented in casacore::ChauvenetCriterionStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >, casacore::FitToHalfStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >, and casacore::HingesFencesStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >.