def centers2edges(centers):
    """Converts a set of bin centers into edges"""
    centers = sorted(set(centers))
    ret = [-1e99]
    ret.extend((c1+c2)/2.0 for c1, c2 in zip(centers, centers[1:]))
    ret.append(1e99)
    return ret