const remap = (value, low1, high1, low2, high2) => {
return low2 + ((high2 - low2) * (value - low1)) / (high1 - low1)
}
const normalize = (value_list, inverse = false) => {
const max = Math.max(...value_list)
const min = Math.min(...value_list)
const outMax = inverse ? 0 : 1
const outMin = inverse ? 1 : 0
return value_list.map(v => remap(v, min, max, outMin, outMax))
}