[Python][UHI] Extend TH1 equality operator to consider additional properties
This Pull request:
Changes or fixes:
The equality operator for ROOT histograms now compares the following properties:
- Histogram type (including dimension).
- Histogram kind.
- Shape (number of bins per axis).
- Bin contents array.
- Sum-of-weights-squared array.
- Axes properties.
Checklist:
- [x] tested changes locally
- [ ] updated the docs (if necessary)
This PR fixes #19038
@guitargeek I did not add checks for properties related to the GUI. We should discuss if those are part of determining whether 2 ROOT histograms are equal or not
Test Results
20 files 20 suites 3d 16h 28m 52s ⏱️ 3 013 tests 3 012 ✅ 0 💤 1 ❌ 58 672 runs 58 671 ✅ 0 💤 1 ❌
For more details on these failures, see this check.
Results for commit f13b675b.
:recycle: This comment has been updated with latest results.
A discussion might be needed. I personally lean towards not considering aspects such as colours or marker type part of the equality: they are not related to the statistical properties of the histos and in any case those will not be part of the new histograms...
I think we should keep this new equality operator only if there is a clear motivation from a user perspective,
While I see your point and I understand this new behaviour might lead to potential confusion for downstream users in the wild, let me stress that the pre-existing behaviour in master was simply wrong and a bug. If we decide against merging this PR, imagining that we find a way to accommodate the requirements for the UHI testing suite without using this equality operator, I will request that the equality operator is simply disabled for TH1 and derived classes, i.e. h1 == h2 should throw an exception.
Yes, okay then we're on the same page here!
I will request that the equality operator is simply disabled for TH1 and derived classes, i.e.
h1 == h2should throw an exception.
I think that would mean kicking out this pythonization: https://github.com/root-project/root/blob/master/bindings/pyroot/pythonizations/src/TObjectPyz.cxx
Then we don't even need to throw an exception but it's simply not implemented.
Closed in favor of #19209