26 #ifndef SCIMATH_CLASSICALQUANTILECOMPUTER_H
27 #define SCIMATH_CLASSICALQUANTILECOMPUTER_H
47 class AccumType,
class DataIterator,
class MaskIterator=
const Bool*,
48 class WeightsIterator=DataIterator
79 uInt64 mynpts, AccumType mymin, AccumType mymax,
80 uInt binningThreshholdSizeBytes,
Bool persistSortedArray,
uInt nBins
85 uInt64 mynpts, AccumType mymin, AccumType mymax,
86 uInt binningThreshholdSizeBytes,
Bool persistSortedArray,
uInt nBins
97 std::map<Double, AccumType>& quantiles,
98 const std::set<Double>& fractions,
uInt64 mynpts, AccumType mymin,
99 AccumType mymax,
uInt binningThreshholdSizeBytes,
106 const std::set<Double>& fractions,
uInt64 mynpts, AccumType mymin,
107 AccumType mymax,
uInt binningThreshholdSizeBytes,
112 virtual void reset();
123 std::vector<std::vector<uInt64> >& binCounts,
125 std::vector<Bool>& allSame,
const DataIterator& dataBegin,
uInt64 nr,
127 const std::vector<AccumType>& maxLimit
131 std::vector<std::vector<uInt64> >& binCounts,
133 std::vector<Bool>& allSame,
const DataIterator& dataBegin,
uInt64 nr,
136 const std::vector<AccumType>& maxLimit
140 std::vector<std::vector<uInt64> >& binCounts,
142 std::vector<Bool>& allSame,
const DataIterator& dataBegin,
uInt64 nr,
143 uInt dataStride,
const MaskIterator& maskBegin,
uInt maskStride,
145 const std::vector<AccumType>& maxLimit
149 std::vector<std::vector<uInt64> >& binCounts,
151 std::vector<Bool>& allSame,
const DataIterator& dataBegin,
uInt64 nr,
152 uInt dataStride,
const MaskIterator& maskBegin,
uInt maskStride,
155 const std::vector<AccumType>& maxLimit
159 std::vector<std::vector<uInt64> >& binCounts,
161 std::vector<Bool>& allSame,
const DataIterator& dataBegin,
162 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride,
164 const std::vector<AccumType>& maxLimit
168 std::vector<std::vector<uInt64> >& binCounts,
170 std::vector<Bool>& allSame,
const DataIterator& dataBegin,
171 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride,
174 const std::vector<AccumType>& maxLimit
178 std::vector<std::vector<uInt64> >& binCounts,
180 std::vector<Bool>& allSame,
const DataIterator& dataBegin,
181 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride,
182 const MaskIterator& maskBegin,
uInt maskStride,
185 const std::vector<AccumType>& maxLimit
189 std::vector<std::vector<uInt64> >& binCounts,
191 std::vector<Bool>& allSame,
const DataIterator& dataBegin,
192 const WeightsIterator& weightBegin,
uInt64 nr,
uInt dataStride,
193 const MaskIterator& maskBegin,
uInt maskStride,
195 const std::vector<AccumType>& maxLimit
203 std::vector<AccumType>& ary,
const DataIterator& dataBegin,
uInt64 nr,
209 std::vector<AccumType>& ary,
const DataIterator& dataBegin,
uInt64 nr,
214 std::vector<AccumType>& ary,
const DataIterator& dataBegin,
215 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
221 std::vector<AccumType>& ary,
const DataIterator& dataBegin,
uInt64 nr,
222 uInt dataStride,
const MaskIterator& maskBegin,
uInt maskStride,
228 std::vector<AccumType>& ary,
const DataIterator& dataBegin,
229 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride
234 std::vector<AccumType>& ary,
const DataIterator& dataBegin,
235 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride,
241 std::vector<AccumType>& ary,
const DataIterator& dataBegin,
242 const WeightsIterator& weightBegin,
uInt64 nr,
uInt dataStride,
243 const MaskIterator& maskBegin,
uInt maskStride
248 std::vector<AccumType>& ary,
const DataIterator& dataBegin,
249 const WeightsIterator& weightBegin,
uInt64 nr,
uInt dataStride,
250 const MaskIterator& maskBegin,
uInt maskStride,
263 std::vector<std::vector<AccumType>>& arys,
uInt64& currentCount,
264 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
270 std::vector<std::vector<AccumType> >& arys,
uInt64& currentCount,
271 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
277 std::vector<std::vector<AccumType> >& arys,
uInt64& currentCount,
278 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
279 const MaskIterator& maskBegin,
uInt maskStride,
285 std::vector<std::vector<AccumType> >& arys,
uInt64& currentCount,
286 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
287 const MaskIterator& maskBegin,
uInt maskStride,
294 std::vector<std::vector<AccumType> >& arys,
uInt64& currentCount,
295 const DataIterator& dataBegin,
const WeightsIterator& weightsBegin,
302 std::vector<std::vector<AccumType> >& arys,
uInt64& currentCount,
303 const DataIterator& dataBegin,
const WeightsIterator& weightsBegin,
310 std::vector<std::vector<AccumType> >& arys,
uInt64& currentCount,
311 const DataIterator& dataBegin,
const WeightsIterator& weightBegin,
312 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
318 std::vector<std::vector<AccumType> >& arys,
uInt64& currentCount,
319 const DataIterator& dataBegin,
const WeightsIterator& weightBegin,
320 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
329 std::vector<AccumType>& ary,
const DataIterator& dataBegin,
335 std::vector<AccumType>& ary,
const DataIterator& dataBegin,
uInt64 nr,
342 std::vector<AccumType>& ary,
const DataIterator& dataBegin,
343 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
349 std::vector<AccumType>& ary,
const DataIterator& dataBegin,
uInt64 nr,
350 uInt dataStride,
const MaskIterator& maskBegin,
uInt maskStride,
356 std::vector<AccumType>& ary,
const DataIterator& dataBegin,
357 const WeightsIterator& weightBegin,
uInt64 nr,
uInt dataStride,
363 std::vector<AccumType>& ary,
const DataIterator& dataBegin,
364 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride,
370 std::vector<AccumType>& ary,
const DataIterator& dataBegin,
371 const WeightsIterator& weightBegin,
uInt64 nr,
uInt dataStride,
372 const MaskIterator& maskBegin,
uInt maskStride,
uInt maxElements
377 std::vector<AccumType>& ary,
const DataIterator& dataBegin,
378 const WeightsIterator& weightBegin,
uInt64 nr,
uInt dataStride,
379 const MaskIterator& maskBegin,
uInt maskStride,
392 std::map<uInt64, AccumType>& values,
uInt64 mynpts,
393 const std::set<uInt64>& indices,
uInt64 maxArraySize,
394 Bool persistSortedArray
416 std::vector<std::vector<uInt64>>& bins,
418 std::vector<Bool>& allSame, DataIterator dataIter,
419 MaskIterator maskIter, WeightsIterator weightsIter,
uInt64 count,
421 const std::vector<AccumType>& maxLimit,
426 std::vector<AccumType>& ary, DataIterator dataIter,
427 MaskIterator maskIter, WeightsIterator weightsIter,
uInt64 dataCount,
432 std::vector<std::vector<AccumType> >& arys,
uInt64& currentCount,
433 DataIterator dataIter, MaskIterator maskIter,
434 WeightsIterator weightsIter,
uInt64 dataCount,
446 std::vector<std::vector<AccumType>>&
arrays,
461 uInt64 maxArraySize,
const std::vector<IndexSet>& dataIndices,
466 const std::vector<uInt64>& binNpts,
uInt64 maxArraySize,
468 const std::vector<IndexSet>& dataIndices,
uInt nBins
474 uInt64 mynpts, AccumType mymin, AccumType mymax,
uInt64 maxArraySize,
486 #ifndef CASACORE_NO_AUTO_TEMPLATES
487 #include <casacore/scimath/StatsFramework/ClassicalQuantileComputer.tcc>
std::set< uInt64 > IndexSet
virtual void _populateArrays(std::vector< std::vector< AccumType >> &arys, uInt64 ¤tCount, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const IncludeLimits &includeLimits, uInt64 maxCount) const
Create a std::vector of unsorted arrays, one array for each bin defined by includeLimits.
Represents an unfilled histogram with equal width bins for binning used for quantile computations...
Elements::const_iterator const_iterator
void _computeDataArray(std::vector< AccumType > &ary, DataIterator dataIter, MaskIterator maskIter, WeightsIterator weightsIter, uInt64 dataCount, const typename StatisticsDataset< CASA_STATP >::ChunkData &chunk)
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
This class is used internally by ClassicalStatistics objects.
unsigned long long uInt64
Bool _valuesFromSortedArray(std::map< uInt64, AccumType > &values, uInt64 mynpts, const std::set< uInt64 > &indices, uInt64 maxArraySize, Bool persistSortedArray)
get values from sorted array if the array is small enough to be held in memory.
std::pair< CASA_STATP, CASA_STATP > LimitPair
void _createDataArray(std::vector< AccumType > &array)
Create an unsorted array of the complete data set.
virtual AccumType getMedianAndQuantiles(std::map< Double, AccumType > &quantiles, const std::set< Double > &fractions, uInt64 mynpts, AccumType mymin, AccumType mymax, uInt binningThreshholdSizeBytes, Bool persistSortedArray, uInt nBins)
If one needs to compute both the median and QuantileComputer values, it is better to call getMedianAn...
virtual AccumType getMedian(uInt64 mynpts, AccumType mymin, AccumType mymax, uInt binningThreshholdSizeBytes, Bool persistSortedArray, uInt nBins)
Caller is responsible for passing correct values of mynpts, mymin, and mymax; no checking is done for...
void _createDataArrays(std::vector< std::vector< AccumType >> &arrays, const IncludeLimits &includeLimits, uInt64 maxCount)
std::vector< IndexValueMap > _dataFromSingleBins(const std::vector< uInt64 > &binNpts, uInt64 maxArraySize, const IncludeLimits &binLimits, const std::vector< IndexSet > &dataIndices, uInt nBins)
ClassicalQuantileComputer()=delete
static IndexSet _medianIndices(uInt64 mynpts)
get the index (for odd npts) or indices (for even npts) of the median of the sorted array...
This is the virtual base class from which concrete QuantileComputer classes are derived.
virtual AccumType getMedianAbsDevMed(uInt64 mynpts, AccumType mymin, AccumType mymax, uInt binningThreshholdSizeBytes, Bool persistSortedArray, uInt nBins)
get the median of the absolute deviation about the median of the data.
virtual StatisticsAlgorithmQuantileComputer< CASA_STATP > * clone() const
clone this object by returning a pointer to a copy
virtual std::map< Double, AccumType > getQuantiles(const std::set< Double > &fractions, uInt64 mynpts, AccumType mymin, AccumType mymax, uInt binningThreshholdSizeBytes, Bool persistSortedArray, uInt nBins)
Get the specified Quantiles.
virtual void reset()
reset the private fields
DEFAULT IMPLEMENTATIONS Default implementation of PlotSingleData that supports raw arrays
virtual Bool _populateTestArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, uInt maxElements) const
no weights, no mask, no ranges
bool Bool
Define the standard types used by Casacore.
AccumType _myMedian
for use in often repeatedly run macros
virtual void _findBins(std::vector< std::vector< uInt64 > > &binCounts, std::vector< CountedPtr< AccumType > > &sameVal, std::vector< Bool > &allSame, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const std::vector< StatsHistogram< AccumType > > &hist, const std::vector< AccumType > &maxLimit) const
Get the counts of data within the specified histogram bins.
ClassicalQuantileComputer & operator=(const ClassicalQuantileComputer &other)
copy semantics
typename std::map< uInt64, CASA_STATP > IndexValueMap
void _computeBins(std::vector< std::vector< uInt64 >> &bins, std::vector< CountedPtr< AccumType >> &sameVal, std::vector< Bool > &allSame, DataIterator dataIter, MaskIterator maskIter, WeightsIterator weightsIter, uInt64 count, const std::vector< StatsHistogram< AccumType >> &hist, const std::vector< AccumType > &maxLimit, const typename StatisticsDataset< CASA_STATP >::ChunkData &chunk)
typename std::vector< LimitPair >::const_iterator LimitPairVectorIter
virtual ~ClassicalQuantileComputer()
std::vector< IndexValueMap > _dataFromMultipleBins(const std::vector< StatsHistogram< AccumType > > &hist, uInt64 maxArraySize, const std::vector< IndexSet > &dataIndices, uInt nBins)
extract data from multiple histograms given by hist.
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
IndexValueMap _indicesToValues(uInt64 mynpts, AccumType mymin, AccumType mymax, uInt64 maxArraySize, const IndexSet &dataIndices, Bool persistSortedArray, uInt nBins)
get the values for the specified indices in the sorted array of all good data
void _computeDataArrays(std::vector< std::vector< AccumType > > &arys, uInt64 ¤tCount, DataIterator dataIter, MaskIterator maskIter, WeightsIterator weightsIter, uInt64 dataCount, const IncludeLimits &includeLimits, uInt64 maxCount, const typename StatisticsDataset< CASA_STATP >::ChunkData &chunk)
std::vector< std::vector< uInt64 > > _binCounts(std::vector< CountedPtr< AccumType > > &sameVal, const std::vector< StatsHistogram< AccumType > > &hist)
tally the number of data points that fall into each bin provided by hist.
virtual void _populateArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
populate an unsorted array with valid data.
#define casacore
<X11/Intrinsic.h> #defines true, false, casacore::Bool, and String.