Skip to content

Commit

Permalink
feat: improve error message when CLs bracketing fails (#509)
Browse files Browse the repository at this point in the history
* add POI name to error message to better distinguish between POI and CLs values
  • Loading branch information
alexander-held authored Feb 27, 2025
1 parent ffa5ca2 commit 866406b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/cabinetry/fit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,8 +995,9 @@ def _cls_minus_threshold(
except ValueError:
# invalid starting bracket is most common issue
log.error(
f"CLs values at {bracket[0]:.4f} and {bracket[1]:.4f} do not bracket "
f"CLs={cls_target:.4f}, try a different starting bracket"
f"CLs values for {model.config.poi_name}={bracket[0]:.4f} and "
f"{bracket[1]:.4f} do not bracket CLs={cls_target:.4f}, try a "
"different starting bracket"
)
# set POI in model back to original value
model.config.set_poi(original_model_poi_name)
Expand Down
4 changes: 2 additions & 2 deletions tests/fit/test_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,8 +818,8 @@ def test_limit(example_spec_with_background, caplog):
poi_name="Signal strength",
)
assert (
"CLs values at 1.0000 and 2.0000 do not bracket CLs=0.1000, try a different "
"starting bracket" in [rec.message for rec in caplog.records]
"CLs values for Signal strength=1.0000 and 2.0000 do not bracket CLs=0.1000, "
"try a different starting bracket" in [rec.message for rec in caplog.records]
)
caplog.clear()

Expand Down

0 comments on commit 866406b

Please sign in to comment.