spacepy.toolbox.normalize

spacepy.toolbox.normalize(vec, low=0.0, high=1.0)[source]

Given an input vector normalize the vector to a given range

Parameters:

vec : array_like

input vector to normalize

low : float

minimum value to scale to, default 0.0

high : float

maximum value to scale to, default 1.0

Returns:

out : array_like

normalized vector

Examples

>>> import spacepy.toolbox as tb
>>> tb.normalize([1,2,3])
[0.0, 0.5, 1.0]