From 6cd2de4bfe0e82e3121e8bea07840c5783413127 Mon Sep 17 00:00:00 2001 From: Lorenz Gaertner Date: Fri, 8 Dec 2023 11:48:56 +0100 Subject: [PATCH] feat: Improve warnings for qmu and qmu_tilde for the set POI bounds (#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. --- src/pyhf/infer/test_statistics.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pyhf/infer/test_statistics.py b/src/pyhf/infer/test_statistics.py index 3af773d42c..cf11e09c86 100644 --- a/src/pyhf/infer/test_statistics.py +++ b/src/pyhf/infer/test_statistics.py @@ -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, @@ -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,