Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Mueller authored and alexander-held committed Apr 1, 2023
1 parent 7b6164f commit 619c48c
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/cabinetry/visualize/plot_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 619c48c

Please sign in to comment.