astropy:docs

sigma_clipped_stats

astropy.stats.sigma_clipped_stats(data, mask=None, mask_val=None, sigma=3.0, iters=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), 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 image statistics.

mask_val : float, optional

An image data value (e.g., 0.0) that is ignored when computing the image statistics. mask_val will be masked in addition to any input mask.

sigma : float, optional

The number of standard deviations to use as the clipping limit.

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.

Returns:

mean, median, stddev : float

The mean, median, and standard deviation of the sigma-clipped image.

Page Contents