feat: support models with custom modifiers
Add support for handling models with custom modifiers as introduced in https://github.com/scikit-hep/pyhf/pull/1991. This means adding a validate kwarg to model_utils.model_and_data to allow turning off workspace / model validation against the respective JSON schema (users could provide their own via the pyhf API, see pyhf.schema.Schema docs). The modifier_set kwarg can be used to inject custom modifiers.
At the moment this also adds a poi_name kwarg to support the use case in #382, but that may be argued to be an invalid model specification to begin with, so it is not clear to me whether this would be generally needed. The fit API is meant to not rely on this option (to also more easily support multi-POI setups) so this may somewhat go against the design philosophy here.
to-do:
- (not for this PR, but just to track as it came up in #382) support
cabinetryconfig having custom modifier expressions
may potentially resolve #382
* allow turning off workspace and model validation in model_utils.model_and_data
* allow injecting custom modifiers into model creation in model_utils.model_and_data
* support setting POI in model_utils.model_and_data
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 100.00%. Comparing base (
f116d4e) to head (2decbe8).
Additional details and impacted files
@@ Coverage Diff @@
## master #385 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 22 22
Lines 2093 2094 +1
Branches 344 344
=========================================
+ Hits 2093 2094 +1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
hey @alexander-held, would it be possible to merge the latest base branch into the feat/custom-modifier-models branch? I would like to use the latest fixes with the custom modifiers.
Hi @rmnmllr, sure, this branch includes the changes from master now.