casacore
Loading...
Searching...
No Matches
ConstrainedRangeStatistics.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_CONSTRAINEDRANGESTATISTICS_H
27#define SCIMATH_CONSTRAINEDRANGESTATISTICS_H
28
29#include <casacore/casa/aips.h>
30
31#include <casacore/scimath/StatsFramework/ClassicalStatistics.h>
32#include <casacore/scimath/StatsFramework/ConstrainedRangeQuantileComputer.h>
33
34#include <set>
35#include <vector>
36#include <utility>
37
38namespace casacore {
39
40// Abstract base class for statistics algorithms which are characterized by
41// a range of good values. The range is usually calculated dynamically based
42// on the entire distribution. The specifics of such calculations are
43// delegated to derived classes.
44
45template <class AccumType, class DataIterator, class MaskIterator = const Bool*,
46 class WeightsIterator = DataIterator>
48 public:
50
52
53 // <group>
54 // In the following group of methods, if the size of the composite dataset
55 // is smaller than
56 // <src>binningThreshholdSizeBytes</src>, the composite dataset
57 // will be (perhaps partially) sorted and persisted in memory during the
58 // call. In that case, and if <src>persistSortedArray</src> is True, this
59 // sorted array will remain in memory after the call and will be used on
60 // subsequent calls of this method when
61 // <src>binningThreshholdSizeBytes</src> is greater than the size of the
62 // composite dataset. If <src>persistSortedArray</src> is False, the sorted
63 // array will not be stored after this call completes and so any subsequent
64 // calls for which the dataset size is less than
65 // <src>binningThreshholdSizeBytes</src>, the dataset will be sorted from
66 // scratch. Values which are not included due to non-unity strides, are not
67 // included in any specified ranges, are masked, or have associated weights
68 // of zero are not considered as dataset members for quantile computations.
69 // If one has a priori information regarding the number of points (npts)
70 // and/or the minimum and maximum values of the data set, these can be
71 // supplied to improve performance. Note however, that if these values are
72 // not correct, the resulting median and/or quantile values will also not be
73 // correct (although see the following notes regarding max/min). Note that
74 // if this object has already had getStatistics() called, and the min and
75 // max were calculated, there is no need to pass these values in as they
76 // have been stored internally and used (although passing them in shouldn't
77 // hurt anything). If provided, npts, the number of points falling in the
78 // specified ranges which are not masked and have weights > 0, should be
79 // exactly correct. <src>min</src> can be less than the true minimum, and
80 // <src>max</src> can be greater than the True maximum, but for best
81 // performance, these should be as close to the actual min and max as
82 // possible. In order for quantile computations to occur over multiple
83 // datasets, all datasets must be available. This means that if
84 // setCalculateAsAdded() was previously called by passing in a value of
85 // True, these methods will throw an exception as the previous call
86 // indicates that there is no guarantee that all datasets will be available.
87 // If one uses a data provider (by having called setDataProvider()), then
88 // this should not be an issue.
89
90 // get the median of the distribution.
91 // For a dataset with an odd number of good points, the median is just the
92 // value at index int(N/2) in the equivalent sorted dataset, where N is the
93 // number of points. For a dataset with an even number of points, the median
94 // is the mean of the values at indices int(N/2)-1 and int(N/2) in the
95 // sorted dataset.
96 virtual AccumType getMedian(std::shared_ptr<uInt64> knownNpts = nullptr,
97 std::shared_ptr<AccumType> knownMin = nullptr,
98 std::shared_ptr<AccumType> knownMax = nullptr,
99 uInt binningThreshholdSizeBytes = 4096 * 4096,
100 Bool persistSortedArray = False, uInt nBins = 10000);
101
102 // get the median of the absolute deviation about the median of the data.
103 virtual AccumType getMedianAbsDevMed(std::shared_ptr<uInt64> knownNpts = nullptr,
104 std::shared_ptr<AccumType> knownMin = nullptr,
105 std::shared_ptr<AccumType> knownMax = nullptr,
106 uInt binningThreshholdSizeBytes = 4096 * 4096,
107 Bool persistSortedArray = False, uInt nBins = 10000);
108
109 // If one needs to compute both the median and quantile values, it is better
110 // to call getMedianAndQuantiles() rather than getMedian() and
111 // getQuantiles() separately, as the first will scan large data sets fewer
112 // times than calling the separate methods. The return value is the median;
113 // the quantiles are returned in the <src>quantileToValue</src> map.
114 virtual AccumType getMedianAndQuantiles(std::map<Double, AccumType>& quantileToValue,
115 const std::set<Double>& quantiles,
116 std::shared_ptr<uInt64> knownNpts = nullptr,
117 std::shared_ptr<AccumType> knownMin = nullptr,
118 std::shared_ptr<AccumType> knownMax = nullptr,
119 uInt binningThreshholdSizeBytes = 4096 * 4096,
120 Bool persistSortedArray = False, uInt nBins = 10000);
121
122 // Get the specified quantiles. <src>quantiles</src> must be between 0 and
123 // 1, noninclusive.
124 virtual std::map<Double, AccumType> getQuantiles(const std::set<Double>& quantiles,
125 std::shared_ptr<uInt64> knownNpts = nullptr,
126 std::shared_ptr<AccumType> knownMin = nullptr,
127 std::shared_ptr<AccumType> knownMax = NULL,
128 uInt binningThreshholdSizeBytes = 4096 * 4096,
129 Bool persistSortedArray = False,
130 uInt nBins = 10000);
131 // </group>
132
133 // get the min and max of the data set
134 virtual void getMinMax(AccumType& mymin, AccumType& mymax);
135
136 // scan the dataset(s) that have been added, and find the number of good
137 // points. This method may be called even if setStatsToCaclulate has been
138 // called and NPTS has been excluded. If setCalculateAsAdded(True) has
139 // previously been called after this object has been (re)initialized, an
140 // exception will be thrown.
141 virtual uInt64 getNPts();
142
143 // see base class description
145
146 // reset object to initial state. Clears all private fields including data,
147 // accumulators, global range.
148 virtual void reset();
149
150 protected:
151 // Concrete derived classes are responsible for providing an appropriate
152 // QuantileComputer object to the constructor, which is ultimately passed
153 // up the instantiation hierarchy and stored at the StatisticsAlgorithm
154 // level.
156
157 // copy semantics
159
160 // copy semantics
163
164 // <group>
165 // scan through the data set to determine the number of good (unmasked,
166 // weight > 0, within range) points. The first with no mask, no ranges, and
167 // no weights is trivial with npts = nr in this class, but is implemented
168 // here so that derived classes may override it.
169 virtual void _accumNpts(uInt64& npts, const DataIterator& dataStart, uInt64 nr,
170 uInt dataStride) const;
171
172 virtual void _accumNpts(uInt64& npts, const DataIterator& dataStart, uInt64 nr, uInt dataStride,
173 const DataRanges& ranges, Bool isInclude) const;
174
175 virtual void _accumNpts(uInt64& npts, const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
176 const MaskIterator& maskBegin, uInt maskStride) const;
177
178 virtual void _accumNpts(uInt64& npts, const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
179 const MaskIterator& maskBegin, uInt maskStride, const DataRanges& ranges,
180 Bool isInclude) const;
181
182 virtual void _accumNpts(uInt64& npts, const DataIterator& dataBegin,
183 const WeightsIterator& weightsBegin, uInt64 nr, uInt dataStride) const;
184
185 virtual void _accumNpts(uInt64& npts, const DataIterator& dataBegin,
186 const WeightsIterator& weightsBegin, uInt64 nr, uInt dataStride,
187 const DataRanges& ranges, Bool isInclude) const;
188
189 virtual void _accumNpts(uInt64& npts, const DataIterator& dataBegin,
190 const WeightsIterator& weightsBegin, uInt64 nr, uInt dataStride,
191 const MaskIterator& maskBegin, uInt maskStride, const DataRanges& ranges,
192 Bool isInclude) const;
193
194 virtual void _accumNpts(uInt64& npts, const DataIterator& dataBegin,
195 const WeightsIterator& weightBegin, uInt64 nr, uInt dataStride,
196 const MaskIterator& maskBegin, uInt maskStride) const;
197 // </group>
198
199 virtual AccumType _getStatistic(StatisticsData::STATS stat);
200
202
203 // <group>
204 virtual void _minMax(std::shared_ptr<AccumType>& mymin, std::shared_ptr<AccumType>& mymax,
205 const DataIterator& dataBegin, uInt64 nr, uInt dataStride) const;
206
207 virtual void _minMax(std::shared_ptr<AccumType>& mymin, std::shared_ptr<AccumType>& mymax,
208 const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
209 const DataRanges& ranges, Bool isInclude) const;
210
211 virtual void _minMax(std::shared_ptr<AccumType>& mymin, std::shared_ptr<AccumType>& mymax,
212 const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
213 const MaskIterator& maskBegin, uInt maskStride) const;
214
215 virtual void _minMax(std::shared_ptr<AccumType>& mymin, std::shared_ptr<AccumType>& mymax,
216 const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
217 const MaskIterator& maskBegin, uInt maskStride, const DataRanges& ranges,
218 Bool isInclude) const;
219
220 virtual void _minMax(std::shared_ptr<AccumType>& mymin, std::shared_ptr<AccumType>& mymax,
221 const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
222 uInt64 nr, uInt dataStride) const;
223
224 virtual void _minMax(std::shared_ptr<AccumType>& mymin, std::shared_ptr<AccumType>& mymax,
225 const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
226 uInt64 nr, uInt dataStride, const DataRanges& ranges, Bool isInclude) const;
227
228 virtual void _minMax(std::shared_ptr<AccumType>& mymin, std::shared_ptr<AccumType>& mymax,
229 const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
230 uInt64 nr, uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
231 const DataRanges& ranges, Bool isInclude) const;
232
233 virtual void _minMax(std::shared_ptr<AccumType>& mymin, std::shared_ptr<AccumType>& mymax,
234 const DataIterator& dataBegin, const WeightsIterator& weightBegin, uInt64 nr,
235 uInt dataStride, const MaskIterator& maskBegin, uInt maskStride) const;
236 // </group>
237
238 // <group>
239 // Sometimes we want the min, max, and npts all in one scan.
240 virtual void _minMaxNpts(uInt64& npts, std::shared_ptr<AccumType>& mymin,
241 std::shared_ptr<AccumType>& mymax, const DataIterator& dataBegin,
242 uInt64 nr, uInt dataStride) const;
243
244 virtual void _minMaxNpts(uInt64& npts, std::shared_ptr<AccumType>& mymin,
245 std::shared_ptr<AccumType>& mymax, const DataIterator& dataBegin,
246 uInt64 nr, uInt dataStride, const DataRanges& ranges,
247 Bool isInclude) const;
248
249 virtual void _minMaxNpts(uInt64& npts, std::shared_ptr<AccumType>& mymin,
250 std::shared_ptr<AccumType>& mymax, const DataIterator& dataBegin,
251 uInt64 nr, uInt dataStride, const MaskIterator& maskBegin,
252 uInt maskStride) const;
253
254 virtual void _minMaxNpts(uInt64& npts, std::shared_ptr<AccumType>& mymin,
255 std::shared_ptr<AccumType>& mymax, const DataIterator& dataBegin,
256 uInt64 nr, uInt dataStride, const MaskIterator& maskBegin,
257 uInt maskStride, const DataRanges& ranges, Bool isInclude) const;
258
259 virtual void _minMaxNpts(uInt64& npts, std::shared_ptr<AccumType>& mymin,
260 std::shared_ptr<AccumType>& mymax, const DataIterator& dataBegin,
261 const WeightsIterator& weightsBegin, uInt64 nr, uInt dataStride) const;
262
263 virtual void _minMaxNpts(uInt64& npts, std::shared_ptr<AccumType>& mymin,
264 std::shared_ptr<AccumType>& mymax, const DataIterator& dataBegin,
265 const WeightsIterator& weightsBegin, uInt64 nr, uInt dataStride,
266 const DataRanges& ranges, Bool isInclude) const;
267
268 virtual void _minMaxNpts(uInt64& npts, std::shared_ptr<AccumType>& mymin,
269 std::shared_ptr<AccumType>& mymax, const DataIterator& dataBegin,
270 const WeightsIterator& weightsBegin, uInt64 nr, uInt dataStride,
271 const MaskIterator& maskBegin, uInt maskStride, const DataRanges& ranges,
272 Bool isInclude) const;
273
274 virtual void _minMaxNpts(uInt64& npts, std::shared_ptr<AccumType>& mymin,
275 std::shared_ptr<AccumType>& mymax, const DataIterator& dataBegin,
276 const WeightsIterator& weightBegin, uInt64 nr, uInt dataStride,
277 const MaskIterator& maskBegin, uInt maskStride) const;
278 // </group>
279
280 // This method is purposefully non-virtual. Derived classes
281 // should implement the version with no parameters.
282 void _setRange(std::shared_ptr<std::pair<AccumType, AccumType>> r);
283
284 // derived classes need to implement how to set their respective range
285 virtual void _setRange() = 0;
286
287 // <group>
288 // no weights, no mask, no ranges
289 virtual void _unweightedStats(StatsData<AccumType>& stats, uInt64& ngood, LocationType& location,
290 const DataIterator& dataBegin, uInt64 nr, uInt dataStride);
291
292 // no weights, no mask
293 virtual void _unweightedStats(StatsData<AccumType>& stats, uInt64& ngood, LocationType& location,
294 const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
295 const DataRanges& ranges, Bool isInclude);
296
297 virtual void _unweightedStats(StatsData<AccumType>& stats, uInt64& ngood, LocationType& location,
298 const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
299 const MaskIterator& maskBegin, uInt maskStride);
300
301 virtual void _unweightedStats(StatsData<AccumType>& stats, uInt64& ngood, LocationType& location,
302 const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
303 const MaskIterator& maskBegin, uInt maskStride,
304 const DataRanges& ranges, Bool isInclude);
305 // </group>
306
307 // <group>
308 // has weights, but no mask, no ranges
309 virtual void _weightedStats(StatsData<AccumType>& stats, LocationType& location,
310 const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
311 uInt64 nr, uInt dataStride);
312
313 virtual void _weightedStats(StatsData<AccumType>& stats, LocationType& location,
314 const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
315 uInt64 nr, uInt dataStride, const DataRanges& ranges, Bool isInclude);
316
317 virtual void _weightedStats(StatsData<AccumType>& stats, LocationType& location,
318 const DataIterator& dataBegin, const WeightsIterator& weightBegin,
319 uInt64 nr, uInt dataStride, const MaskIterator& maskBegin,
320 uInt maskStride);
321
322 virtual void _weightedStats(StatsData<AccumType>& stats, LocationType& location,
323 const DataIterator& dataBegin, const WeightsIterator& weightBegin,
324 uInt64 nr, uInt dataStride, const MaskIterator& maskBegin,
325 uInt maskStride, const DataRanges& ranges, Bool isInclude);
326 // </group>
327
328 private:
329 std::shared_ptr<std::pair<AccumType, AccumType>> _range{};
330};
331
332} // namespace casacore
333
334#ifndef CASACORE_NO_AUTO_TEMPLATES
335#include <casacore/scimath/StatsFramework/ConstrainedRangeStatistics.tcc>
336#endif
337
338#endif
#define DataRanges
Basic concrete QuantileComputer class for data constrained to be in a specified range.
virtual void _weightedStats(StatsData< AccumType > &stats, LocationType &location, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride)
virtual void _accumNpts(uInt64 &npts, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
virtual LocationType getStatisticIndex(StatisticsData::STATS stat)
see base class description
virtual void _unweightedStats(StatsData< AccumType > &stats, uInt64 &ngood, LocationType &location, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride)
virtual void _accumNpts(uInt64 &npts, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
virtual void _minMaxNpts(uInt64 &npts, std::shared_ptr< AccumType > &mymin, std::shared_ptr< AccumType > &mymax, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride) const
virtual void reset()
reset object to initial state.
virtual StatsData< AccumType > _getStatistics()
virtual void _accumNpts(uInt64 &npts, const DataIterator &dataStart, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
virtual void _minMaxNpts(uInt64 &npts, std::shared_ptr< AccumType > &mymin, std::shared_ptr< AccumType > &mymax, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
virtual void _minMaxNpts(uInt64 &npts, std::shared_ptr< AccumType > &mymin, std::shared_ptr< AccumType > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
virtual void _minMaxNpts(uInt64 &npts, std::shared_ptr< AccumType > &mymin, std::shared_ptr< AccumType > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
Sometimes we want the min, max, and npts all in one scan.
std::shared_ptr< std::pair< AccumType, AccumType > > _range
ConstrainedRangeStatistics(const ConstrainedRangeStatistics< CASA_STATP > &other)
copy semantics
virtual void _accumNpts(uInt64 &npts, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
ConstrainedRangeStatistics(std::shared_ptr< ConstrainedRangeQuantileComputer< CASA_STATP > > qc)
Concrete derived classes are responsible for providing an appropriate QuantileComputer object to the ...
virtual void _minMax(std::shared_ptr< AccumType > &mymin, std::shared_ptr< AccumType > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
virtual void _weightedStats(StatsData< AccumType > &stats, LocationType &location, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude)
virtual std::map< Double, AccumType > getQuantiles(const std::set< Double > &quantiles, std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< AccumType > knownMin=nullptr, std::shared_ptr< AccumType > knownMax=NULL, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
Get the specified quantiles.
virtual void _minMax(std::shared_ptr< AccumType > &mymin, std::shared_ptr< AccumType > &mymax, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
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)
get the median of the absolute deviation about the median of the data.
virtual void _minMax(std::shared_ptr< AccumType > &mymin, std::shared_ptr< AccumType > &mymax, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
virtual void _minMaxNpts(uInt64 &npts, std::shared_ptr< AccumType > &mymin, std::shared_ptr< AccumType > &mymax, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
virtual void _minMax(std::shared_ptr< AccumType > &mymin, std::shared_ptr< AccumType > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
virtual void getMinMax(AccumType &mymin, AccumType &mymax)
get the min and max of the data set
virtual void _unweightedStats(StatsData< AccumType > &stats, uInt64 &ngood, LocationType &location, const DataIterator &dataBegin, uInt64 nr, uInt dataStride)
no weights, no mask, no ranges
virtual void _accumNpts(uInt64 &npts, const DataIterator &dataStart, uInt64 nr, uInt dataStride) const
scan through the data set to determine the number of good (unmasked, weight > 0, within range) points...
ConstrainedRangeStatistics< CASA_STATP > & operator=(const ConstrainedRangeStatistics< CASA_STATP > &other)
copy semantics
virtual void _accumNpts(uInt64 &npts, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
virtual void _minMax(std::shared_ptr< AccumType > &mymin, std::shared_ptr< AccumType > &mymax, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
virtual void _minMax(std::shared_ptr< AccumType > &mymin, std::shared_ptr< AccumType > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
virtual void _minMaxNpts(uInt64 &npts, std::shared_ptr< AccumType > &mymin, std::shared_ptr< AccumType > &mymax, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
virtual AccumType _getStatistic(StatisticsData::STATS stat)
virtual void _accumNpts(uInt64 &npts, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
virtual void _weightedStats(StatsData< AccumType > &stats, LocationType &location, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride)
has weights, but no mask, no ranges
virtual 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
virtual 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)
virtual void _minMaxNpts(uInt64 &npts, std::shared_ptr< AccumType > &mymin, std::shared_ptr< AccumType > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
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)
In the following group of methods, if the size of the composite dataset is smaller than binningThresh...
virtual void _setRange()=0
derived classes need to implement how to set their respective range
virtual void _accumNpts(uInt64 &npts, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride) const
virtual uInt64 getNPts()
scan the dataset(s) that have been added, and find the number of good points.
virtual void _minMaxNpts(uInt64 &npts, std::shared_ptr< AccumType > &mymin, std::shared_ptr< AccumType > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
void _setRange(std::shared_ptr< std::pair< AccumType, AccumType > > r)
This method is purposefully non-virtual.
virtual void _minMax(std::shared_ptr< AccumType > &mymin, std::shared_ptr< AccumType > &mymax, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride) const
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)
If one needs to compute both the median and quantile values, it is better to call getMedianAndQuantil...
virtual 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)
virtual void _minMax(std::shared_ptr< AccumType > &mymin, std::shared_ptr< AccumType > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
unsigned int uInt
Definition aipstype.h:49
std::pair< Int64, Int64 > LocationType
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
unsigned long long uInt64
Definition aipsxtype.h:37