pyhf.infer.intervals.upper_limits.upper_limit ignores the set confidence level when scan=None #2563
Labels
bug
Something isn't working
needs-triage
Needs a maintainer to categorize and assign
user request
Request coming form a pyhf user
Summary
The method
pyhf.infer.intervals.upper_limits.upper_limit
ignores the set confidence level via thelevel
parameter ifscan=None
, but it always computes the upper limits at a 95% CL (level=0.05
). This happens with pyhf 0.7.6 and very likely also with older versions (though I did not check them), and the bug is present in the main branch as well.The reason is simple: here https://github.com/scikit-hep/pyhf/blob/main/src/pyhf/infer/intervals/upper_limits.py#L260 we don't pass the parameter
level
to the functiontoms748_scan
. Passing**hypotest_kwargs
is not enough for passing alsolevel
.The effect is that the upper limits with
scan=None
(aka using thetoms748
algorithm) are always computed using the default valuelevel=0.05
set here https://github.com/scikit-hep/pyhf/blob/main/src/pyhf/infer/intervals/upper_limits.py#L26.The following patch is enough to fix the main branch:
OS / Environment
Irrelevant
Steps to Reproduce
Using
pyhf
0.7.6:File Upload (optional)
No response
Expected Results
Getting the 90% CL upper limits when
scan=None
as requested.Actual Results
pyhf Version
pyhf, version 0.7.6
Code of Conduct
The text was updated successfully, but these errors were encountered: