Skip to content

Commit 6cd2de4

Browse files
authored
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.
1 parent 1191f66 commit 6cd2de4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/pyhf/infer/test_statistics.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ def qmu(mu, data, pdf, init_pars, par_bounds, fixed_params, return_fitted_pars=F
134134
if par_bounds[pdf.config.poi_index][0] == 0:
135135
log.warning(
136136
'qmu test statistic used for fit configuration with POI bounded at zero.\n'
137-
+ 'Use the qmu_tilde test statistic (pyhf.infer.test_statistics.qmu_tilde) instead.'
137+
+ 'Use the qmu_tilde test statistic (pyhf.infer.test_statistics.qmu_tilde) instead.\n'
138+
+ 'If you called this from pyhf.infer.mle or pyhf.infer.hypotest, set test_stat="qtilde".'
138139
)
139140
return _qmu_like(
140141
mu,
@@ -229,7 +230,8 @@ def qmu_tilde(
229230
if par_bounds[pdf.config.poi_index][0] != 0:
230231
log.warning(
231232
'qmu_tilde test statistic used for fit configuration with POI not bounded at zero.\n'
232-
+ 'Use the qmu test statistic (pyhf.infer.test_statistics.qmu) instead.'
233+
+ 'Use the qmu test statistic (pyhf.infer.test_statistics.qmu) instead.\n'
234+
+ 'If you called this from pyhf.infer.mle or pyhf.infer.hypotest, set test_stat="q".'
233235
)
234236
return _qmu_like(
235237
mu,

0 commit comments

Comments
 (0)