26 #ifndef SCIMATH_CLASSICALSTATISTICSS_H
27 #define SCIMATH_CLASSICALSTATISTICSS_H
60 class AccumType,
class DataIterator,
class MaskIterator=
const Bool*,
61 class WeightsIterator=DataIterator
138 uInt binningThreshholdSizeBytes=4096*4096,
150 std::map<Double, AccumType>& quantiles,
154 uInt binningThreshholdSizeBytes=4096*4096,
163 uInt binningThreshholdSizeBytes=4096*4096,
170 const std::set<Double>& fractions,
174 uInt binningThreshholdSizeBytes=4096*4096,
185 virtual void getMinMax(AccumType& mymin, AccumType& mymax);
188 uInt64& npts, AccumType& mymin, AccumType& mymax
206 virtual void reset();
251 const MaskIterator& maskBegin,
uInt maskStride
256 const MaskIterator& maskBegin,
uInt maskStride,
261 uInt64& npts,
const DataIterator& dataBegin,
262 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride
266 uInt64& npts,
const DataIterator& dataBegin,
267 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride,
272 uInt64& npts,
const DataIterator& dataBegin,
273 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride,
274 const MaskIterator& maskBegin,
uInt maskStride,
279 uInt64& npts,
const DataIterator& dataBegin,
280 const WeightsIterator& weightBegin,
uInt64 nr,
uInt dataStride,
281 const MaskIterator& maskBegin,
uInt maskStride
320 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride
325 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
331 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
332 const MaskIterator& maskBegin,
uInt maskStride
337 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
338 const MaskIterator& maskBegin,
uInt maskStride,
344 const DataIterator& dataBegin,
const WeightsIterator& weightsBegin,
350 const DataIterator& dataBegin,
const WeightsIterator& weightsBegin,
356 const DataIterator& dataBegin,
const WeightsIterator& weightsBegin,
357 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
363 const DataIterator& dataBegin,
const WeightsIterator& weightBegin,
364 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
386 uInt dataStride,
const MaskIterator& maskBegin,
uInt maskStride
392 uInt dataStride,
const MaskIterator& maskBegin,
uInt maskStride,
399 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride
405 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride,
412 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride,
413 const MaskIterator& maskBegin,
uInt maskStride,
420 const WeightsIterator& weightBegin,
uInt64 nr,
uInt dataStride,
421 const MaskIterator& maskBegin,
uInt maskStride
434 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride
440 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
446 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
447 const MaskIterator& maskBegin,
uInt maskStride
452 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
453 const MaskIterator& maskBegin,
uInt maskStride,
466 const DataIterator& dataBegin,
const WeightsIterator& weightsBegin,
472 const DataIterator& dataBegin,
const WeightsIterator& weightsBegin,
478 const DataIterator& dataBegin,
const WeightsIterator& weightBegin,
479 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
485 const DataIterator& dataBegin,
const WeightsIterator& weightBegin,
486 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
499 DataIterator dataIter, MaskIterator maskIter,
506 MaskIterator maskIter, WeightsIterator weightsIter,
uInt64 dataCount,
511 uInt64& npts, DataIterator dataIter, MaskIterator maskIter,
517 DataIterator dataIter, MaskIterator maskIter,
522 void _doMinMax(AccumType& vmin, AccumType& vmax);
531 uInt64& mynpts, AccumType& mymin, AccumType& mymax,
540 #ifndef CASACORE_NO_AUTO_TEMPLATES
541 #include <casacore/scimath/StatsFramework/ClassicalStatistics.tcc>
void _doMinMax(AccumType &vmin, AccumType &vmax)
scan dataset(s) to find min and max
void _computeMinMaxNpts(uInt64 &npts, CountedPtr< AccumType > &mymax, CountedPtr< AccumType > &mymin, DataIterator dataIter, MaskIterator maskIter, WeightsIterator weightsIter, uInt64 dataCount, const ChunkType &chunk)
Representation of a statistics dataset used in statistics framework calculatations.
virtual AccumType getMedianAndQuantiles(std::map< Double, AccumType > &quantiles, const std::set< Double > &fractions, 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 StatsData< AccumType > _getInitialStats() const
virtual StatisticsData::ALGORITHM algorithm() const
get the algorithm that this object uses for computing stats
virtual StatsData< AccumType > & _getStatsData()
Retrieve stats structure.
Bool _calculateAsAdded False
virtual void _minMax(CountedPtr< AccumType > &mymin, CountedPtr< AccumType > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
CountedPtr< ClassicalQuantileComputer< CASA_STATP > > _qComputer
void _computeStats(StatsData< AccumType > &stats, uInt64 &ngood, LocationType &location, DataIterator dataIter, MaskIterator maskIter, WeightsIterator weightsIter, uInt64 count, const ChunkType &chunk)
unsigned long long uInt64
virtual std::pair< Int64, Int64 > getStatisticIndex(StatisticsData::STATS stat)
see base class description
Class to calculate statistics in a "classical" sense, ie using accumulators with no special filtering...
virtual StatisticsAlgorithm< CASA_STATP > * clone() const
Clone this instance.
virtual uInt64 getNPts()
scan the dataset(s) that have been added, and find the number of good points.
Hold and delete pointers not deleted by object destructors.
virtual void setDataProvider(StatsDataProvider< CASA_STATP > *dataProvider)
An exception will be thrown if setCalculateAsAdded(True) has been called.
virtual void getMinMax(AccumType &mymin, AccumType &mymax)
scan the dataset(s) that have been added, and find the min and max.
CountedPtr< StatisticsAlgorithmQuantileComputer< CASA_STATP > > _getQuantileComputer()
ALGORITHM
implemented algorithms
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
void _addData()
Allows derived classes to do things after data is set or added.
virtual void setStatsToCalculate(std::set< StatisticsData::STATS > &stats)
Provide guidance to algorithms by specifying a priori which statistics the caller would like calculat...
virtual StatsData< AccumType > _getStatistics()
Bool _calculateAsAdded _doMaxMin
Referenced counted pointer for constant data.
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...
void _accumulate(StatsData< AccumType > &stats, const AccumType &datum, const LocationType &location)
std::pair< Int64, Int64 > LocationType
Bool _getDoMaxMin() const
virtual void _accumNpts(uInt64 &npts, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
scan through the data set to determine the number of good (unmasked, weight > 0, within range) points...
typename StatisticsDataset< CASA_STATP >::ChunkData ChunkType
uInt64 _doMinMaxNpts(AccumType &vmin, AccumType &vmax)
bool Bool
Define the standard types used by Casacore.
virtual void setCalculateAsAdded(Bool c)
Should statistics be updated with calls to addData or should they only be calculated upon calls to ge...
void _computeNpts(uInt64 &npts, DataIterator dataIter, MaskIterator maskIter, WeightsIterator weightsIter, uInt64 dataCount, const ChunkType &chunk)
void _computeMinMax(CountedPtr< AccumType > &mymax, CountedPtr< AccumType > &mymin, DataIterator dataIter, MaskIterator maskIter, WeightsIterator weightsIter, uInt64 dataCount, const ChunkType &chunk)
virtual std::map< Double, AccumType > getQuantiles(const std::set< Double > &fractions, CountedPtr< uInt64 > knownNpts=nullptr, CountedPtr< AccumType > knownMin=nullptr, CountedPtr< AccumType > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
Get the specified quantiles.
Bool _calculateAsAdded _mustAccumulate
virtual ~ClassicalStatistics()
virtual void getMinMaxNpts(uInt64 &npts, AccumType &mymin, AccumType &mymax)
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.
StatsData< AccumType > _statsData
virtual void reset()
reset object to initial state.
virtual const StatsData< AccumType > & _getStatsData() const
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.
const Double c
Fundamental physical constants (SI units):
void _doNptsMinMax(uInt64 &mynpts, AccumType &mymin, AccumType &mymax, CountedPtr< uInt64 > knownNpts, CountedPtr< AccumType > knownMin, CountedPtr< AccumType > knownMax)
for quantile computations, if necessary, determines npts, min, max to send to quantile calculator met...
ClassicalStatistics & operator=(const ClassicalStatistics &other)
copy semantics
virtual void _updateDataProviderMaxMin(const StatsData< AccumType > &threadStats)
Subchunk class Provides the ordered pair identifying the current subchunk The first component is the chunk(goes from 0 to nChunks-1 during the outer loop iteration).The second component is the subchunk number which is zero after VisibilityIterator
Base class of statistics algorithm class hierarchy.
void setQuantileComputer(CountedPtr< ClassicalQuantileComputer< CASA_STATP >> qc)
Allow derived objects to set the quantile computer object.
virtual AccumType _getStatistic(StatisticsData::STATS stat)
virtual void _unweightedStats(StatsData< AccumType > &stats, uInt64 &ngood, LocationType &location, const DataIterator &dataBegin, uInt64 nr, uInt dataStride)
no weights, no mask, no ranges
#define casacore
<X11/Intrinsic.h> #defines true, false, casacore::Bool, and String.