SigmaClippedStats#
- class scikitplot.cexternals._astropy.stats.SigmaClippedStats(data, *, mask=None, mask_value=None, sigma=3.0, sigma_lower=None, sigma_upper=None, maxiters=5, cenfunc='median', stdfunc='std', axis=None, grow=False)[source]#
Class to calculate sigma-clipped statistics on the provided data.
- Parameters:
- dataarray-like or
~numpy.ma.MaskedArray Data array or object that can be converted to an array.
- mask
numpy.ndarray(bool), optional A boolean mask with the same shape as
data, where aTruevalue indicates the corresponding element ofdatais masked. Masked pixels are excluded when computing the statistics.- mask_valuefloat, optional
A data value (e.g.,
0.0) that is ignored when computing the statistics.mask_valuewill be masked in addition to any inputmask.- sigmafloat, optional
The number of standard deviations to use for both the lower and upper clipping limit. These limits are overridden by
sigma_lowerandsigma_upper, if input. The default is 3.- sigma_lowerfloat or None, optional
The number of standard deviations to use as the lower bound for the clipping limit. If
Nonethen the value ofsigmais used. The default isNone.- sigma_upperfloat or None, optional
The number of standard deviations to use as the upper bound for the clipping limit. If
Nonethen the value ofsigmais used. The default isNone.- maxitersint or None, optional
The maximum number of sigma-clipping iterations to perform or
Noneto clip until convergence is achieved (i.e., iterate until the last iteration clips nothing). If convergence is achieved prior tomaxitersiterations, the clipping iterations will stop. The default is 5.- cenfunc{‘median’, ‘mean’} or callable, optional
The statistic or callable function/object used to compute the center value for the clipping. If using a callable function/object and the
axiskeyword is used, then it must be able to ignore NaNs (e.g.,numpy.nanmean) and it must have anaxiskeyword to return an array with axis dimension(s) removed. The default is'median'.- stdfunc{‘std’, ‘mad_std’} or callable, optional
The statistic or callable function/object used to compute the standard deviation about the center value. If using a callable function/object and the
axiskeyword is used, then it must be able to ignore NaNs (e.g.,numpy.nanstd) and it must have anaxiskeyword to return an array with axis dimension(s) removed. The default is'std'.- axisNone or int or tuple of int, optional
The axis or axes along which to sigma clip the data. If
None, then the flattened data will be used.axisis passed to thecenfuncandstdfunc. The default isNone.- growfloat or
False, optional Radius within which to mask the neighbouring pixels of those that fall outwith the clipping limits (only applied along
axis, if specified). As an example, for a 2D image a value of 1 will mask the nearest pixels in a cross pattern around each deviant pixel, while 1.5 will also reject the nearest diagonal neighbours and so on.
- dataarray-like or
- Parameters:
See also
Notes
The best performance will typically be obtained by setting
cenfuncandstdfuncto one of the built-in functions specified as a string. If one of the options is set to a string while the other has a custom callable, you may in some cases see better performance if you have the bottleneck package installed. To preserve accuracy, bottleneck is only used for float64 computations.- biweight_location(c=6.0, M=None)[source]#
Calculate the biweight location of the data.
NaN values are ignored.
- Parameters:
- cfloat, optional
Tuning constant for the biweight estimator. Default value is 6.0.
- Mfloat or None, optional
Initial guess for the biweight location. Default value is
None.
- Returns:
- biweight_locationfloat or
~numpy.ndarray The biweight location of the data.
- biweight_locationfloat or
- Parameters:
- Return type:
float | NDArray
- biweight_scale(c=6.0, M=None)[source]#
Calculate the biweight scale of the data.
NaN values are ignored.
- Parameters:
- cfloat, optional
Tuning constant for the biweight estimator. Default value is 6.0.
- Mfloat or None, optional
Initial guess for the biweight location. Default value is
None.
- Returns:
- biweight_scalefloat or
~numpy.ndarray The biweight scale of the data.
- biweight_scalefloat or
- Parameters:
- Return type:
float | NDArray
- mad_std()[source]#
Calculate the median absolute deviation (MAD) based standard deviation of the data.
NaN values are ignored.
- Returns:
- mad_stdfloat or
~numpy.ndarray The MAD-based standard deviation of the data.
- mad_stdfloat or
- Return type:
float | NDArray
- max()[source]#
Calculate the maximum of the data.
NaN values are ignored.
- Returns:
- maxfloat or
~numpy.ndarray The maximum of the data.
- maxfloat or
- Return type:
float | NDArray
- mean()[source]#
Calculate the mean of the data.
NaN values are ignored.
- Returns:
- meanfloat or
~numpy.ndarray The mean of the data.
- meanfloat or
- Return type:
float | NDArray
- median()[source]#
Calculate the median of the data.
NaN values are ignored.
- Returns:
- medianfloat or
~numpy.ndarray The median of the data.
- medianfloat or
- Return type:
float | NDArray
- min()[source]#
Calculate the minimum of the data.
NaN values are ignored.
- Returns:
- minfloat or
~numpy.ndarray The minimum of the data.
- minfloat or
- Return type:
float | NDArray
- mode(median_factor=3.0, mean_factor=2.0)[source]#
Calculate the mode of the data using a estimator of the form
(median_factor * median) - (mean_factor * mean).NaN values are ignored.
- Parameters:
- median_factorfloat, optional
The multiplicative factor for the data median. Defaults to 3.
- mean_factorfloat, optional
The multiplicative factor for the data mean. Defaults to 2.
- Returns:
- modefloat or
~numpy.ndarray The estimated mode of the data.
- modefloat or
- Parameters:
- Return type:
float | NDArray
- std(ddof=0)[source]#
Calculate the standard deviation of the data.
NaN values are ignored.
- Parameters:
- ddofint, optional
The delta degrees of freedom for the standard deviation calculation. The divisor used in the calculation is
N - ddof, whereNrepresents the number of elements. For a population standard deviation where you have data for the entire population, useddof=0. For a sample standard deviation where you have a sample of the population, useddof=1. The default is 0.
- Returns:
- stdfloat or
~numpy.ndarray The standard deviation of the data.
- stdfloat or
- Parameters:
ddof (int)
- Return type:
float | NDArray
- sum()[source]#
Calculate the sum of the data.
NaN values are ignored.
- Returns:
- sumfloat or
~numpy.ndarray The sum of the data.
- sumfloat or
- Return type:
float | NDArray
- var(ddof=0)[source]#
Calculate the variance of the data.
NaN values are ignored.
- Parameters:
- ddofint, optional
The delta degrees of freedom. The divisor used in the calculation is
N - ddof, whereNrepresents the number of elements. For a population variance where you have data for the entire population, useddof=0. For a sample variance where you have a sample of the population, useddof=1. The default is 0.
- Returns:
- varfloat or
~numpy.ndarray The variance of the data.
- varfloat or
- Parameters:
ddof (int)
- Return type:
float | NDArray