normalize_img

astrocut.normalize_img(img_arr: ndarray, stretch: str = 'asinh', minmax_percent: List[int] | None = None, minmax_value: List[int] | None = None, invert: bool = False) ndarray[source]

Apply given stretch and scaling to an image array.

Parameters:
img_arrarray

The input image array.

stretchstr

Optional, default ‘asinh’. The stretch to apply to the image array. Valid values are: asinh, sinh, sqrt, log, linear

minmax_percentarray

Optional. Interval based on a keeping a specified fraction of pixels (can be asymmetric) when scaling the image. The format is [lower percentile, upper percentile], where pixel values below the lower percentile and above the upper percentile are clipped. Only one of minmax_percent and minmax_value shoul be specified.

minmax_valuearray

Optional. Interval based on user-specified pixel values when scaling the image. The format is [min value, max value], where pixel values below the min value and above the max value are clipped. Only one of minmax_percent and minmax_value should be specified.

invertbool

Optional, default False. If True the image is inverted (light pixels become dark and vice versa).

Returns:
responsearray

The normalized image array, in the form in an integer arrays with values in the range 0-255.