-
Notifications
You must be signed in to change notification settings - Fork 16
__eq__ method for Corr class #206
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
Conversation
Hi, thanks for adding this. I think it will be useful but I have to understand in which cases we expect and equality to be evaluated as |
My initial idea for implementing I then noticed a few subtleties with |
That makes sense. I just wondered about the "formal definition" of two objects being equal and if someone could be confused because two objects that are not equal (because they are different objects) would be determined to be equal based on this routine, which checks the numerical difference, timeslice by timeslice. I think both variants are fine. |
I agree with you that this behavior can be confusing. I now rewrote the comparison to return a boolean array that has the same shape as the correlator. To get a single bool one could now use (corr1 == 0).all()
(corr1 == corr2).all() The new behavior is closer to |
Thanks. I think it is good that the new behavior is more transparent to the user at the cost that the direct comparison of two correlators needs the extra call to |
I added a
__eq__
method for theCorr
class for simpler checks likecorr == 0
.