-
Notifications
You must be signed in to change notification settings - Fork 84
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
fix: Ensure _ModelConfig.suggested_fixed
list contains only booleans for all modifiers
#1706
fix: Ensure _ModelConfig.suggested_fixed
list contains only booleans for all modifiers
#1706
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1706 +/- ##
=======================================
Coverage 98.11% 98.11%
=======================================
Files 64 64
Lines 4246 4249 +3
Branches 591 590 -1
=======================================
+ Hits 4166 4169 +3
Misses 46 46
Partials 34 34
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR @alexander-held. 👍
Since this is about types, I thought about adding type hints for the affected code and am happy to do so if you'd like.
If you'd like to add them we certainly won't complain. :) Though I'm happy to approve this as is.
_ModelConfig.suggested_fixed
list contains only booleans for all modifiers_ModelConfig.suggested_fixed
list contains only booleans for all modifiers
I added type hints for the relevant part of the code, only relating to |
(I'm not sure why the CodeQL check is hanging, but this PR is obviously fine with or without it). |
Co-authored-by: Giordon Stark <[email protected]>
Description
The
staterror
refactoring in #1639 causedmodel.config.suggested_fixed()
to returnnumpy.bool_
elements forstaterror
modifiers. Those behave differently frombool
objects, and for consistency I believe it is useful to have a consistent return type, in line with the documented return type ofList[bool]
:pyhf/src/pyhf/pdf.py
Lines 349 to 355 in f25b8dd
#1701 includes an example to showcase the current status.
There are many places at which a change could be introduced to restore the old behavior. The current implementation applies the change at the first possible point, where the list is initially created. Alternatively, a conversion could probably happen in
paramset
or at the last point in_ModelConfig.suggested_fixed
. Please let me know if you would prefer another implementation. I picked this approach for consistency with other modifiers, such thatrequired_parset()["fixed"]
consistently returnsbool
/List[bool]
.This also adds tests for the return type behavior for
staterror
modifiers, I'm happy to remove them or add more for other modifiers if desired.Since this is about types, I thought about adding type hints for the affected code and am happy to do so if you'd like.
resolves #1701
Checklist Before Requesting Reviewer
Before Merging
For the PR Assignees: