Skip to content

Commit

Permalink
fix: explicitly convert parameter bounds to list of tuples (#471)
Browse files Browse the repository at this point in the history
* convert parameter bounds to list of tuples for consistent types when custom bounds are used
  • Loading branch information
alexander-held authored Mar 24, 2024
1 parent f116d4e commit 9aa0447
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/cabinetry/fit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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] = (
Expand Down

0 comments on commit 9aa0447

Please sign in to comment.