From 5ac9e530cb87ea2d5713905eac481c3c7d21f573 Mon Sep 17 00:00:00 2001 From: Alexander Held Date: Tue, 22 Oct 2024 17:21:45 +0200 Subject: [PATCH] move bounds outside of loops --- src/cabinetry/fit/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cabinetry/fit/__init__.py b/src/cabinetry/fit/__init__.py index eff636ea..604d810e 100644 --- a/src/cabinetry/fit/__init__.py +++ b/src/cabinetry/fit/__init__.py @@ -588,6 +588,10 @@ def ranking( init_pars = init_pars or model.config.suggested_init() fix_pars = fix_pars or model.config.suggested_fixed() + par_bounds = par_bounds or [ + tuple(bound) for bound in model.config.suggested_bounds() + ] + all_impacts = [] for i_par, label in enumerate(labels): if i_par == poi_index: @@ -613,9 +617,6 @@ def ranking( log.debug(f"impact of {label} is zero, skipping fit") parameter_impacts.append(0.0) else: - par_bounds = par_bounds or [ - tuple(bound) for bound in model.config.suggested_bounds() - ] if not par_bounds[i_par][0] <= np_val <= par_bounds[i_par][1]: np_val = min( max(np_val, par_bounds[i_par][0]), par_bounds[i_par][1]