kernels.minmax_combine

kernels.minmax_combine(
    arr,
    *,
    mask=None,
    combine,
    n_min=1,
    n_max=1,
    validate=True,
)

Reject the n_min smallest and n_max largest unmasked values at each pixel. Single-pass (output-only variant).

Parameters

arr : (ndarray, shape(N, *spatial))

Image stack. Accepted dtypes are uint8, uint16, int16, int32, float32, and float64. Integer inputs are promoted to the package’s floating workspace when validate is True. 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; True means already masked. Must have the same shape as arr before any internal flattening.

combine : str

Output combine method evaluated after rejection. Fused combine kernels support "mean", "average", "avg", "median", and "med".

n_min : int or float = 1

Number of minimum-side values to reject at each pixel. Values >= 1 are treated as a frame count. Values in [0, 1) are treated as a fraction of the total frame count N and converted via int(N * n_min + 0.001), matching IRAF’s internal fraction arithmetic.

n_max : int or float = 1

Same convention as n_min, applied to the maximum-side tail.

validate : bool = True

If True, check dimensionality and normalize dtype/contiguity before entering the Rust kernel. If False, 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.