casacore
Loading...
Searching...
No Matches
ClassicalQuantileComputer.h
Go to the documentation of this file.
1//# Copyright (C) 2000,2001
2//# Associated Universities, Inc. Washington DC, USA.
3//#
4//# This library is free software; you can redistribute it and/or modify it
5//# under the terms of the GNU Library General Public License as published by
6//# the Free Software Foundation; either version 2 of the License, or (at your
7//# option) any later version.
8//#
9//# This library is distributed in the hope that it will be useful, but WITHOUT
10//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12//# License for more details.
13//#
14//# You should have received a copy of the GNU Library General Public License
15//# along with this library; if not, write to the Free Software Foundation,
16//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17//#
18//# Correspondence concerning AIPS++ should be addressed as follows:
19//# Internet email: casa-feedback@nrao.edu.
20//# Postal address: AIPS++ Project Office
21//# National Radio Astronomy Observatory
22//# 520 Edgemont Road
23//# Charlottesville, VA 22903-2475 USA
24//#
25
26#ifndef SCIMATH_CLASSICALQUANTILECOMPUTER_H
27#define SCIMATH_CLASSICALQUANTILECOMPUTER_H
28
29#include <casacore/scimath/StatsFramework/StatisticsAlgorithmQuantileComputer.h>
30
31#include <casacore/scimath/StatsFramework/StatisticsUtilities.h>
32
33#include <casacore/casa/aips.h>
34
35#include <map>
36#include <set>
37#include <utility>
38#include <vector>
39
40namespace casacore {
41
42// This class is used internally by ClassicalStatistics objects. It should never
43// be explicitly instantiated by an API developer. See the documentation of
44// StatisticsAlgorithm for details regarding QuantileComputer classes.
45
46template <
47 class AccumType, class DataIterator, class MaskIterator=const Bool*,
48 class WeightsIterator=DataIterator
50 : public StatisticsAlgorithmQuantileComputer<CASA_STATP> {
51
52 using LimitPair = std::pair<AccumType, AccumType>;
53 using LimitPairVectorIter = typename std::vector<LimitPair>::const_iterator;
54 using IndexValueMap = typename std::map<uInt64, AccumType>;
55 using IndexSet = std::set<uInt64>;
56
57public:
58
60
62
63 // copy semantics
65
67
68 // copy semantics
70 const ClassicalQuantileComputer& other
71 );
72
73 // clone this object by returning a pointer to a copy
75
76 // Caller is responsible for passing correct values of mynpts, mymin, and
77 // mymax; no checking is done for correctness in this method.
78 virtual AccumType getMedian(
79 uInt64 mynpts, AccumType mymin, AccumType mymax,
80 uInt binningThreshholdSizeBytes, Bool persistSortedArray, uInt nBins
81 );
82
83 // get the median of the absolute deviation about the median of the data.
84 virtual AccumType getMedianAbsDevMed(
85 uInt64 mynpts, AccumType mymin, AccumType mymax,
86 uInt binningThreshholdSizeBytes, Bool persistSortedArray, uInt nBins
87 );
88
89 // If one needs to compute both the median and QuantileComputer values, it
90 // is better to call getMedianAndQuantiles() rather than getMedian() and
91 // getQuantiles() separately, as the first will scan large data sets fewer
92 // times than calling the separate methods. The return value is the median;
93 // the quantiles are returned in the <src>quantiles</src> map. Values in the
94 // <src>fractions</src> set represent the locations in the CDF and should be
95 // between 0 and 1, exclusive.
96 virtual AccumType getMedianAndQuantiles(
97 std::map<Double, AccumType>& quantiles,
98 const std::set<Double>& fractions, uInt64 mynpts, AccumType mymin,
99 AccumType mymax, uInt binningThreshholdSizeBytes,
100 Bool persistSortedArray, uInt nBins
101 );
102
103 // Get the specified Quantiles. <src>fractions</src> must be between 0 and
104 // 1, noninclusive.
105 virtual std::map<Double, AccumType> getQuantiles(
106 const std::set<Double>& fractions, uInt64 mynpts, AccumType mymin,
107 AccumType mymax, uInt binningThreshholdSizeBytes,
108 Bool persistSortedArray, uInt nBins
109 );
110
111 // reset the private fields
112 virtual void reset();
113
114protected:
115
116 // <group>
117 // Get the counts of data within the specified histogram bins. The number of
118 // arrays within binCounts will be equal to the number of histograms in
119 // <src>hist</src>. Each array within <src>binCounts</src> will have the
120 // same number of elements as the number of bins in its corresponding
121 // histogram in <src>hist</src>.
122 virtual void _findBins(
123 std::vector<std::vector<uInt64>>& binCounts,
124 std::vector<std::shared_ptr<AccumType>>& sameVal,
125 std::vector<Bool>& allSame, const DataIterator& dataBegin, uInt64 nr,
126 uInt dataStride, const std::vector<StatsHistogram<AccumType>>& hist,
127 const std::vector<AccumType>& maxLimit
128 ) const;
129
130 virtual void _findBins(
131 std::vector<std::vector<uInt64>>& binCounts,
132 std::vector<std::shared_ptr<AccumType>>& sameVal,
133 std::vector<Bool>& allSame, const DataIterator& dataBegin, uInt64 nr,
134 uInt dataStride, const DataRanges& ranges, Bool isInclude,
135 const std::vector<StatsHistogram<AccumType>>& hist,
136 const std::vector<AccumType>& maxLimit
137 ) const;
138
139 virtual void _findBins(
140 std::vector<std::vector<uInt64>>& binCounts,
141 std::vector<std::shared_ptr<AccumType>>& sameVal,
142 std::vector<Bool>& allSame, const DataIterator& dataBegin, uInt64 nr,
143 uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
144 const std::vector<StatsHistogram<AccumType>>& hist,
145 const std::vector<AccumType>& maxLimit
146 ) const;
147
148 virtual void _findBins(
149 std::vector<std::vector<uInt64>>& binCounts,
150 std::vector<std::shared_ptr<AccumType>>& sameVal,
151 std::vector<Bool>& allSame, const DataIterator& dataBegin, uInt64 nr,
152 uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
153 const DataRanges& ranges, Bool isInclude,
154 const std::vector<StatsHistogram<AccumType>>& hist,
155 const std::vector<AccumType>& maxLimit
156 ) const;
157
158 virtual void _findBins(
159 std::vector<std::vector<uInt64>>& binCounts,
160 std::vector<std::shared_ptr<AccumType>>& sameVal,
161 std::vector<Bool>& allSame, const DataIterator& dataBegin,
162 const WeightsIterator& weightsBegin, uInt64 nr, uInt dataStride,
163 const std::vector<StatsHistogram<AccumType>>& hist,
164 const std::vector<AccumType>& maxLimit
165 ) const ;
166
167 virtual void _findBins(
168 std::vector<std::vector<uInt64>>& binCounts,
169 std::vector<std::shared_ptr<AccumType>>& sameVal,
170 std::vector<Bool>& allSame, const DataIterator& dataBegin,
171 const WeightsIterator& weightsBegin, uInt64 nr, uInt dataStride,
172 const DataRanges& ranges, Bool isInclude,
173 const std::vector<StatsHistogram<AccumType>>& hist,
174 const std::vector<AccumType>& maxLimit
175 ) const;
176
177 virtual void _findBins(
178 std::vector<std::vector<uInt64>>& binCounts,
179 std::vector<std::shared_ptr<AccumType>>& sameVal,
180 std::vector<Bool>& allSame, const DataIterator& dataBegin,
181 const WeightsIterator& weightsBegin, uInt64 nr, uInt dataStride,
182 const MaskIterator& maskBegin, uInt maskStride,
183 const DataRanges& ranges, Bool isInclude,
184 const std::vector<StatsHistogram<AccumType>>& hist,
185 const std::vector<AccumType>& maxLimit
186 ) const;
187
188 virtual void _findBins(
189 std::vector<std::vector<uInt64>>& binCounts,
190 std::vector<std::shared_ptr<AccumType>>& sameVal,
191 std::vector<Bool>& allSame, const DataIterator& dataBegin,
192 const WeightsIterator& weightBegin, uInt64 nr, uInt dataStride,
193 const MaskIterator& maskBegin, uInt maskStride,
194 const std::vector<StatsHistogram<AccumType>>& hist,
195 const std::vector<AccumType>& maxLimit
196 ) const;
197 // </group>
198
199 //<group>
200 // populate an unsorted array with valid data.
201 // no weights, no mask, no ranges
202 virtual void _populateArray(
203 std::vector<AccumType>& ary, const DataIterator& dataBegin, uInt64 nr,
204 uInt dataStride
205 ) const;
206
207 // ranges
208 virtual void _populateArray(
209 std::vector<AccumType>& ary, const DataIterator& dataBegin, uInt64 nr,
210 uInt dataStride, const DataRanges& ranges, Bool isInclude
211 ) const;
212
213 virtual void _populateArray(
214 std::vector<AccumType>& ary, const DataIterator& dataBegin,
215 uInt64 nr, uInt dataStride, const MaskIterator& maskBegin,
216 uInt maskStride
217 ) const;
218
219 // mask and ranges
220 virtual void _populateArray(
221 std::vector<AccumType>& ary, const DataIterator& dataBegin, uInt64 nr,
222 uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
223 const DataRanges& ranges, Bool isInclude
224 ) const;
225
226 // weights
227 virtual void _populateArray(
228 std::vector<AccumType>& ary, const DataIterator& dataBegin,
229 const WeightsIterator& weightsBegin, uInt64 nr, uInt dataStride
230 ) const;
231
232 // weights and ranges
233 virtual void _populateArray(
234 std::vector<AccumType>& ary, const DataIterator& dataBegin,
235 const WeightsIterator& weightsBegin, uInt64 nr, uInt dataStride,
236 const DataRanges& ranges, Bool isInclude
237 ) const;
238
239 // weights and mask
240 virtual void _populateArray(
241 std::vector<AccumType>& ary, const DataIterator& dataBegin,
242 const WeightsIterator& weightBegin, uInt64 nr, uInt dataStride,
243 const MaskIterator& maskBegin, uInt maskStride
244 ) const;
245
246 // weights, mask, ranges
247 virtual void _populateArray(
248 std::vector<AccumType>& ary, const DataIterator& dataBegin,
249 const WeightsIterator& weightBegin, uInt64 nr, uInt dataStride,
250 const MaskIterator& maskBegin, uInt maskStride,
251 const DataRanges& ranges, Bool isInclude
252 ) const;
253 // </group>
254
255 // <group>
256 // Create a std::vector of unsorted arrays, one array for each bin defined
257 // by <src>includeLimits</src>. <src>includeLimits</src> should be
258 // non-overlapping and should be given in ascending order (the algorithm
259 // used assumes this). Once the sum of the lengths of all arrays equals
260 // <src>maxCount</src> the method will return with no further processing.
261 // no weights, no mask, no ranges
262 virtual void _populateArrays(
263 std::vector<std::vector<AccumType>>& arys, uInt64& currentCount,
264 const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
265 const IncludeLimits& includeLimits, uInt64 maxCount
266 ) const;
267
268 // ranges
269 virtual void _populateArrays(
270 std::vector<std::vector<AccumType>>& arys, uInt64& currentCount,
271 const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
272 const DataRanges& ranges, Bool isInclude,
273 const IncludeLimits& includeLimits, uInt64 maxCount
274 ) const;
275
276 virtual void _populateArrays(
277 std::vector<std::vector<AccumType>>& arys, uInt64& currentCount,
278 const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
279 const MaskIterator& maskBegin, uInt maskStride,
280 const IncludeLimits& includeLimits, uInt64 maxCount
281 ) const;
282
283 // mask and ranges
284 virtual void _populateArrays(
285 std::vector<std::vector<AccumType>>& arys, uInt64& currentCount,
286 const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
287 const MaskIterator& maskBegin, uInt maskStride,
288 const DataRanges& ranges, Bool isInclude,
289 const IncludeLimits& includeLimits, uInt64 maxCount
290 ) const;
291
292 // weights
293 virtual void _populateArrays(
294 std::vector<std::vector<AccumType>>& arys, uInt64& currentCount,
295 const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
296 uInt64 nr, uInt dataStride, const IncludeLimits& includeLimits,
297 uInt64 maxCount
298 ) const;
299
300 // weights and ranges
301 virtual void _populateArrays(
302 std::vector<std::vector<AccumType>>& arys, uInt64& currentCount,
303 const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
304 uInt64 nr, uInt dataStride, const DataRanges& ranges, Bool isInclude,
305 const IncludeLimits& includeLimits, uInt64 maxCount
306 ) const;
307
308 // weights and mask
309 virtual void _populateArrays(
310 std::vector<std::vector<AccumType>>& arys, uInt64& currentCount,
311 const DataIterator& dataBegin, const WeightsIterator& weightBegin,
312 uInt64 nr, uInt dataStride, const MaskIterator& maskBegin,
313 uInt maskStride, const IncludeLimits& includeLimits, uInt64 maxCount
314 ) const;
315
316 // weights, mask, ranges
317 virtual void _populateArrays(
318 std::vector<std::vector<AccumType>>& arys, uInt64& currentCount,
319 const DataIterator& dataBegin, const WeightsIterator& weightBegin,
320 uInt64 nr, uInt dataStride, const MaskIterator& maskBegin,
321 uInt maskStride, const DataRanges& ranges, Bool isInclude,
322 const IncludeLimits& includeLimits, uInt64 maxCount
323 ) const;
324 // </group>
325
326 // <group>
327 // no weights, no mask, no ranges
329 std::vector<AccumType>& ary, const DataIterator& dataBegin,
330 uInt64 nr, uInt dataStride, uInt maxElements
331 ) const;
332
333 // ranges
335 std::vector<AccumType>& ary, const DataIterator& dataBegin, uInt64 nr,
336 uInt dataStride, const DataRanges& ranges, Bool isInclude,
337 uInt maxElements
338 ) const;
339
340 // mask
342 std::vector<AccumType>& ary, const DataIterator& dataBegin,
343 uInt64 nr, uInt dataStride, const MaskIterator& maskBegin,
344 uInt maskStride, uInt maxElements
345 ) const;
346
347 // mask and ranges
349 std::vector<AccumType>& ary, const DataIterator& dataBegin, uInt64 nr,
350 uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
351 const DataRanges& ranges, Bool isInclude, uInt maxElements
352 ) const;
353
354 // weights
356 std::vector<AccumType>& ary, const DataIterator& dataBegin,
357 const WeightsIterator& weightBegin, uInt64 nr, uInt dataStride,
358 uInt maxElements
359 ) const;
360
361 // weights and ranges
363 std::vector<AccumType>& ary, const DataIterator& dataBegin,
364 const WeightsIterator& weightsBegin, uInt64 nr, uInt dataStride,
365 const DataRanges& ranges, Bool isInclude, uInt maxElements
366 ) const;
367
368 // weights and mask
370 std::vector<AccumType>& ary, const DataIterator& dataBegin,
371 const WeightsIterator& weightBegin, uInt64 nr, uInt dataStride,
372 const MaskIterator& maskBegin, uInt maskStride, uInt maxElements
373 ) const;
374
375 // weights, mask, ranges
377 std::vector<AccumType>& ary, const DataIterator& dataBegin,
378 const WeightsIterator& weightBegin, uInt64 nr, uInt dataStride,
379 const MaskIterator& maskBegin, uInt maskStride,
380 const DataRanges& ranges, Bool isInclude, uInt maxElements
381 ) const;
382 // </group>
383
384 // get values from sorted array if the array is small enough to be held in
385 // memory. Note that this is the array containing all good data, not data in
386 // just a single bin representing a subset of good data.
387 // Returns True if the data were successfully retrieved.
388 // If True is returned, the values map will contain a map of index to value.
389 // It is the caller's responsibility to check that <src>mynpts</src> is not
390 // 0; no checking is done here.
392 std::map<uInt64, AccumType>& values, uInt64 mynpts,
393 const std::set<uInt64>& indices, uInt64 maxArraySize,
394 Bool persistSortedArray
395 );
396
397private:
398
400 // for use in often repeatedly run macros
401 AccumType _myMedian{0};
402
403 // tally the number of data points that fall into each bin provided by
404 // <src>hist</src>. Any points that are less than hist.minLimit or greater
405 // than hist.minLimit + hist.nBins*hist.binWidth are not included in the
406 // counts. A data point that falls exactly on a bin boundary is considered
407 // to be in the higher index bin. <src>sameVal</src> will be non-null if all
408 // the good values in the histogram range are the same. In that case, the
409 // value held will be the value of each of those data points.
410 std::vector<std::vector<uInt64>> _binCounts(
411 std::vector<std::shared_ptr<AccumType>>& sameVal,
412 const std::vector<StatsHistogram<AccumType>>& hist
413 );
414
416 std::vector<std::vector<uInt64>>& bins,
417 std::vector<std::shared_ptr<AccumType>>& sameVal,
418 std::vector<Bool>& allSame, DataIterator dataIter,
419 MaskIterator maskIter, WeightsIterator weightsIter, uInt64 count,
420 const std::vector<StatsHistogram<AccumType>>& hist,
421 const std::vector<AccumType>& maxLimit,
422 const typename StatisticsDataset<CASA_STATP>::ChunkData& chunk
423 );
424
426 std::vector<AccumType>& ary, DataIterator dataIter,
427 MaskIterator maskIter, WeightsIterator weightsIter, uInt64 dataCount,
428 const typename StatisticsDataset<CASA_STATP>::ChunkData& chunk
429 );
430
432 std::vector<std::vector<AccumType>>& arys, uInt64& currentCount,
433 DataIterator dataIter, MaskIterator maskIter,
434 WeightsIterator weightsIter, uInt64 dataCount,
435 const IncludeLimits& includeLimits, uInt64 maxCount,
436 const typename StatisticsDataset<CASA_STATP>::ChunkData& chunk
437 );
438
439 // Create an unsorted array of the complete data set. If
440 // <src>includeLimits</src> is specified, only points within those limits
441 // (including min but excluding max, as per definition of bins), are
442 // included.
443 void _createDataArray(std::vector<AccumType>& array);
444
446 std::vector<std::vector<AccumType>>& arrays,
447 const IncludeLimits& includeLimits, uInt64 maxCount
448 );
449
450 // extract data from multiple histograms given by <src>hist</src>.
451 // <src>dataIndices</src> represent the indices of the sorted arrays of
452 // values to extract. There should be exactly one set of data indices to
453 // extract for each supplied histogram. The data indices are relative to the
454 // minimum value of the minimum bin in their respective histograms. The
455 // ordering of the maps in the returned std::vector represent the ordering
456 // of histograms in <src>hist</src>. <src>hist</src> should contain
457 // non-overlapping histograms and the histograms should be specified in
458 // ascending order.
459 std::vector<IndexValueMap> _dataFromMultipleBins(
460 const std::vector<StatsHistogram<AccumType>>& hist,
461 uInt64 maxArraySize, const std::vector<IndexSet>& dataIndices,
462 uInt nBins
463 );
464
465 std::vector<IndexValueMap> _dataFromSingleBins(
466 const std::vector<uInt64>& binNpts, uInt64 maxArraySize,
467 const IncludeLimits& binLimits,
468 const std::vector<IndexSet>& dataIndices, uInt nBins
469 );
470
471 // get the values for the specified indices in the sorted array of all good
472 // data
474 uInt64 mynpts, AccumType mymin, AccumType mymax, uInt64 maxArraySize,
475 const IndexSet& dataIndices, Bool persistSortedArray, uInt nBins
476 );
477
478 // get the index (for odd npts) or indices (for even npts) of the median of
479 // the sorted array.
481
482};
483
484}
485
486#ifndef CASACORE_NO_AUTO_TEMPLATES
487#include <casacore/scimath/StatsFramework/ClassicalQuantileComputer.tcc>
488#endif
489
490#endif
#define DataRanges
#define IncludeLimits
This class is used internally by ClassicalStatistics objects.
virtual Bool _populateTestArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude, uInt maxElements) const
mask and ranges
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.
virtual void _populateArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
populate an unsorted array with valid data.
virtual void _populateArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
static IndexSet _medianIndices(uInt64 mynpts)
get the index (for odd npts) or indices (for even npts) of the median of the sorted array.
virtual StatisticsAlgorithmQuantileComputer< CASA_STATP > * clone() const
clone this object by returning a pointer to a copy
virtual void reset()
reset the private fields
virtual Bool _populateTestArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude, uInt maxElements) const
weights, mask, ranges
virtual void _populateArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
mask and ranges
virtual void _findBins(std::vector< std::vector< uInt64 > > &binCounts, std::vector< std::shared_ptr< 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.
virtual void _findBins(std::vector< std::vector< uInt64 > > &binCounts, std::vector< std::shared_ptr< AccumType > > &sameVal, std::vector< Bool > &allSame, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude, const std::vector< StatsHistogram< AccumType > > &hist, const std::vector< AccumType > &maxLimit) const
ClassicalQuantileComputer(StatisticsDataset< CASA_STATP > *dataset)
virtual void _findBins(std::vector< std::vector< uInt64 > > &binCounts, std::vector< std::shared_ptr< AccumType > > &sameVal, std::vector< Bool > &allSame, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const std::vector< StatsHistogram< AccumType > > &hist, const std::vector< AccumType > &maxLimit) const
virtual void _populateArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
ranges
virtual void _populateArrays(std::vector< std::vector< AccumType > > &arys, uInt64 &currentCount, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const IncludeLimits &includeLimits, uInt64 maxCount) const
weights
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
virtual void _populateArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride) const
weights
virtual void _populateArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
weights and ranges
ClassicalQuantileComputer & operator=(const ClassicalQuantileComputer &other)
copy semantics
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 void _populateArrays(std::vector< std::vector< AccumType > > &arys, uInt64 &currentCount, 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.
void _computeDataArray(std::vector< AccumType > &ary, DataIterator dataIter, MaskIterator maskIter, WeightsIterator weightsIter, uInt64 dataCount, const typename StatisticsDataset< CASA_STATP >::ChunkData &chunk)
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.
typename std::map< uInt64, AccumType > IndexValueMap
virtual Bool _populateTestArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude, uInt maxElements) const
ranges
virtual void _populateArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
weights, mask, ranges
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...
virtual void _populateArrays(std::vector< std::vector< AccumType > > &arys, uInt64 &currentCount, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude, const IncludeLimits &includeLimits, uInt64 maxCount) const
weights and ranges
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 void _findBins(std::vector< std::vector< uInt64 > > &binCounts, std::vector< std::shared_ptr< AccumType > > &sameVal, std::vector< Bool > &allSame, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude, const std::vector< StatsHistogram< AccumType > > &hist, const std::vector< AccumType > &maxLimit) const
virtual void _findBins(std::vector< std::vector< uInt64 > > &binCounts, std::vector< std::shared_ptr< AccumType > > &sameVal, std::vector< Bool > &allSame, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const std::vector< StatsHistogram< AccumType > > &hist, const std::vector< AccumType > &maxLimit) const
std::pair< AccumType, AccumType > LimitPair
virtual void _findBins(std::vector< std::vector< uInt64 > > &binCounts, std::vector< std::shared_ptr< AccumType > > &sameVal, std::vector< Bool > &allSame, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const std::vector< StatsHistogram< AccumType > > &hist, const std::vector< AccumType > &maxLimit) const
virtual void _populateArrays(std::vector< std::vector< AccumType > > &arys, uInt64 &currentCount, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude, const IncludeLimits &includeLimits, uInt64 maxCount) const
ranges
virtual void _populateArrays(std::vector< std::vector< AccumType > > &arys, uInt64 &currentCount, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const IncludeLimits &includeLimits, uInt64 maxCount) const
weights and mask
virtual void _populateArrays(std::vector< std::vector< AccumType > > &arys, uInt64 &currentCount, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude, const IncludeLimits &includeLimits, uInt64 maxCount) const
weights, mask, ranges
void _createDataArrays(std::vector< std::vector< AccumType > > &arrays, const IncludeLimits &includeLimits, uInt64 maxCount)
virtual Bool _populateTestArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, uInt maxElements) const
weights and mask
virtual Bool _populateTestArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude, uInt maxElements) const
weights and ranges
void _computeDataArrays(std::vector< std::vector< AccumType > > &arys, uInt64 &currentCount, DataIterator dataIter, MaskIterator maskIter, WeightsIterator weightsIter, uInt64 dataCount, const IncludeLimits &includeLimits, uInt64 maxCount, const typename StatisticsDataset< CASA_STATP >::ChunkData &chunk)
virtual void _populateArrays(std::vector< std::vector< AccumType > > &arys, uInt64 &currentCount, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude, const IncludeLimits &includeLimits, uInt64 maxCount) const
mask and ranges
virtual Bool _populateTestArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, uInt maxElements) const
mask
virtual void _findBins(std::vector< std::vector< uInt64 > > &binCounts, std::vector< std::shared_ptr< AccumType > > &sameVal, std::vector< Bool > &allSame, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude, const std::vector< StatsHistogram< AccumType > > &hist, const std::vector< AccumType > &maxLimit) const
void _createDataArray(std::vector< AccumType > &array)
Create an unsorted array of the complete data set.
virtual void _populateArrays(std::vector< std::vector< AccumType > > &arys, uInt64 &currentCount, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const IncludeLimits &includeLimits, uInt64 maxCount) const
std::vector< std::vector< uInt64 > > _binCounts(std::vector< std::shared_ptr< AccumType > > &sameVal, const std::vector< StatsHistogram< AccumType > > &hist)
tally the number of data points that fall into each bin provided by hist.
AccumType _myMedian
for use in often repeatedly run macros
void _computeBins(std::vector< std::vector< uInt64 > > &bins, std::vector< std::shared_ptr< 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)
virtual Bool _populateTestArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, uInt maxElements) const
no weights, no mask, no ranges
virtual void _findBins(std::vector< std::vector< uInt64 > > &binCounts, std::vector< std::shared_ptr< AccumType > > &sameVal, std::vector< Bool > &allSame, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude, const std::vector< StatsHistogram< AccumType > > &hist, const std::vector< AccumType > &maxLimit) const
typename std::vector< LimitPair >::const_iterator LimitPairVectorIter
std::vector< IndexValueMap > _dataFromSingleBins(const std::vector< uInt64 > &binNpts, uInt64 maxArraySize, const IncludeLimits &binLimits, const std::vector< IndexSet > &dataIndices, uInt nBins)
virtual void _populateArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
weights and mask
ClassicalQuantileComputer(const ClassicalQuantileComputer &other)
copy semantics
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 Bool _populateTestArray(std::vector< AccumType > &ary, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, uInt maxElements) const
weights
This is the virtual base class from which concrete QuantileComputer classes are derived.
Representation of a statistics dataset used in statistics framework calculatations.
Represents an unfilled histogram with equal width bins for binning used for quantile computations.
this file contains all the compiler specific defines
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
unsigned int uInt
Definition aipstype.h:49
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
Definition ExprNode.h:1933
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
unsigned long long uInt64
Definition aipsxtype.h:37
holds information about a data chunk.