resolve_zero_scale

resolve_zero_scale(
    name,
    values,
    arr,
    *,
    nonzero=False,
    to_0th=False,
    sigclip_kwargs=None,
    validate=True,
)

Resolve a numeric, string, or callable zero/scale input.

This helper resolves one zero or scale argument. It is useful for advanced callers that want to inspect or reuse the per-plane vector that Combiner.zero_scale, Combiner.combine, and ndcombine would apply internally.

Parameters

name : str

Name used in error messages.

values : array-like, str, callable, or None

Scalar/vector values, a named per-plane statistic, or a callable evaluated once for each image plane. Plain statistics (computed on all finite pixels): "mean", "average", "avg", "median", "med", "sum", "min", "max". Sigma-clipped statistics (sigma=3, maxiters=5, cenfunc="median" by default): "sigclip_mean" / "mean_sc" and "sigclip_median" / "median_sc" / "med_sc". These clip per-plane before computing the statistic, making the normalization robust to bright stars or cosmic rays. sigclip_kwargs can tune their clipping parameters.

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

Workspace used for statistics and dtype normalization.

nonzero : bool = False

If True, reject zero values after resolving.

to_0th : bool = False

If True, normalize values relative to the first plane: subtract the first value for zero offsets or divide by the first value for scales.

sigclip_kwargs : dict or None = None

Optional keyword arguments for sigma-clipped statistics. Supported keys are sigma, maxiters, cenfunc, clip_cen, and ddof.

validate : bool = True

If True, validate length, finiteness, and nonzero constraints. If False, callers are responsible for providing broadcast-compatible, finite values.

Returns

values : ndarray or None

Broadcast-ready array with shape (1, 1, ...) for scalar input or (N, 1, ...) for one value per input plane.