From 9aa044770c3aeed560fc9a2210f1a07b97d76ecc Mon Sep 17 00:00:00 2001 From: Alexander Held <45009355+alexander-held@users.noreply.github.com> Date: Sun, 24 Mar 2024 15:00:34 +0100 Subject: [PATCH] fix: explicitly convert parameter bounds to list of tuples (#471) * convert parameter bounds to list of tuples for consistent types when custom bounds are used --- src/cabinetry/fit/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cabinetry/fit/__init__.py b/src/cabinetry/fit/__init__.py index ebb62d52..b4118da0 100644 --- a/src/cabinetry/fit/__init__.py +++ b/src/cabinetry/fit/__init__.py @@ -184,7 +184,10 @@ def _fit_model_custom( # use parameter settings provided in function arguments if they exist, else defaults init_pars = init_pars or model.config.suggested_init() fix_pars = fix_pars or model.config.suggested_fixed() - par_bounds = par_bounds or model.config.suggested_bounds() + # ensure list of tuples, see https://github.com/scikit-hep/pyhf/issues/2462 + par_bounds = par_bounds or [ + tuple(bound) for bound in model.config.suggested_bounds() + ] labels = model.config.par_names @@ -858,7 +861,10 @@ def limit( ) # use par_bounds provided in function argument if they exist, else use default - par_bounds = par_bounds or model.config.suggested_bounds() + # ensure list of tuples, see https://github.com/scikit-hep/pyhf/issues/2462 + par_bounds = par_bounds or [ + tuple(bound) for bound in model.config.suggested_bounds() + ] if par_bounds[model.config.poi_index][0] < 0: # set lower POI bound to zero (for use with qmu_tilde) par_bounds[model.config.poi_index] = (