pyhf: add staterror config to spec to have faithful roundtrip
Description
we should add staterrorconfig as a channel property. Currently most analyses use Poisson as the config, which is not the default and thus needs to be specificed in the XML.
Converting XML -> JSON -> XML loses this information since we never record this non-default value in the JSON and thus cannot reproduce the original XML
during parsing, the staterrorconfig should become a value in the paramsets used by the staterror modifier.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 15 (11 by maintainers)
hi, i appreciate the discussion here. we do generally have limited time and I do think this is prioritized enough that we want to make sure it gets into the upcoming major release. What I propose we’ll do (I have not discussed this with the core developers) is to support a user-friendly interface through
pyhfin our next major release as this will change the API minimally, but allows for that support.That said, it is possible to make this functional today in your existing code like so:
and this seems to work in being able to change things on a global-level (which I propose that
pyhfsupports primarily):This does also allow you to change constraints for other modifier types in a global way in a similar fashion …
To summarize
pyhfshould support a global configuration forstaterrorconstraint type (at least functionally in the code) which is an API changeminorrelease can expand thev1.0.0HiFa JSON specification to allow for this to be serializablestaterrorconstraint should switch toPoissonto match ROOT 6.22+Maybe to be practical, I think there are multiple aspects to this:
Changing the default without implementing a way to switch behavior might not be ideal, as it will change the results of people who are used to the Gaussian setup. I think it might be possible to make this configurable though without already involving the JSON spec, and only do so in a separate step (assuming that this is maybe easier to make some partial progress). The natural way to configure this to me would be
pyhf.Workspace.modelvia themodifier_settingskwarg, which already takes the interpolation codes fornormsysandhistosys, and could take anotherstaterrorkey with something like{"constraint": "poisson"}or{"constraint": "gaussian"}as possible values.