From 619c48c71a68c241b82dd25a2fca58ea084017bf Mon Sep 17 00:00:00 2001 From: Roman Mueller Date: Fri, 24 Mar 2023 07:04:04 +0100 Subject: [PATCH] fix formatting --- src/cabinetry/visualize/plot_model.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/cabinetry/visualize/plot_model.py b/src/cabinetry/visualize/plot_model.py index b5edcb2e..40fd1372 100644 --- a/src/cabinetry/visualize/plot_model.py +++ b/src/cabinetry/visualize/plot_model.py @@ -145,12 +145,15 @@ def data_mc( n_zero_pred = sum(total_yield == 0.0) # number of bins with zero predicted yields if n_zero_pred > 0: log.warning( - f"predicted yield is zero in {n_zero_pred} bin(s), excluded from ratio plot" + f"predicted yield is zero in {n_zero_pred} bin(s),\ + excluded from ratio plot" ) nonzero_model_yield = total_yield != 0.0 if np.any(total_yield < 0.0): - raise ValueError(f"{label} total yield {total_yield.tolist()} has negative bin(s)") + raise ValueError( + f"{label} total yield {total_yield.tolist()} has negative bin(s)" + ) # add uncertainty band around y=1 rel_mc_unc = total_model_unc / total_yield @@ -355,12 +358,16 @@ def templates( if np.any(nominal_histo["yields"] < 0.0): log.warning( - f"{label} nominal histo yield {nominal_histo['yields'].tolist()} has negative bin(s), taking absolute value for yerr on template ratio plot uncertainty" + f"{label} nominal histo yield {nominal_histo['yields'].tolist()}\ + has negative bin(s), taking absolute value for yerr on\ + template ratio plot uncertainty" + ) + template_ratio_plot_unc = template["stdev"] / np.abs( + nominal_histo["yields"] ) - template_ratio_plot_unc = template["stdev"] / np.abs(nominal_histo["yields"]) else: template_ratio_plot_unc = template["stdev"] / nominal_histo["yields"] - + ax2.plot(line_x, line_y, color=color, linestyle=linestyle) ax2.errorbar( bin_centers,