kernels.linearclip_1d
kernels.linearclip_1d(
values,
*,
mask=None,
low_scale=1.0,
low=0.0,
upp_scale=1.0,
upp=0.0,
maxiters=1,
nkeep=1,
maxrej=None,
cenfunc='median',
revert_on_nkeep=True,
validate=True,
)Center-relative linear clipping (low + low_scale * center <= value <= upp + upp_scale * center) (1-D variant).
Parameters
values : (ndarray, shape(N))-
One-dimensional value vector. Accepted dtypes are
uint8,uint16,int16,int32,float32, andfloat64. Integer inputs are promoted to the package’s floating workspace whenvalidateisTrue. mask : ndarray of bool = None-
Input mask;
Truemeans already masked. Must have shape(N,). low_scale : float = 1.0-
Multiplier for the per-pixel center used in the lower retained bound.
low : float = 0.0-
Non-negative margin subtracted from
low_scale * center. upp_scale : float = 1.0-
Multiplier for the per-pixel center used in the upper retained bound.
upp : float = 0.0-
Non-negative margin added to
upp_scale * center. maxiters : int = 1-
Maximum number of clipping iterations per pixel.
1preserves the historical single-pass behavior. nkeep : int = 1-
Minimum number of unmasked values to preserve at each pixel.
maxrej : int or None = None-
Maximum number of values that may be rejected at each pixel.
Nonemeans no limit. cenfunc : ('median', 'lmedian', 'mean') = "median"-
Center estimator used each iteration.
lmedianaccepts the aliaslmedand uses the lower of the two middle samples for even valid counts. revert_on_nkeep : bool = True-
If
True, an iteration that would leave fewer thannkeepusable samples at a pixel is reverted in full for that pixel. validate : bool = True-
If
True, check dimensionality and normalize dtype/contiguity before entering the Rust kernel. IfFalse, callers must provide inputs that satisfy the compiled kernel assumptions.
Returns
mask_rej : ndarray of bool, shape (N,)-
Truewhere a value was rejected by this kernel. std : scalar or None-
Spread used by sigma/CCD clipping.
Nonefor rejection algorithms without a spread diagnostic. low : scalar-
Lower retained-value bound. Bounds are inclusive: values equal to
loware retained. upp : scalar-
Upper retained-value bound. Bounds are inclusive: values equal to
uppare retained. nit : scalar-
Iteration count.
output_flags : scalar-
Bit-coded status using the same bit meanings as the stack kernel.
Notes
Values survive when low_scale * center - low <= value <= upp_scale * center + upp. Each iteration recomputes the center from finite, unmasked survivors and stops when no new samples are rejected or maxiters is reached. The default bounds (1, 0, 1, 0) are a no-op.