def normalize_bound(sig, lb=0, ub=1):
    """
    Normalize a signal between the lower and upper bound

    Parameters
    ----------
    sig : numpy array
        Original signal to be normalized
    lb : int, or float
        Lower bound
    ub : int, or float
        Upper bound

    Returns
    -------
    x_normalized : numpy array
        Normalized signal

    """

    mid = ub - (ub - lb) / 2
    min_v = np.min(sig)
    max_v = np.max(sig)
    mid_v =  max_v - (max_v - min_v) / 2
    coef = (ub - lb) / (max_v - min_v)
    return sig * coef - (mid_v * coef) + mid