Closed
Description
In some cases SparselyBin returns inconsistent values of bin_edges / bin_entries if binWidth is float and low/high are given.
For example following code:
import numpy as np
from histogrammar.primitives.sparselybin import SparselyBin
values = np.array([0.114, 146.756, 302.333, 417.022, 720.324])
low, high = 314.0, 332.0
hist = SparselyBin(binWidth=10.1)
hist.fill.numpy(values)
edges = hist.bin_edges(low=low, high=high)
entries = hist.bin_entries(low=low, high=high)
print(f"edges={edges}")
print(f"entries={entries}")
assert len(edges) == len(entries) + 1
Gives assertion error:
edges=[313.1 319.83333333 326.56666667 333.3 ]
entries=[0. 0.]
Traceback (most recent call last):
File "a.py", line 15, in <module>
assert len(edges) == len(entries) + 1
AssertionError
This error is most likely related to the issue in popmon: ing-bank/popmon#244
Metadata
Metadata
Assignees
Labels
No labels