def rebin_1d(arr, new_shape):
    """Bin a 1D numpy array, with each entry in the binned array equal to 
    the mean of the constituent entries in the original"""
    shape = (new_shape[0], arr.shape[0] // new_shape[0],)
    return arr.reshape(shape).mean(-1)