hist
hist copied to clipboard
[BUG] cannot subtract histograms with Weight() storage
Trying to subtract histograms with Weight() storage raises an error:
AttributeError: 'boost_histogram._core.hist.any_weight' object has no attribute '__isub__'
Reproducer:
import hist
assert hist.__version__ == "2.6.1"
ax = hist.axis.Regular(5, 0, 5)
h_d = hist.Hist(ax, storage=hist.storage.Double())
h_w = hist.Hist(ax, storage=hist.storage.Weight())
values = [1, 2, 3, 4]
h_d.fill(values)
h_w.fill(values)
h_d - h_d # no problem
h_w + h_w # no problem
h_d - h_w # no problem
h_w - h_d # problem
The same issue arrises with multiplication and division:
h_w * h_w
h_w / h_w
Indeed, the same happens when dividing two (2d) histograms:
AttributeError: 'boost_histogram._core.hist.any_weight' object has no attribute '__itruediv__'
I think this is rather a boost_histogram
issue.