# Path: chainconsumer/helpers.py
# def get_extents(data, weight, plot=False, wide_extents=True, tiny=False, pad=False):
#     hist, be = np.histogram(data, weights=weight, bins=2000)
#     bc = 0.5 * (be[1:] + be[:-1])
#     cdf = hist.cumsum()
#     cdf = cdf / cdf.max()
#     icdf = (1 - cdf)[::-1]
#     icdf = icdf / icdf.max()
#     cdf = 1 - icdf[::-1]
#     threshold = 1e-4 if plot else 1e-5
#     if plot and not wide_extents:
#         threshold = 0.05
#     if tiny:
#         threshold = 0.3
#     i1 = np.where(cdf > threshold)[0][0]
#     i2 = np.where(icdf > threshold)[0][0]
#     lower = bc[i1]
#     upper = bc[-i2]
#     if pad:
#         width = upper - lower
#         lower -= 0.2 * width
#         upper += 0.2 * width
#     return lower, upper


import numpy as np
from scipy.stats import norm
from chainconsumer.helpers import get_extents



def test_extents():
    xs = np.random.normal(size=1000000)
    weights = np.ones(xs.shape)

# Path: chainconsumer/helpers.py
# def get_extents(data, weight, plot=False, wide_extents=True, tiny=False, pad=False):
#     hist, be = np.histogram(data, weights=weight, bins=2000)
#     bc = 0.5 * (be[1:] + be[:-1])
#     cdf = hist.cumsum()
#     cdf = cdf / cdf.max()
#     icdf = (1 - cdf)[::-1]
#     icdf = icdf / icdf.max()
#     cdf = 1 - icdf[::-1]
#     threshold = 1e-4 if plot else 1e-5
#     if plot and not wide_extents:
#         threshold = 0.05
#     if tiny:
#         threshold = 0.3
#     i1 = np.where(cdf > threshold)[0][0]
#     i2 = np.where(icdf > threshold)[0][0]
#     lower = bc[i1]
#     upper = bc[-i2]
#     if pad:
#         width = upper - lower
#         lower -= 0.2 * width
#         upper += 0.2 * width
#     return lower, upper


# Path: tests/test_helpers.py
import numpy as np
from scipy.stats import norm
from chainconsumer.helpers import get_extents




def test_extents():
    xs = np.random.normal(size=1000000)
    weights = np.ones(xs.shape)

    low, high = get_extents(xs, weights)