Skip to content

Advanced indexing #78

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

Closed
alimanfoo opened this issue Sep 23, 2016 · 9 comments · Fixed by #172
Closed

Advanced indexing #78

alimanfoo opened this issue Sep 23, 2016 · 9 comments · Fixed by #172
Labels
enhancement New features or improvements release notes done Automatically applied to PRs which have release notes.
Milestone

Comments

@alimanfoo
Copy link
Member

It would be fairly straightforward to add support for indexing a Zarr array with a boolean array or list/array of indices, provided that (1) only one dimension has a fancy index, and (2) if a list/array of indices, indices are given in increasing order.

@alimanfoo
Copy link
Member Author

See also #77

@jakirkham
Copy link
Member

So I'm trying to think of the best way to reformat indices of this sort into an easier to work with form per our earlier discussion.

I have other code library that would be pretty easy to move into kenjutsu. This code converts a list of indices into a bool array. Though it would be pretty easy to also handle arrays of indices too. This works with arbitrary numbers of dimensions, but certainly could be used in only 1D cases.

Also I have some code that could be refactored out that takes an unordered list of indices and orders it, but also provides an additional set of indices to map the ordered indices back into the intended ordering. It works pretty nicely with NumPy arrays and could be handy here. Doesn't handle arrays of indices, but could look into that.

Does any of this sound interesting? Do you have some other ideas about how you would like to work with these cases?

@alimanfoo
Copy link
Member Author

alimanfoo commented Dec 1, 2016 via email

@jakirkham
Copy link
Member

Thanks for all the info. I've been giving this some thought and playing with some things on my end. Let me see if I can get something more concrete for us to discuss.

@alimanfoo
Copy link
Member Author

alimanfoo commented Dec 9, 2016 via email

@alimanfoo alimanfoo modified the milestone: v2.2 Jan 24, 2017
@jakirkham
Copy link
Member

jakirkham commented Feb 13, 2017

What about something where we break slices that have multiple indices into a set of slices with a single index each and iterate over them? Worked up something like this in PR ( jakirkham/kenjutsu#52 ), which I'm starting to play with and it seems to do alright.

@jakirkham
Copy link
Member

The 0.4.0 version of kenjutsu (now on PyPI and conda-forge) should provide you a way to solve the list of indices in one dimension problem.

@alimanfoo
Copy link
Member Author

alimanfoo commented Feb 18, 2017 via email

@jakirkham
Copy link
Member

So PR ( https://github.com/alimanfoo/zarr/pull/116 ) implements this functionality using kenjutsu. If you have time, would appreciate your feedback there.

@alimanfoo alimanfoo mentioned this issue Apr 6, 2017
@alimanfoo alimanfoo mentioned this issue Oct 31, 2017
6 tasks
@alimanfoo alimanfoo added the in progress Someone is currently working on this label Oct 31, 2017
@alimanfoo alimanfoo changed the title Fancy indexing (single dimension) Advanced indexing Oct 31, 2017
@alimanfoo alimanfoo removed the in progress Someone is currently working on this label Nov 13, 2017
@alimanfoo alimanfoo added enhancement New features or improvements release notes done Automatically applied to PRs which have release notes. labels Nov 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features or improvements release notes done Automatically applied to PRs which have release notes.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants