Skip to content

Commit

Permalink
feat: Improve warnings for qmu and qmu_tilde for the set POI bounds (#…
Browse files Browse the repository at this point in the history
…2390)

* Add information to the user in the warning that provides them with the
  higher level pyhf.infer APIs kwarg to set the correct test statistic.
  • Loading branch information
lorenzennio authored Dec 8, 2023
1 parent 1191f66 commit 6cd2de4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pyhf/infer/test_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def qmu(mu, data, pdf, init_pars, par_bounds, fixed_params, return_fitted_pars=F
if par_bounds[pdf.config.poi_index][0] == 0:
log.warning(
'qmu test statistic used for fit configuration with POI bounded at zero.\n'
+ 'Use the qmu_tilde test statistic (pyhf.infer.test_statistics.qmu_tilde) instead.'
+ 'Use the qmu_tilde test statistic (pyhf.infer.test_statistics.qmu_tilde) instead.\n'
+ 'If you called this from pyhf.infer.mle or pyhf.infer.hypotest, set test_stat="qtilde".'
)
return _qmu_like(
mu,
Expand Down Expand Up @@ -229,7 +230,8 @@ def qmu_tilde(
if par_bounds[pdf.config.poi_index][0] != 0:
log.warning(
'qmu_tilde test statistic used for fit configuration with POI not bounded at zero.\n'
+ 'Use the qmu test statistic (pyhf.infer.test_statistics.qmu) instead.'
+ 'Use the qmu test statistic (pyhf.infer.test_statistics.qmu) instead.\n'
+ 'If you called this from pyhf.infer.mle or pyhf.infer.hypotest, set test_stat="q".'
)
return _qmu_like(
mu,
Expand Down

0 comments on commit 6cd2de4

Please sign in to comment.