Staterror issues with partially fixed bins due to to zero yields
See original GitHub issueSummary
The changes to staterror handling after 0.6.3 can result in some crashes due to unsupported treatment of partially fixed parameters (fixed modifiers in some bins but not in others). This results in https://github.com/scikit-hep/pyhf/blob/6f8d87e65e2b9b6033974ef18cbb4d9bf62f3dd8/src/pyhf/parameters/paramsets.py#L44-L46 getting raised.
cc @ekourlit
OS / Environment
n/a
Steps to Reproduce
import pyhf
# zero nominal yield, non-zero staterror
spec = {
"channels": [
{
"name": "SR",
"samples": [
{
"data": [0.0, 1.0],
"modifiers": [
{
"data": [0.1, 0.1],
"name": "staterror_SR",
"type": "staterror"
}
],
"name": "sample_1"
}
]
}
],
"measurements": [{"config": {"parameters": [], "poi": ""}, "name": "measurement"}],
"observations": [{"data": [0.0, 1.0], "name": "SR"}],
"version": "1.0.0"
}
model = pyhf.Workspace(spec).model()
for parameter in model.config.par_order:
try:
print(parameter, model.config.param_set(parameter).suggested_fixed_as_bool)
except RuntimeError as e:
print(e)
# non-zero nominal yield, zero staterror
spec = {
"channels": [
{
"name": "SR",
"samples": [
{
"data": [0.1, 1.0],
"modifiers": [
{
"data": [0.0, 0.1],
"name": "staterror_SR",
"type": "staterror"
}
],
"name": "sample_1"
}
]
}
],
"measurements": [{"config": {"parameters": [], "poi": ""}, "name": "measurement"}],
"observations": [{"data": [0.0, 1.0], "name": "SR"}],
"version": "1.0.0"
}
model = pyhf.Workspace(spec).model()
for parameter in model.config.par_order:
try:
print(parameter, model.config.param_set(parameter).suggested_fixed_as_bool)
except RuntimeError as e:
print(e)
# zero nominal yield, zero staterror
spec = {
"channels": [
{
"name": "SR",
"samples": [
{
"data": [0.0, 1.0],
"modifiers": [
{
"data": [0.0, 0.1],
"name": "staterror_SR",
"type": "staterror"
}
],
"name": "sample_1"
}
]
}
],
"measurements": [{"config": {"parameters": [], "poi": ""}, "name": "measurement"}],
"observations": [{"data": [0.0, 1.0], "name": "SR"}],
"version": "1.0.0"
}
model = pyhf.Workspace(spec).model()
for parameter in model.config.par_order:
try:
print(parameter, model.config.param_set(parameter).suggested_fixed_as_bool)
except RuntimeError as e:
print(e)
# example that works: non-zero data and zero staterror for one sample,
# zero data and non-zero staterror for another sample
spec = {
"channels": [
{
"name": "SR",
"samples": [
{
"data": [0.1, 1.0],
"modifiers": [
{
"data": [0.0, 0.1],
"name": "staterror_SR",
"type": "staterror"
}
],
"name": "sample_1"
},
{
"data": [0.0, 1.0],
"modifiers": [
{
"data": [0.1, 0.1],
"name": "staterror_SR",
"type": "staterror"
}
],
"name": "sample_2"
}
]
}
],
"measurements": [{"config": {"parameters": [], "poi": ""}, "name": "measurement"}],
"observations": [{"data": [0.0, 1.0], "name": "SR"}],
"version": "1.0.0"
}
model = pyhf.Workspace(spec).model()
for parameter in model.config.par_order:
try:
print(parameter, model.config.param_set(parameter).suggested_fixed_as_bool)
except RuntimeError as e:
print(e)
File Upload (optional)
No response
Expected Results
The script above should run without running into any errors.
Actual Results
[True, False] is neither all-True nor all-False, so not compressible
[True, False] is neither all-True nor all-False, so not compressible
[True, False] is neither all-True nor all-False, so not compressible
staterror_SR False
pyhf Version
pyhf, version 0.7.0rc2.dev18
Code of Conduct
- I agree to follow the Code of Conduct
Issue Analytics
- State:
- Created a year ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
staterror regressions blocking v0.7.0 #1945 - scikit-hep/pyhf
Issue Large cls value difference between v0.6.3 and master #1720; Issue Staterror issues with partially fixed bins due to to zero yields #1944....
Read more >Physics Working Group
The fix leads to an improved match between the data ... By fits are also half a bin shifted from Tony's, we'll need...
Read more >e^{+}ν_{e} and D^{0}→π^{-}
q2 bin. This partial decay rate can be evaluated with the double tag D0 ¯D0 events as well. The measurement of the partial...
Read more >Extended Gamma-Ray Emission from the G25.0+0.0 Region
We report a study of extended γ-ray emission with the Large Area Telescope (LAT) on board the Fermi Gamma-ray Space Telescope, which is...
Read more >Introduction to Statistics and Data Analysis for Physicists
Statistics is at least partially based on experience which is manifest in fields ... Then the probability for any fixed value is zero,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’m pretty sure it is different. As we clearly have problems with
staterrorI’m more just trying to loosely connect them together for easier reference. I’ll just make an Issue for that now though and do it properly.Closing this as “won’t fix”.