def normalize(x, lower, upper):
    """
    Normalize an array to a given bound interval
    """
    import numpy
    x_max = numpy.max(x)
    x_min = numpy.min(x)
    m = (upper - lower) / (x_max - x_min)
    x_norm = m * (x - x_min) + lower
    return x_norm
