normalize_values
- compas.utilities.normalize_values(values, new_min=0.0, new_max=1.0)[source]
Normalize a list of numbers to the range between new_min and new_max.
- Parameters
values (list of float) – The data to be normalized.
new_min (float, optional) – The new minimum of the data. Default is 0.0.
new_max (float, optional) – The new maximum of the data. Default is 1.0.
- Returns
list of float – A list of floats mapped to the range new_min, new_max.
Examples
>>> data = list(range(5, 15)) >>> data = normalize_values(data) >>> min(data) 0.0 >>> max(data) 1.0