kernels.minmax_combine_1d
kernels.minmax_combine_1d(
values,
*,
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 (1-D output-only 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,). combine : {'mean', 'median'}-
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
>= 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. 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 : scalar-
Mean or median of the surviving values after applying the input mask, finite-value filtering, and this rejection algorithm.
Notes
Sort the M finite, unmasked samples at each output pixel. With N the original image count, a request a (n_min or n_max) resolves to::
A = int(N * a + 0.001) if 0 <= a < 1 else int(a)
k = int(M * A / N + 0.001)
Reject k samples from that tail, first the low tail, then the high tail of the remaining values. Both counts use the initial M; available samples limit the cuts. Thus masked/non-finite inputs reduce even count-based requests proportionally. For example, N=10, M=5, n_min=2 removes one minimum. This is rank selection, not a value threshold: tied values may be split. There is no spread estimate or iteration; low/upp are retained extrema. For derivations and worked examples, see the Rejection Methods tutorial.