-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] Add operators (mult/div/sub) for (weighted) histograms/accumulators #693
Comments
boostorg/histogram#351 is adding this for division to Boost.Histogram. We try to match Boost.Histogram's support here, so division will be added once that is merged. |
And the tracking issue for the rest of them is here: boostorg/histogram#352 We'll follow those as they go in, and include them here. |
Division is in boostorg/histogram now, so it can get included here, right? |
Yep, if it's in Boost.Histogram, it can be added to boost-histogram. |
What is the status of this issue? In the Hist project, someone opened an issue regarding adding weighted histograms, and another issue is regarding using the It is possible to divide an weighted histogram by an non-weighted histogram. I think all these issues are caused by the lack of the following or similar attributes: Tested on version 1.3.2 |
Dear boost-histogram team, I would aslo be interesed in this feature. Especially diving two weighted histograms by each other. |
Describe the bug
Dividing/multiplying/subtracting histograms with weights results in an
AttributeError
, only the addition works. (as also mention here: #601 (comment))Is this not implemented yet or is this ill-defined how to propagate the errors?
If the latter, is it worth to have a different error message than an
AttributeError
?Steps to reproduce
Tested on newest release and on dev branch.
Error message:
Full traceback
Details
AttributeError Traceback (most recent call last)
in
----> 1 h * h
~/anaconda3/envs/zfit39/lib/python3.9/site-packages/boost_histogram/_internal/hist.py in mul(self, other)
360 ) -> H:
361 result = self.copy(deep=False)
--> 362 return result._compute_inplace_op("imul", other)
363
364 def rmul(
~/anaconda3/envs/zfit39/lib/python3.9/site-packages/boost_histogram/_internal/hist.py in _compute_inplace_op(self, name, other)
399 # Also takes CppHistogram, but that confuses mypy because it's hard to pick out
400 if isinstance(other, Histogram):
--> 401 getattr(self._hist, name)(other._hist)
402 elif isinstance(other, tuple(_histograms)):
403 getattr(self._hist, name)(other)
AttributeError: 'boost_histogram._core.hist.any_weight' object has no attribute 'imul'
The text was updated successfully, but these errors were encountered: