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
vecarray_like

input vector to normalize

lowfloat

minimum value to scale to, default 0.0

highfloat

maximum value to scale to, default 1.0

Returns
outarray_like

normalized vector

Examples

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