26 #ifndef SCIMATH_FITTOHALFSTATISTICS_H
27 #define SCIMATH_FITTOHALFSTATISTICS_H
29 #include <casacore/casa/aips.h>
31 #include <casacore/scimath/StatsFramework/ConstrainedRangeStatistics.h>
32 #include <casacore/scimath/StatsFramework/FitToHalfStatisticsData.h>
51 class AccumType,
class DataIterator,
class MaskIterator=
const Bool *,
52 class WeightsIterator=DataIterator
58 const static AccumType
TWO;
92 uInt binningThreshholdSizeBytes=4096*4096,
126 std::map<Double, AccumType>& quantiles,
127 const std::set<Double>& fractions,
131 uInt binningThreshholdSizeBytes=4096*4096,
140 uInt binningThreshholdSizeBytes=4096*4096,
147 const std::set<Double>& fractions,
151 uInt binningThreshholdSizeBytes=4096*4096,
159 virtual void getMinMax(AccumType& mymin, AccumType& mymax);
197 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride
203 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
209 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
210 const MaskIterator& maskBegin,
uInt maskStride
215 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
216 const MaskIterator& maskBegin,
uInt maskStride,
227 const DataIterator& dataBegin,
const WeightsIterator& weightsBegin,
233 const DataIterator& dataBegin,
const WeightsIterator& weightsBegin,
239 const DataIterator& dataBegin,
const WeightsIterator& weightBegin,
240 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
246 const DataIterator& dataBegin,
const WeightsIterator& weightBegin,
247 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
282 #ifndef CASACORE_NO_AUTO_TEMPLATES
283 #include <casacore/scimath/StatsFramework/FitToHalfStatistics.tcc>
Abstract base class for statistics algorithms which are characterized by a range of good values.
Referenced counted pointer for constant data.
USE_DATA
which section of data to use, greater than or less than the center value
CENTER
choice of center point based on the corresponding statistics from the entire distribution of data,...
Class to calculate statistics using the so-called fit to half algorithm.
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)
void _updateDataProviderMaxMin(const StatsData< AccumType > &threadStats)
virtual void getMinMax(AccumType &mymin, AccumType &mymax)
scan the dataset(s) that have been added, and find the min and max.
FitToHalfStatistics(const FitToHalfStatistics< CASA_STATP > &other)
copy semantics
static const AccumType TWO
StatsData< AccumType > & _getStatsData()
Retrieve stats structure.
CountedPtr< AccumType > _realMax
these are the max and min for the real portion of the dataset
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.
CountedPtr< std::pair< AccumType, AccumType > > _range
This is used for convenience and performance.
FitToHalfStatisticsData::CENTER _centerType
const StatsData< AccumType > & _getStatsData() const
AccumType getMedian(CountedPtr< uInt64 > knownNpts=nullptr, CountedPtr< AccumType > knownMin=nullptr, CountedPtr< AccumType > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
The median is just the center value, so none of the parameters to this method are used.
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)
void _weightedStats(StatsData< AccumType > &stats, LocationType &location, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude)
virtual StatsData< AccumType > _getStatistics()
virtual StatsData< AccumType > _getInitialStats() const
void _setRange()
derived classes need to implement how to set their respective range
FitToHalfStatistics(FitToHalfStatisticsData::CENTER center=FitToHalfStatisticsData::CMEAN, FitToHalfStatisticsData::USE_DATA useData=FitToHalfStatisticsData::LE_CENTER, AccumType value=0)
value is only used if center=CVALUE
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
FitToHalfStatistics< CASA_STATP > & operator=(const FitToHalfStatistics< CASA_STATP > &other)
copy semantics
void _unweightedStats(StatsData< AccumType > &stats, uInt64 &ngood, LocationType &location, const DataIterator &dataBegin, uInt64 nr, uInt dataStride)
no weights, no mask, no ranges
virtual ~FitToHalfStatistics()
virtual void setStatsToCalculate(std::set< StatisticsData::STATS > &stats)
Override base class method by requiring mean to be computed in addition to what is added in stats if ...
virtual StatisticsAlgorithm< CASA_STATP > * clone() const
Clone this instance.
StatsData< AccumType > _statsData
virtual StatisticsData::ALGORITHM algorithm() const
get the algorithm that this object uses for computing stats
void _weightedStats(StatsData< AccumType > &stats, LocationType &location, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride)
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.
void _unweightedStats(StatsData< AccumType > &stats, uInt64 &ngood, LocationType &location, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride)
uInt64 getNPts()
scan the dataset(s) that have been added, and find the number of good points.
void setCalculateAsAdded(Bool c)
This class does not allow statistics to be calculated as datasets are added, so an exception will be ...
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)
In the following group of methods, if the size of the composite dataset is smaller than binningThresh...
void _getMinMax(CountedPtr< AccumType > &realMin, CountedPtr< AccumType > &realMax, CountedPtr< AccumType > knownMin, CountedPtr< AccumType > knownMax)
get the min max of the entire (real + virtual) data set.
virtual void reset()
reset object to initial state.
CountedPtr< AccumType > _realMin
void _getRealMinMax(AccumType &realMin, AccumType &realMax)
get the min/max of the real portion only of the dataset
void _weightedStats(StatsData< AccumType > &stats, LocationType &location, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride)
has weights, but no mask, no ranges
ALGORITHM
implemented algorithms
const Double c
Fundamental physical constants (SI units):
this file contains all the compiler specific defines
bool Bool
Define the standard types used by Casacore.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
unsigned long long uInt64
std::pair< Int64, Int64 > LocationType