Skip to content

Commit

Permalink
Added additional handling for integer bins
Browse files Browse the repository at this point in the history
  • Loading branch information
yimuchen committed Nov 7, 2023
1 parent 11ae275 commit f7dcb33
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hepdata_lib/hist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,17 @@ def _get_histaxis_array(axis, flow: bool) -> numpy.ndarray:
entries.append("__UNDETERMINED__")
elif isinstance(axis, hist.axis.IntCategory):
entries.append(entries[-1] + 1)
elif isinstance(axis, hist.axis.Integer):
entries.append(numpy.inf)
else:
entries.append((axis.edges[-1], numpy.inf))

## Adding underflow bin
if flow and axis.traits.underflow:
entries = [(-numpy.inf, axis.edges[0])] + entries
if isinstance(axis,hist.axis.Integer):
entries = [-numpy.inf] + entries
else:
entries = [(-numpy.inf, axis.edges[0])] + entries

## Converting to numpy array
if axis.traits.continuous:
Expand Down

0 comments on commit f7dcb33

Please sign in to comment.