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

Added multi-axis advanced indexing support #343

Merged
merged 6 commits into from
May 15, 2020

Conversation

mikeymezher
Copy link
Contributor

Added support for multi-axis advanced indexing. Speed is comparable to single axis advanced indexing.

@hameerabbasi
Copy link
Collaborator

Thanks! This is missing some tests, those are pretty much essential.

@mikeymezher
Copy link
Contributor Author

It seems like the only failed test is test_slicing_errors(index).
Seems like an issue with the tests. This is likely because an IndexError is no longer being raised if len(adv_idx) is greater than 1 in _coo.indexing.py

What's the protocol for modifying the test cases?

Would you be able to handle this?

@hameerabbasi
Copy link
Collaborator

Seems like an issue with the tests. This is likely because an IndexError is no longer being raised if len(adv_idx) is greater than 1 in _coo.indexing.py

That's because the test was "testing" if we didn't have advanced indexing at all. You can get rid of the bad tests.

@hameerabbasi
Copy link
Collaborator

What's the protocol for modifying the test cases?

The contributor usually adds tests, and the maintainer/reviewer reviews the code and tests.

@mikeymezher
Copy link
Contributor Author

mikeymezher commented May 14, 2020

Alright, I'll add a few test cases to test_slicing(index) + remove test_slicing_error and submit a new PR

@hameerabbasi
Copy link
Collaborator

Oh, you can just push to your branch and it'll modify this PR. Don't need to close at all.

@hameerabbasi hameerabbasi reopened this May 14, 2020
@mikeymezher
Copy link
Contributor Author

Bug found in returned coordinates. Will attempt to fix tomorrow

Copy link
Collaborator

@hameerabbasi hameerabbasi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to add back the tests. It seems the previous tests only had 1D advanced indexing... That's okay, but we need a reasonable error message for not 1D that checks for an error.

multi_adv_ix_test.py Outdated Show resolved Hide resolved
multi_adv_ix_test2.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@hameerabbasi hameerabbasi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of the failures can be fixed by running pip install black and then black ..

sparse/_coo/indexing.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented May 15, 2020

Codecov Report

Merging #343 into master will decrease coverage by 0.04%.
The diff coverage is 90.00%.

@@            Coverage Diff             @@
##           master     #343      +/-   ##
==========================================
- Coverage   94.11%   94.07%   -0.05%     
==========================================
  Files          19       19              
  Lines        2379     2395      +16     
==========================================
+ Hits         2239     2253      +14     
- Misses        140      142       +2     

@hameerabbasi hameerabbasi merged commit 38ed16f into pydata:master May 15, 2020
@hameerabbasi
Copy link
Collaborator

Thanks, @mikeymezher!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants