Apply min-max scaling (normalize)
    then scale to (mn,mx)

def scale(arr, mn=0, mx=1):
    """
    Apply min-max scaling (normalize)
    then scale to (mn,mx)
    """
    amn = arr.min()
    amx = arr.max()
    # normalize:
    arr = (arr - amn) / (amx - amn)
    # scale:
    if amn != mn or amx != mx:
        arr *= mx - mn
        arr += mn
    return arr