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/casa/Utilities/CountedPtr.h>
32 #include <casacore/scimath/StatsFramework/StatsDataProvider.h>
33 #include <casacore/scimath/StatsFramework/StatisticsData.h>
34 #include <casacore/scimath/StatsFramework/StatisticsDataset.h>
35 #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,
218 uInt binningThreshholdSizeBytes=4096*4096,
225 std::map<Double, AccumType>& quantileToValue,
226 const std::set<Double>& quantiles,
230 uInt binningThreshholdSizeBytes=4096*4096,
239 uInt binningThreshholdSizeBytes=4096*4096,
248 uInt binningThreshholdSizeBytes=4096*4096,
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>
Referenced counted pointer for constant data.
Base class of statistics algorithm class hierarchy.
virtual void reset()
reset this object by clearing data.
void _resetExceptDataset()
virtual StatisticsAlgorithm< CASA_STATP > * clone() const =0
Clone this instance.
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)=0
get the median of the absolute deviation about the median of the data.
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 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)=0
The return value is the median; the quantiles are returned in the quantileToValue map.
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 getMedian(CountedPtr< uInt64 > knownNpts=nullptr, CountedPtr< AccumType > knownMin=nullptr, CountedPtr< AccumType > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)=0
virtual const std::set< StatisticsData::STATS > & _getUnsupportedStatistics() const
AccumType getQuantile(Double quantile, CountedPtr< uInt64 > knownNpts=nullptr, CountedPtr< AccumType > knownMin=nullptr, CountedPtr< AccumType > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
Purposefully not virtual.
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
const StatisticsDataset< CASA_STATP > & _getDataset() const
These methods are purposefully not virtual.
virtual std::map< Double, AccumType > getQuantiles(const std::set< Double > &quantiles, CountedPtr< uInt64 > npts=nullptr, CountedPtr< AccumType > min=nullptr, CountedPtr< AccumType > max=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)=0
get a map of quantiles to values.
StatisticsAlgorithm(const StatisticsAlgorithm &other)
use copy semantics, except for the data provider which uses reference semantics
virtual StatsData< AccumType > _getStatistics()=0
StatisticsAlgorithm & operator=(const StatisticsAlgorithm &other)
use copy semantics, except for the data provider which uses reference semantics
std::set< StatisticsData::STATS > _unsupportedStats
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)
void setData(const DataIterator &first, const WeightsIterator &weightFirst, const MaskIterator &maskFirst, uInt nr, uInt dataStride=1, Bool nrAccountsForStride=False, uInt maskStride=1)
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.
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)
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)
const std::set< StatisticsData::STATS > _getStatsToCalculate() const
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)
StatisticsDataset< CASA_STATP > & _getDataset()
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)
StatsData< AccumType > getStatistics()
Return statistics.
void setData(const DataIterator &first, const MaskIterator &maskFirst, uInt nr, uInt dataStride=1, Bool nrAccountsForStride=False, uInt maskStride=1)
ALGORITHM
implemented algorithms
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