Skip to content

Commit

Permalink
Use fSumw2 member directly to check
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfeickert committed Sep 8, 2020
1 parent 1d7f2e5 commit 470cadf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/pyhf/readxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ def extract_error(hist):
Returns:
list: The uncertainty for each bin in the histogram
"""
err = hist.variances if hist.variances.any() else hist.to_numpy()[0]

sumw2 = hist.member("fSumw2", none_if_missing=True)
err = sumw2 if sumw2 else hist.to_numpy()[0]
return np.sqrt(err).tolist()


Expand Down
2 changes: 1 addition & 1 deletion tests/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def test_import_histogram():
"validation/xmlimport_input/data", "example.root", "", "data"
)
assert data == [122.0, 112.0]
assert uncert == [11.045361017187261, 10.583005244258363]
assert uncert == [11.045360565185547, 10.58300495147705]


def test_import_histogram_KeyError():
Expand Down

0 comments on commit 470cadf

Please sign in to comment.