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>, std_ddof=0, axis=None)[source] [edit on github]¶ Calculate sigma-clipped statistics on the provided data.
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 aTruevalue indicates the corresponding element ofdatais masked. Masked pixels are excluded when computing the statistics.mask_value : float, optional
A data value (e.g.,
0.0) that is ignored when computing the statistics.mask_valuewill 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_lowerandsigma_upper, if input. Defaults to 3.sigma_lower : float, optional
The number of standard deviations to use as the lower bound for the clipping limit. If
Nonethen the value ofsigmais used. Defaults toNone.sigma_upper : float, optional
The number of standard deviations to use as the upper bound for the clipping limit. If
Nonethen the value ofsigmais used. Defaults toNone.iters : int, optional
The number of iterations to perform sigma clipping, or
Noneto clip until convergence is achieved (i.e., continue until the last iteration clips nothing) when calculating the 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).std_ddof : int, optional
The delta degrees of freedom for the standard deviation calculation. The divisor used in the calculation is
N - std_ddof, whereNrepresents the number of elements. The default is zero.axis : int or
None, optionalIf not
None, clip along the given axis. For this case,axiswill be passed on tocenfuncandstdfunc, which are expected to return an array with the axis dimension removed (like the numpy functions). IfNone, clip over all axes. Defaults toNone.Returns: mean, median, stddev : float
The mean, median, and standard deviation of the sigma-clipped data.