26#ifndef SCIMATH_STATISTICSALGORITHM_H
27#define SCIMATH_STATISTICSALGORITHM_H
29#include <casacore/casa/aips.h>
30#include <casacore/casa/Exceptions/Error.h>
31#include <casacore/scimath/StatsFramework/StatsDataProvider.h>
32#include <casacore/scimath/StatsFramework/StatisticsData.h>
33#include <casacore/scimath/StatsFramework/StatisticsDataset.h>
34#include <casacore/scimath/StatsFramework/StatisticsTypes.h>
134 class AccumType,
class DataIterator,
class MaskIterator=
const Bool *,
135 class WeightsIterator=DataIterator
175 const DataIterator&
first,
const MaskIterator& maskFirst,
181 const DataIterator&
first,
const MaskIterator& maskFirst,
187 const DataIterator&
first,
const WeightsIterator& weightFirst,
192 const DataIterator&
first,
const WeightsIterator& weightFirst,
198 const DataIterator&
first,
const WeightsIterator& weightFirst,
199 const MaskIterator& maskFirst,
uInt nr,
uInt dataStride=1,
204 const DataIterator&
first,
const WeightsIterator& weightFirst,
205 const MaskIterator& maskFirst,
uInt nr,
const DataRanges& dataRanges,
215 std::shared_ptr<uInt64> knownNpts=
nullptr,
216 std::shared_ptr<AccumType> knownMin=
nullptr,
217 std::shared_ptr<AccumType> knownMax=
nullptr,
218 uInt binningThreshholdSizeBytes=4096*4096,
225 std::map<Double, AccumType>& quantileToValue,
226 const std::set<Double>& quantiles,
227 std::shared_ptr<uInt64> knownNpts=
nullptr,
228 std::shared_ptr<AccumType> knownMin=
nullptr,
229 std::shared_ptr<AccumType> knownMax=
nullptr,
230 uInt binningThreshholdSizeBytes=4096*4096,
236 std::shared_ptr<uInt64> knownNpts=
nullptr,
237 std::shared_ptr<AccumType> knownMin=
nullptr,
238 std::shared_ptr<AccumType> knownMax=
nullptr,
239 uInt binningThreshholdSizeBytes=4096*4096,
245 Double quantile, std::shared_ptr<uInt64> knownNpts=
nullptr,
246 std::shared_ptr<AccumType> knownMin=
nullptr,
247 std::shared_ptr<AccumType> knownMax=
nullptr,
248 uInt binningThreshholdSizeBytes=4096*4096,
254 const std::set<Double>& quantiles, std::shared_ptr<uInt64> npts=
nullptr,
255 std::shared_ptr<AccumType>
min=
nullptr, std::shared_ptr<AccumType>
max=
nullptr,
256 uInt binningThreshholdSizeBytes=4096*4096,
296 const DataIterator&
first,
const MaskIterator& maskFirst,
uInt nr,
301 const DataIterator&
first,
const MaskIterator& maskFirst,
307 const DataIterator&
first,
const WeightsIterator& weightFirst,
uInt nr,
312 const DataIterator&
first,
const WeightsIterator& weightFirst,
uInt nr,
318 const DataIterator&
first,
const WeightsIterator& weightFirst,
319 const MaskIterator& maskFirst,
uInt nr,
uInt dataStride=1,
324 const DataIterator&
first,
const WeightsIterator& weightFirst,
325 const MaskIterator& maskFirst,
uInt nr,
const DataRanges& dataRanges,
375 virtual const std::set<StatisticsData::STATS>&
383 const std::set<StatisticsData::STATS>& stats
399#ifndef CASACORE_NO_AUTO_TEMPLATES
400#include <casacore/scimath/StatsFramework/StatisticsAlgorithm.tcc>
Base class of statistics algorithm class hierarchy.
virtual void reset()
reset this object by clearing data.
AccumType getQuantile(Double quantile, std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< AccumType > knownMin=nullptr, std::shared_ptr< AccumType > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
Purposefully not virtual.
virtual AccumType getMedian(std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< AccumType > knownMin=nullptr, std::shared_ptr< AccumType > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)=0
virtual StatsData< AccumType > _getStatistics()=0
void _resetExceptDataset()
void addData(const DataIterator &first, const WeightsIterator &weightFirst, uInt nr, uInt dataStride=1, Bool nrAccountsForStride=False)
std::set< StatisticsData::STATS > _statsToCalculate
void _setUnsupportedStatistics(const std::set< StatisticsData::STATS > &stats)
Derived classes should normally call this in their constructors, if applicable.
virtual void setDataProvider(StatsDataProvider< CASA_STATP > *dataProvider)
instead of setting and adding data "by hand", set the data provider that will provide all the data se...
virtual AccumType getMedianAbsDevMed(std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< AccumType > knownMin=nullptr, std::shared_ptr< AccumType > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)=0
get the median of the absolute deviation about the median of the data.
virtual void setStatsToCalculate(std::set< StatisticsData::STATS > &stats)
Provide guidance to algorithms by specifying a priori which statistics the caller would like calculat...
virtual AccumType getMedianAndQuantiles(std::map< Double, AccumType > &quantileToValue, const std::set< Double > &quantiles, std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< AccumType > knownMin=nullptr, std::shared_ptr< AccumType > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)=0
The return value is the median; the quantiles are returned in the quantileToValue map.
const std::set< StatisticsData::STATS > _getStatsToCalculate() const
AccumType getStatistic(StatisticsData::STATS stat)
get the value of the specified statistic.
virtual AccumType _getStatistic(StatisticsData::STATS stat)=0
virtual StatisticsData::ALGORITHM algorithm() const =0
get the algorithm that this object uses for computing stats
StatisticsAlgorithm(const StatisticsAlgorithm &other)
use copy semantics, except for the data provider which uses reference semantics
StatsData< AccumType > getStatistics()
Return statistics.
virtual StatisticsAlgorithm< CASA_STATP > * clone() const =0
Clone this instance.
std::set< StatisticsData::STATS > _unsupportedStats
const StatisticsDataset< CASA_STATP > & _getDataset() const
These methods are purposefully not virtual.
void setData(const DataIterator &first, const WeightsIterator &weightFirst, const MaskIterator &maskFirst, uInt nr, const DataRanges &dataRanges, Bool isInclude=True, uInt dataStride=1, Bool nrAccountsForStride=False, uInt maskStride=1)
virtual const std::set< StatisticsData::STATS > & _getUnsupportedStatistics() const
void setData(const DataIterator &first, const WeightsIterator &weightFirst, const MaskIterator &maskFirst, uInt nr, uInt dataStride=1, Bool nrAccountsForStride=False, uInt maskStride=1)
virtual std::map< Double, AccumType > getQuantiles(const std::set< Double > &quantiles, std::shared_ptr< uInt64 > npts=nullptr, std::shared_ptr< AccumType > min=nullptr, std::shared_ptr< AccumType > max=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)=0
get a map of quantiles to values.
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.
StatisticsAlgorithm & operator=(const StatisticsAlgorithm &other)
use copy semantics, except for the data provider which uses reference semantics
StatisticsDataset< CASA_STATP > _dataset
void setData(const DataIterator &first, const WeightsIterator &weightFirst, uInt nr, uInt dataStride=1, Bool nrAccountsForStride=False)
virtual LocationType getStatisticIndex(StatisticsData::STATS stat)=0
certain statistics such as max and min have locations in the dataset associated with them.
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 fi...
void addData(const DataIterator &first, const MaskIterator &maskFirst, uInt nr, uInt dataStride=1, Bool nrAccountsForStride=False, uInt maskStride=1)
StatisticsDataset< CASA_STATP > & _getDataset()
void addData(const DataIterator &first, const MaskIterator &maskFirst, uInt nr, const DataRanges &dataRanges, Bool isInclude=True, uInt dataStride=1, Bool nrAccountsForStride=False, uInt maskStride=1)
void addData(const DataIterator &first, const WeightsIterator &weightFirst, const MaskIterator &maskFirst, uInt nr, const DataRanges &dataRanges, Bool isInclude=True, uInt dataStride=1, Bool nrAccountsForStride=False, uInt maskStride=1)
virtual ~StatisticsAlgorithm()
void setData(const DataIterator &first, uInt nr, const DataRanges &dataRanges, Bool isInclude=True, uInt dataStride=1, Bool nrAccountsForStride=False)
void setData(const DataIterator &first, const MaskIterator &maskFirst, uInt nr, const DataRanges &dataRanges, Bool isInclude=True, uInt dataStride=1, Bool nrAccountsForStride=False, uInt maskStride=1)
void setData(const DataIterator &first, const WeightsIterator &weightFirst, uInt nr, const DataRanges &dataRanges, Bool isInclude=True, uInt dataStride=1, Bool nrAccountsForStride=False)
void addData(const DataIterator &first, uInt nr, const DataRanges &dataRanges, Bool isInclude=True, uInt dataStride=1, Bool nrAccountsForStride=False)
virtual void _addData()
Allows derived classes to do things after data is set or added.
void addData(const DataIterator &first, const WeightsIterator &weightFirst, uInt nr, const DataRanges &dataRanges, Bool isInclude=True, uInt dataStride=1, Bool nrAccountsForStride=False)
void addData(const DataIterator &first, const WeightsIterator &weightFirst, const MaskIterator &maskFirst, uInt nr, uInt dataStride=1, Bool nrAccountsForStride=False, uInt maskStride=1)
void setData(const DataIterator &first, const MaskIterator &maskFirst, uInt nr, uInt dataStride=1, Bool nrAccountsForStride=False, uInt maskStride=1)
ALGORITHM
implemented algorithms
Representation of a statistics dataset used in statistics framework calculatations.
Abstract base class which defines interface for providing "datasets" to the statistics framework in c...
this file contains all the compiler specific defines
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
bool Bool
Define the standard types used by Casacore.
std::pair< Int64, Int64 > LocationType