psychos.visual.synthetic.reescale#

psychos.visual.synthetic.reescale(arr: ndarray, vmin: float = -1.0, vmax: float = 1.0, method: Literal['normalize', 'clip'] = 'normalize') ndarray[source]#

Rescale a numpy array based on the specified method.

Parameters:
  • arr (np.ndarray) – Input array to be rescaled.

  • vmin (float, optional) – Minimum value for normalization or clipping (default is -1.0).

  • vmax (float, optional) – Maximum value for normalization or clipping (default is 1.0).

  • method (Literal["none", "normalize", "clip"], optional) –

    Rescaling method:
    • ’none’: return the array as is.

    • ’normalize’: scale the array so its min maps to vmin and max to vmax.

    • ’clip’: clip the array values to lie between vmin and vmax.

Returns:

The rescaled array.

Return type:

np.ndarray