kinextract.robust_sigma
- kinextract.robust_sigma(values: ndarray) float[source]
Robust standard-deviation estimate via the normalized MAD.
Used throughout kinextract wherever a noise scale is needed but the sample may contain outliers (e.g. sigma-clipping continuum residuals or LOSVD-fit residuals) that would bias an ordinary
np.std.- Parameters:
values (ndarray) – Sample of residuals or values to estimate the scatter of. Non-finite entries are dropped before the estimate is computed.
- Returns:
1.4826 * median(|values - median(values)|), which is a consistent estimator of the standard deviation for Gaussian data. Falls back tonp.stdif the MAD is exactly zero (e.g. a sample with many repeated values), and returns0.0for a single finite value ornanif no finite values remain.- Return type: