def demean(array, mean=0.):
    """Demean an array, updating to specified mean.

    Parameters
    ----------
    array : 1d array
        Data to demean.
    mean : float, optional, default: 0
        New mean for data to have.

    Returns
    -------
    out : 1d array
        Demeaned data.
    """

    return array - array.mean() + mean