"""
closuretest/plots.py
Plots of statistical estimators for single closure test.
See multiclosure module for more estimators and plots.
"""
from reportengine.figure import figure
from validphys import plotutils
[docs]@figure
def plot_delta_chi2(delta_chi2_bootstrap, fits):
"""Plots distributions of delta chi2 for each fit in `fits`.
Distribution is generated by bootstrapping. For more information
on delta chi2 see `delta_chi2_bootstrap`
"""
delta_chi2 = delta_chi2_bootstrap.T
labels = [fit.label for fit in fits]
fig, ax = plotutils.subplots()
for i, label in enumerate(labels):
ax.hist(delta_chi2[:, i], alpha=0.3, label=label, zorder=100)
ax.set_xlabel(r"$\Delta_{\chi^{2}}$")
l = ax.legend()
l.set_zorder(1000)
ax.set_title(r"Total $\Delta_{\chi^{2}}$ for each fit")
return fig