sigma_clipped_stats¶
-
astropy.stats.
sigma_clipped_stats
(data, mask=None, mask_value=None, sigma=3.0, sigma_lower=None, sigma_upper=None, iters=5, cenfunc=<function median>, stdfunc=<function std>, axis=None)[source] [edit on github]¶ Calculate sigma-clipped statistics from data.
For example, sigma-clipped statistics can be used to estimate the background and background noise in an image.
Parameters: data : array-like
Data array or object that can be converted to an array.
mask :
numpy.ndarray
(bool), optionalA boolean mask with the same shape as
data
, where aTrue
value indicates the corresponding element ofdata
is masked. Masked pixels are excluded when computing the image statistics.mask_value : float, optional
An image data value (e.g.,
0.0
) that is ignored when computing the image statistics.mask_value
will be masked in addition to any inputmask
.sigma : float, optional
The number of standard deviations to use as the lower and upper clipping limit. These limits are overridden by
sigma_lower
andsigma_upper
, if input. Defaults to 3.sigma_lower : float, optional
sigma_upper : float, optional
iters : int, optional
The number of iterations to perform sigma clipping, or
None
to clip until convergence is achieved (i.e., continue until the last iteration clips nothing) when calculating the image statistics. Defaults to 5.cenfunc : callable, optional
The function used to compute the center for the clipping. Must be a callable that takes in a masked array and outputs the central value. Defaults to the median (
numpy.ma.median
).stdfunc : callable, optional
The function used to compute the standard deviation about the center. Must be a callable that takes in a masked array and outputs a width estimator. Masked (rejected) pixels are those where:
deviation < (-sigma_lower * stdfunc(deviation)) deviation > (sigma_upper * stdfunc(deviation))
where:
deviation = data - cenfunc(data [,axis=int])
Defaults to the standard deviation (
numpy.std
).axis : int or
None
, optionalReturns: mean, median, stddev : float
The mean, median, and standard deviation of the sigma-clipped image.