From f7dcb33090fb327c107b0a49f2eb80456a01a607 Mon Sep 17 00:00:00 2001 From: Yi-Mu Chen Date: Tue, 7 Nov 2023 12:06:27 +0100 Subject: [PATCH] Added additional handling for integer bins --- hepdata_lib/hist_utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hepdata_lib/hist_utils.py b/hepdata_lib/hist_utils.py index 9b111eaa..2ec99608 100644 --- a/hepdata_lib/hist_utils.py +++ b/hepdata_lib/hist_utils.py @@ -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: