-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Correct variable assignment for limit band artists #2411
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2411 +/- ##
=======================================
Coverage 98.28% 98.28%
=======================================
Files 69 69
Lines 4539 4539
Branches 803 803
=======================================
Hits 4461 4461
Misses 45 45
Partials 33 33
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great.
Thanks @lukasheinrich and sorry for not noticing this until today (though with my laptop dead I would have had to review this on the phone anyway). Here's an example that extends the docs example showing the bug 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)
for test_poi in test_pois
]
cls_obs = np.array([test[0] for test in results]).flatten()
cls_exp = [
np.array([test[1][sigma_idx] for test in results]).flatten()
for sigma_idx in range(5)
]
test_size = 0.05
fig, ax = plt.subplots()
artists = pyhf.contrib.viz.brazil.plot_brazil_band(
test_pois, cls_obs, cls_exp, test_size, ax
)
one_sigma_band = artists[2]
one_sigma_band.set_color("blue")
ax.legend()
fig.savefig("pr_2411_bug.png") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lukasheinrich. I'll go ahead and finish the dependabot updates, then merge this, and get a patch release out with this fix in it.
f94d584
to
88bc5d5
Compare
) * Backport PR #2411 * Assign the one and two sigma band artists to the correct objects. Co-authored-by: Lukas <lukas.heinrich@gmail.com>
This fix is now out in |
Description
We discovered a little bug in the brazil band visualization where the two sigma band was assigned to the "one_sigma_band" attribute of our artist collection and vice versa.
Fixing this now.
cc @malin-horstmann
Amends PR #1377
Checklist Before Requesting Reviewer
Before Merging
For the PR Assignees: