pyhs3.hifa_modifier_settings¶
- pyhs3.hifa_modifier_settings(ws, *, likelihood=None)[source]¶
pyhf’s
modifier_settingsfor the workspaceto_hifa()converts.pyhf’s JSON holds no interpolation codes; pass these to
pyhf.Workspace.model(modifier_settings=...)so pyhf interpolates as pyhs3 does. Both modifier types are always given, with pyhs3’s (and ROOT’s) defaultscode4fornormsysandcode4pforhistosyswhen no modifier of that type is converted: pyhf falls back to other codes for a typemodifier_settingsleaves out.likelihoodselects the channels as it does forto_hifa(), so channels the conversion leaves out cannot make the codes ambiguous.A
histosyswithcode2logs a warning: pyhs3’scode2differs from pyhf’s for|alpha| > 1(pyhf#2729).- Parameters:
- Return type:
- Returns:
{"normsys": {"interpcode": ...}, "histosys": {"interpcode": ...}}.- Raises:
ValueError – For one modifier type using more than one code, and whatever
to_hifa()raises while selecting the likelihood and its channels.
Examples
>>> import pyhs3 >>> spec = { ... "channels": [ ... { ... "name": "SR", ... "samples": [ ... { ... "name": "background", ... "data": [50.0], ... "modifiers": [ ... { ... "name": "bkg_norm", ... "type": "normsys", ... "data": {"hi": 1.1, "lo": 0.9}, ... } ... ], ... } ... ], ... } ... ], ... "observations": [{"name": "SR", "data": [52.0]}], ... "measurements": [ ... {"name": "meas", "config": {"poi": "bkg_norm", "parameters": []}} ... ], ... "version": "1.0.0", ... } >>> ws = pyhs3.from_hifa( ... spec, modifier_settings={"normsys": {"interpcode": "code1"}} ... ) >>> pyhs3.hifa_modifier_settings(ws) {'normsys': {'interpcode': 'code1'}, 'histosys': {'interpcode': 'code4p'}}