viz.enhance.azimuthal_renormalize

viz.enhance.azimuthal_renormalize(
    image,
    center,
    *,
    nrad,
    ntheta,
    nsigma,
    statistic='mean',
    sigma=None,
    maxiters=1,
    clip_center='mean',
    clip_scale='std',
    subpixels=10,
    mask=None,
    statistic_mask=None,
    return_stats=False,
)

Map each ring’s location plus/minus sample deviations to zero and one.

Parameters

image : array - like

Nonempty, real 2-D image. Masked and nonfinite pixels are missing.

center : tuple of float

Zero-based (x, y) nucleus coordinates within the image.

nrad : int

Number of integer radius rings and equal-angle cells per ring.

ntheta : int

Number of integer radius rings and equal-angle cells per ring.

nsigma : float

Finite positive number of sample deviations defining each half-range.

statistic : ('mean', 'median', 'mode') = "mean"

Ring location. Default "mean" preserves the original behavior. "mode" is 3*median - 2*mean. A callable receives finite retained samples and returns a real scalar; empty rings skip it.

sigma : float, tuple of float, or None = None

Clipping threshold or (lower, upper) pair; None disables it. Clipping affects the location and spread, not the output samples.

maxiters : int or None = 1

Maximum clipping passes; 1 by default. None means convergence.

clip_center : ('mean', 'median') = "mean"

Location for clipping bounds, independently of statistic.

clip_scale : ('std', 'mad_std') = "std"

Sample deviation or Gaussian-consistent MAD for clipping only. The output range always uses the retained sample standard deviation.

subpixels : int = 10

Midpoint samples per axis in polar sampling and reconstruction.

mask : array - like or None = None

Additional exclusion mask with the image shape.

statistic_mask : array - like or None = None

Exclude pixels from estimation only, preserving valid output samples. A polar cell is excluded if any midpoint touches this mask.

return_stats : bool = False

Return an EnhancementResult with .image and .stats when True. Default False returns an image. Counts refer to polar cells, not independent source pixels; see NormStats.

Returns

: ndarray or EnhancementResult

Float64 image of unchanged shape. Ring values follow 0.5 + (value - location) / (2*nsigma*std), without clipping. Zero spread, missing neighborhoods, and uncovered radii yield NaN. The input is never modified.

Notes

Sampling and estimator definitions match azimuthal_normalize. The source floors its lower bound and scales to bytes; this function preserves values outside zero to one and uses no denominator floor. A retained sample deviation exceeding the float64 range makes its ring undefined, even when a scaled ratio could be represented.