pyhf.contrib.viz.brazil.plot_cls_components#
- pyhf.contrib.viz.brazil.plot_cls_components(test_pois, tail_probs, ax, **kwargs)[source]#
Plot the values of \(\mathrm{CL}_{s+b}\) and \(\mathrm{CL}_{b}\) — the components of the \(\mathrm{CL}_{s}\) ratio — for a series of hypothesis tests for various POI values.
Example
plot_cls_components()
is generally meant to be used insideplot_results()
but can be used by itself.>>> import numpy as np >>> import matplotlib.pyplot as plt >>> import pyhf >>> import pyhf.contrib.viz.brazil >>> pyhf.set_backend("numpy") >>> model = pyhf.simplemodels.uncorrelated_background( ... signal=[12.0, 11.0], bkg=[50.0, 52.0], bkg_uncertainty=[3.0, 7.0] ... ) >>> observations = [51, 48] >>> data = observations + model.config.auxdata >>> test_pois = np.linspace(0, 5, 41) >>> results = [ ... pyhf.infer.hypotest( ... test_poi, data, model, return_expected_set=True, return_tail_probs=True ... ) ... for test_poi in test_pois ... ] >>> tail_probs = np.array([test[1] for test in results]) >>> fig, ax = plt.subplots() >>> artists = pyhf.contrib.viz.brazil.plot_cls_components(test_pois, tail_probs, ax)
- Parameters:
test_pois (
list
orarray
) – The values of the POI where the hypothesis tests were performed.tail_probs (
list
orarray
) – The values of \(\mathrm{CL}_{s+b}\) and \(\mathrm{CL}_{b}\) for the POIs tested intest_pois
.ax (
matplotlib.axes.Axes
) – The matplotlib axis object to plot on.Keywords –
- Returns:
The
matplotlib.lines.Line2D
artists drawn.- Return type: