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), optional A boolean mask with the same shape as data, where a True value indicates the corresponding element of data is 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_value will be masked in addition to any input mask. sigma : float, optional The number of standard deviations to use as the lower and upper clipping limit. These limits are overridden by sigma_lower and sigma_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 None then the value of sigma is used. Defaults to None. sigma_upper : float, optional The number of standard deviations to use as the upper bound for the clipping limit. If None then the value of sigma is used. Defaults to None. 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 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, where N represents the number of elements. The default is zero. axis : int or None, optional If not None, clip along the given axis. For this case, axis will be passed on to cenfunc and stdfunc, which are expected to return an array with the axis dimension removed (like the numpy functions). If None, clip over all axes. Defaults to None. mean, median, stddev : float The mean, median, and standard deviation of the sigma-clipped data.