kernels.sigclip_combine
kernels.sigclip_combine(
arr,
*,
mask=None,
combine,
sigma=(3.0, 3.0),
maxiters=5,
ddof=0,
nkeep=1,
maxrej=None,
cenfunc='median',
clip_cen=None,
stdfunc='std',
revert_on_nkeep=True,
validate=True,
)Sigma-clipping rejection (output-only variant).
Parameters
arr : (ndarray, shape(N, *spatial))-
Image stack. Accepted dtypes are
uint8,uint16,int16,int32,float32, andfloat64. Integer inputs are promoted to the package’s floating workspace whenvalidateisTrue. Inputs with more than 3 dimensions are flattened internally; output shapes match the trailing spatial dimensions of the input. mask : ndarray of bool = None-
Input mask;
Truemeans already masked. Must have the same shape asarrbefore any internal flattening. combine : str-
Output combine method evaluated after rejection. Fused combine kernels support
"mean","average","avg","median", and"med". sigma : float or tuple of float = (3.0, 3.0)-
User-supplied clipping multiplier, not the measured data spread itself. Values are clipped when their residual from the clipping center exceeds
sigma * spread. A scalar applies the same multiplier to both tails; a 2-tuple(sigma_lower, sigma_upper)clips asymmetrically. Thresholds must be finite and non-negative. maxiters : int = 5-
Maximum number of clipping iterations per pixel.
ddof : int = 0-
Delta degrees of freedom for the per-pixel spread estimator.
nkeep : int = 1-
Minimum number of unmasked values to preserve at each pixel. An iteration that would drop below this count is reverted in full. The default,
1, prevents clipping from rejecting every finite sample in a per-output stack. Set0only when all samples may be rejected. 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. clip_cen : ('median', 'lmedian', 'mean') = "median"-
Center used when computing the spread for iterative rejection.
Noneuses the same center ascenfunc;lmedianalso acceptslmed. 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. Input masks, threshold masks, and non-finite samples remain excluded. The default isTrue. IfFalse, clipping is strict and may leave fewer thannkeepsamples. stdfunc : ('std', 'mad') = "std"-
Spread estimator used by sigma clipping.
"std"uses the standard deviation."mad"uses1.4826 * median(abs(x - clip_cen))as a robust sigma estimate; whenddof > 0, this estimate is multiplied bysqrt(nvalid / (nvalid - ddof))and pixels withnvalid <= ddofreturnNaNspread diagnostics. 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
combined : (ndarray, shape(*spatial))-
Per-output mean or median after applying the input mask, finite-value filtering, and this rejection algorithm.