kinextract.build_clean_protect_mask
- kinextract.build_clean_protect_mask(st: FitState, cfg: FitConfig) ndarray[source]
Build the boolean “protect” mask exempting known real features from clipping.
This mask feeds directly into _update_clean_mask’s
protect_maskargument during the iterative kinematic sigma-clipping of the LOSVD chi-squared fit: pixels marked True here are fully exempt from being clipped as outliers, regardless of the sign of their residual, because they are known to contain real spectral signal (Ca II triplet absorption, user-specified windows, or extra absorption lines) rather than cosmic rays, sky-subtraction residuals, or emission contamination. Without this protection, iterative sigma-clipping could progressively erode real, deep absorption features that legitimately produce large residuals against an imperfect model.Combines three independent sources of protection:
The Ca II triplet, at centers from get_ca_centers_for_cleaning with a per-line half-width from clean_ca_half_width_A (which widens the window for broad LOSVDs), if
cfg.clean_protect_ca_tripletis True.User-specified custom wavelength windows (
cfg.clean_protect_windows), converted to thest.xframe via _clean_window_to_fit_frame.User-specified extra absorption lines (
cfg.extra_absorption_lines), each given as(center, half_width[, name]).
- Parameters:
- Returns:
Mask of length
st.npix; True marks pixels that must never be rejected by the kinematic-fit sigma-clipping regardless of residual sign.- Return type:
ndarray of bool