Open alexander-held opened 2 years ago
This will be changed as part of the HS3 migration, with documentation warning under staterror
similar to what is currently done for shapesys
. "Can only have one staterror per channel. If you want multiple staterrors, use shapefactor"
It is @cburgard's recommendation (and I'm fine/agree here) that having the multiple staterror
should cause an error. So https://github.com/scikit-hep/pyhf/issues/1830#issuecomment-1846882345 is follow the idea that we should make this an error and then document this as we change towards using shapefactor
.
Raising an error sounds very reasonable, great that this can move forward as part of HS3.
Summary
In the context of #760 I was wondering what would happen in a setup that exploits the fact that
pyhf
allows customizing parameter names forstaterror
modifiers to assign multiple such modifiers to the same sample in the same channel.Within just
pyhf
, this seems to work fine, and there will be multiple parameters in the fit. When converting to xml+ROOT, twoStatError
modifiers do show up in the xml. When converting back to JSON, thestaterror
modifier names get standardized, resulting in two fields with the same modifier name. Only one of them is used when building the model, so the roundtrip fails.OS / Environment
Steps to Reproduce
Default workspace:
This contains two parameters controlling the
staterror
modifiers (+mu_sig
, which is of no relevance here).Convert to xml+ROOT via
pyhf json2xml
, resulting in the followingconfig/FitConfig_ch.xml
:I do not know whether this is technically valid HistFactory, but it converts fine with
hist2workspace
. I did not check whether one of the modifiers gets dropped, or if they get merged.Convert back to JSON with
pyhf xml2json
:The modifiers are still both there, but since the name is now the same for both, the first one is dropped from the model and only the second modifier enters. See e.g.
pyhf inspect
, which will show a singlestaterror
modifier for this version, and two for the original.File Upload (optional)
No response
Expected Results
Unclear to me what the expected behavior should be:
This was example was written as a targeted setup to test behavior, and may not be all that relevant in practice.
shapesys
modifiers can be used for this effect to achieve the same behavior (assuming customizable constraint term, as in https://github.com/scikit-hep/pyhf/pull/1829). It may make sense to only allow a singlestaterror
modifier per sample and channel to avoid this issue altogether.Actual Results
pyhf Version
Code of Conduct