
Discarding points beyond a chosen number of standard deviations, iteratively — the common defence against outliers.Sigma clipping is a robust statistical technique for cleaning data by removing outliers. The idea is simple: compute the mean and standard deviation of a dataset, discard any points that lie more than a chosen number of standard deviations (the 'sigma') away from the mean, then recompute the mean and standard deviation on the remaining points and repeat. This iterative process converges to a stable set of 'good' data points, making it a standard first line of defense against spurious measurements in physics and astronomy.
The technique has been used informally in statistics since the early 20th century, but it became a standard tool in astronomical data reduction in the 1980s with the advent of CCD cameras and automated surveys.
Start with a dataset and a threshold, typically 2–3 sigma. Calculate the mean and standard deviation. Flag every point whose absolute deviation from the mean exceeds the threshold times the standard deviation, and remove those points. Recalculate the mean and standard deviation on the surviving points, and repeat until no more points are flagged. The procedure is sensitive to the initial estimate, so it is often run a few times with different thresholds to ensure stability.
It is used to remove cosmic ray hits, bad pixels, and other artifacts from astronomical images and spectra, as well as to clean time-series data before period-finding or model fitting.
Sigma clipping is so common in astronomy that it is built into nearly every major image-processing package, from IRAF to modern Python libraries like astropy.




