(values, min=0, max=1)
return (-minval + values) / ptp * (max - min) + min
Return values scaled to [min, max]
Return values scaled to [min, max]
Return values scaled to [ min max ]
def scale(values, min=0, max=1):
    """Return values scaled to [min, max]"""
    if len(values) == 0:
        return np.array([])
    minval = np.float_(bn.nanmin(values))
    ptp = bn.nanmax(values) - minval
    if ptp == 0:
        return np.clip(values, min, max)
    return (-minval + values) / ptp * (max - min) + min
def scale ( values , min = 0 , max = 1 ) : if len ( values ) == 0 : return np . array ( [ ] ) minval = np . float_ ( bn . nanmin ( values ) ) ptp = bn . nanmax ( values ) - minval if ptp == 0 : return np . clip ( values , min , max ) return ( - minval + values ) / ptp * ( max - min ) + min