Skip to content
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

[ENHANCE] Element equality for numpy array attributes #460

Open
precicely opened this issue Aug 28, 2024 · 0 comments
Open

[ENHANCE] Element equality for numpy array attributes #460

precicely opened this issue Aug 28, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@precicely
Copy link
Contributor

Description of the Enhancement

The Element class subclasses dataclass which comes inbuilt with various helper functions like __repr__, etc. However, comparisons between Elements will fail as the Element class has attributes that are numpy arrays which have ambiguous equality results unless using something like np.array_equal or similar.

This enhancement will extend the inbuilt __eq__ method provided by dataclass and ensure that numpy arrays are handled correctly.

Justification for the Enhancement

Due to the numpy arrays, it's currently not possible to do the following:

element_1 == element_2

By more intelligently handling the numpy arrays the above will be possible, it will simplify code testing, improve readability and be more pythonic.

Impact of Changes

Will simplify test suite and long term improve readability.

@precicely precicely added the enhancement New feature or request label Aug 28, 2024
precicely added a commit to precicely/k-wave-python that referenced this issue Aug 31, 2024
precicely added a commit to precicely/k-wave-python that referenced this issue Aug 31, 2024
precicely added a commit to precicely/k-wave-python that referenced this issue Sep 1, 2024
precicely added a commit to precicely/k-wave-python that referenced this issue Sep 1, 2024
precicely added a commit to precicely/k-wave-python that referenced this issue Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant