Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: limit parameter variations in rankings to stay within parameter bounds #490

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/cabinetry/fit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -613,6 +617,10 @@ def ranking(
log.debug(f"impact of {label} is zero, skipping fit")
parameter_impacts.append(0.0)
else:
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]
)
init_pars_ranking = init_pars.copy()
init_pars_ranking[i_par] = np_val # value of current nuisance parameter
fit_results_ranking = _fit_model(
Expand Down
Loading