26 #ifndef SCIMATH_CONSTRAINEDRANGESTATISTICS_H
27 #define SCIMATH_CONSTRAINEDRANGESTATISTICS_H
29 #include <casacore/casa/aips.h>
31 #include <casacore/scimath/StatsFramework/ClassicalStatistics.h>
32 #include <casacore/scimath/StatsFramework/ConstrainedRangeQuantileComputer.h>
46 class AccumType,
class DataIterator,
class MaskIterator=
const Bool*,
47 class WeightsIterator=DataIterator
103 uInt binningThreshholdSizeBytes=4096*4096,
112 uInt binningThreshholdSizeBytes=4096*4096,
122 std::map<Double, AccumType>& quantileToValue,
123 const std::set<Double>& quantiles,
127 uInt binningThreshholdSizeBytes=4096*4096,
134 const std::set<Double>& quantiles,
138 uInt binningThreshholdSizeBytes=4096*4096,
144 virtual void getMinMax(AccumType& mymin, AccumType& mymax);
191 const DataIterator& dataStart,
uInt64 nr,
uInt dataStride,
197 const MaskIterator& maskBegin,
uInt maskStride
202 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
203 const MaskIterator& maskBegin,
uInt maskStride,
208 uInt64& npts,
const DataIterator& dataBegin,
209 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride
213 uInt64& npts,
const DataIterator& dataBegin,
214 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride,
219 uInt64& npts,
const DataIterator& dataBegin,
220 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride,
221 const MaskIterator& maskBegin,
uInt maskStride,
226 uInt64& npts,
const DataIterator& dataBegin,
227 const WeightsIterator& weightBegin,
uInt64 nr,
uInt dataStride,
228 const MaskIterator& maskBegin,
uInt maskStride
239 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride
244 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
250 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
251 const MaskIterator& maskBegin,
uInt maskStride
256 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
257 const MaskIterator& maskBegin,
uInt maskStride,
263 const DataIterator& dataBegin,
const WeightsIterator& weightsBegin,
269 const DataIterator& dataBegin,
const WeightsIterator& weightsBegin,
275 const DataIterator& dataBegin,
const WeightsIterator& weightsBegin,
276 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
282 const DataIterator& dataBegin,
const WeightsIterator& weightBegin,
283 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
305 uInt dataStride,
const MaskIterator& maskBegin,
uInt maskStride
311 uInt dataStride,
const MaskIterator& maskBegin,
uInt maskStride,
318 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride
324 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride,
331 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride,
332 const MaskIterator& maskBegin,
uInt maskStride,
339 const WeightsIterator& weightBegin,
uInt64 nr,
uInt dataStride,
340 const MaskIterator& maskBegin,
uInt maskStride
355 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride
361 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
367 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
368 const MaskIterator& maskBegin,
uInt maskStride
373 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
374 const MaskIterator& maskBegin,
uInt maskStride,
383 const DataIterator& dataBegin,
const WeightsIterator& weightsBegin,
389 const DataIterator& dataBegin,
const WeightsIterator& weightsBegin,
395 const DataIterator& dataBegin,
const WeightsIterator& weightBegin,
396 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
402 const DataIterator& dataBegin,
const WeightsIterator& weightBegin,
403 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
416 #ifndef CASACORE_NO_AUTO_TEMPLATES
417 #include <casacore/scimath/StatsFramework/ConstrainedRangeStatistics.tcc>
Class to calculate statistics in a "classical" sense, ie using accumulators with no special filtering...
Abstract base class for statistics algorithms which are characterized by a range of good values.
virtual ~ConstrainedRangeStatistics()
virtual void _weightedStats(StatsData< AccumType > &stats, LocationType &location, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride)
virtual void _accumNpts(uInt64 &npts, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
virtual LocationType getStatisticIndex(StatisticsData::STATS stat)
see base class description
virtual void _minMaxNpts(uInt64 &npts, CountedPtr< AccumType > &mymin, CountedPtr< AccumType > &mymax, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
virtual AccumType getMedianAbsDevMed(CountedPtr< uInt64 > knownNpts=nullptr, CountedPtr< AccumType > knownMin=nullptr, CountedPtr< AccumType > 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 void _unweightedStats(StatsData< AccumType > &stats, uInt64 &ngood, LocationType &location, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride)
virtual void _accumNpts(uInt64 &npts, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
virtual void reset()
reset object to initial state.
ConstrainedRangeStatistics()=delete
virtual StatsData< AccumType > _getStatistics()
virtual void _accumNpts(uInt64 &npts, const DataIterator &dataStart, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
virtual void _minMaxNpts(uInt64 &npts, CountedPtr< AccumType > &mymin, CountedPtr< AccumType > &mymax, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
virtual void _minMaxNpts(uInt64 &npts, CountedPtr< AccumType > &mymin, CountedPtr< AccumType > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
void _setRange(CountedPtr< std::pair< AccumType, AccumType > > r)
This method is purposefully non-virtual.
ConstrainedRangeStatistics(const ConstrainedRangeStatistics< CASA_STATP > &other)
copy semantics
virtual void _minMaxNpts(uInt64 &npts, CountedPtr< AccumType > &mymin, CountedPtr< AccumType > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
virtual void _minMax(CountedPtr< AccumType > &mymin, CountedPtr< AccumType > &mymax, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
virtual void _accumNpts(uInt64 &npts, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
virtual void _weightedStats(StatsData< AccumType > &stats, LocationType &location, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude)
virtual void _minMaxNpts(uInt64 &npts, CountedPtr< AccumType > &mymin, CountedPtr< AccumType > &mymax, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
ConstrainedRangeStatistics< CASA_STATP > & operator=(const ConstrainedRangeStatistics< CASA_STATP > &other)
copy semantics
virtual void _minMax(CountedPtr< AccumType > &mymin, CountedPtr< AccumType > &mymax, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride) const
virtual AccumType getMedianAndQuantiles(std::map< Double, AccumType > &quantileToValue, const std::set< Double > &quantiles, CountedPtr< uInt64 > knownNpts=nullptr, CountedPtr< AccumType > knownMin=nullptr, CountedPtr< AccumType > 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 getMedianAndQuantil...
virtual void _minMax(CountedPtr< AccumType > &mymin, CountedPtr< AccumType > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
virtual void getMinMax(AccumType &mymin, AccumType &mymax)
get the min and max of the data set
virtual void _unweightedStats(StatsData< AccumType > &stats, uInt64 &ngood, LocationType &location, const DataIterator &dataBegin, uInt64 nr, uInt dataStride)
no weights, no mask, no ranges
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 void _minMax(CountedPtr< AccumType > &mymin, CountedPtr< AccumType > &mymax, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
virtual void _minMax(CountedPtr< AccumType > &mymin, CountedPtr< AccumType > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
virtual void _accumNpts(uInt64 &npts, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
virtual std::map< Double, AccumType > getQuantiles(const std::set< Double > &quantiles, CountedPtr< uInt64 > knownNpts=nullptr, CountedPtr< AccumType > knownMin=nullptr, CountedPtr< AccumType > knownMax=NULL, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
Get the specified quantiles.
virtual AccumType _getStatistic(StatisticsData::STATS stat)
virtual void _accumNpts(uInt64 &npts, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
virtual void _weightedStats(StatsData< AccumType > &stats, LocationType &location, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride)
has weights, but no mask, no ranges
virtual void _unweightedStats(StatsData< AccumType > &stats, uInt64 &ngood, LocationType &location, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude)
no weights, no mask
virtual void _weightedStats(StatsData< AccumType > &stats, LocationType &location, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude)
virtual void _minMax(CountedPtr< AccumType > &mymin, CountedPtr< AccumType > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
virtual void _setRange()=0
derived classes need to implement how to set their respective range
virtual void _minMaxNpts(uInt64 &npts, CountedPtr< AccumType > &mymin, CountedPtr< AccumType > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
Sometimes we want the min, max, and npts all in one scan.
virtual void _accumNpts(uInt64 &npts, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride) const
virtual void _minMaxNpts(uInt64 &npts, CountedPtr< AccumType > &mymin, CountedPtr< AccumType > &mymax, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride) const
virtual uInt64 getNPts()
scan the dataset(s) that have been added, and find the number of good points.
virtual void _minMax(CountedPtr< AccumType > &mymin, CountedPtr< AccumType > &mymax, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
virtual AccumType getMedian(CountedPtr< uInt64 > knownNpts=nullptr, CountedPtr< AccumType > knownMin=nullptr, CountedPtr< AccumType > 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 binningThresh...
virtual void _minMaxNpts(uInt64 &npts, CountedPtr< AccumType > &mymin, CountedPtr< AccumType > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
ConstrainedRangeStatistics(CountedPtr< ConstrainedRangeQuantileComputer< CASA_STATP >> qc)
Concrete derived classes are responsible for providing an appropriate QuantileComputer object to the ...
virtual void _unweightedStats(StatsData< AccumType > &stats, uInt64 &ngood, LocationType &location, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude)
virtual void _minMax(CountedPtr< AccumType > &mymin, CountedPtr< AccumType > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
CountedPtr< std::pair< AccumType, AccumType > > _range
Referenced counted pointer for constant data.
this file contains all the compiler specific defines
bool Bool
Define the standard types used by Casacore.
unsigned long long uInt64
std::pair< Int64, Int64 > LocationType