kernels.minmax_mask
kernels.minmax_mask(
arr,
*,
mask=None,
n_min=1,
n_max=1,
grow=None,
validate=True,
)Reject the n_min smallest and n_max largest unmasked values at each pixel. Single-pass (mask-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. n_min : int or float = 1-
Number of minimum-side values to reject at each pixel. Values
>= 1are treated as a frame count. Values in[0, 1)are treated as a fraction of the total frame countNand converted viaint(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. grow : float or None = None-
Optional radius in pixels used to grow
mask_rejspatially after rejection. Axis 0 is the stack axis and is never grown across.Nonedisables growth and skips the extra calculation. 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, *spatial)-
Truewhere a value was rejected by this kernel.mask_rej.sum(axis=0)is the per-output rejected count.