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

RFC: specify multi-indexing behavior? #410

Closed
jni opened this issue Mar 26, 2022 · 3 comments
Closed

RFC: specify multi-indexing behavior? #410

jni opened this issue Mar 26, 2022 · 3 comments
Labels
Duplicate This issue or pull request already exists. Needs Discussion Needs further discussion. RFC Request for comments. Feature requests and proposed changes. topic: Indexing Array indexing.

Comments

@jni
Copy link

jni commented Mar 26, 2022

As far as I can tell, the array API doesn't specify how multi-indexing (e.g. arr[[1, 8, 9]]) works, either for single axis or multiple axes. I presume this is because different libraries have settled on different behaviour here, and it is hard to find community consensus on whether vectorised indexing (NumPy style) or orthogonal indexing (I think xarray? Maybe others?) should be used. My personal view is that we should all just use vector indexing by default but, failing that, it would still be very useful to settle on .vindex and .oindex properties for the API. I think these are either available or already do the "obviously" right thing on different array implementations.

Having a consistent API for vector indexing is extremely high value for napari, where we want to be compatible with any array input and need to write into arrays using fancy indexing (e.g. to annotate with a circular brush). Other libraries like scikit-image would certainly also benefit.

@asmeurer
Copy link
Member

If you mean integer array indexing, that is being discussed in #177. So far it's been omitted because not all libraries implement it.

If you just mean indexing with a tuple, like arr[1, 8, 9], that should be specified pretty well right now, so you'd need to clarify exactly what is missing.

@jakirkham
Copy link
Member

Bumping this thread as vindex & oindex came up in a recent meeting.

Also as it came up in the context of Zarr recently, which implements both the advanced indexing and vindex & oindex.

Should add Dask implements vindex (with some caveats), but not oindex currently.

@kgryte kgryte added topic: Indexing Array indexing. Needs Discussion Needs further discussion. labels Apr 4, 2024
@kgryte
Copy link
Contributor

kgryte commented Apr 4, 2024

I'm going to close this issue in favor of #669, where we are also discussing integer array indexing.

@kgryte kgryte closed this as completed Apr 4, 2024
@kgryte kgryte closed this as not planned Won't fix, can't repro, duplicate, stale Apr 4, 2024
@kgryte kgryte changed the title Specify multi-indexing behaviour? RFC: specify multi-indexing behavior? Apr 4, 2024
@kgryte kgryte added RFC Request for comments. Feature requests and proposed changes. Duplicate This issue or pull request already exists. labels Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate This issue or pull request already exists. Needs Discussion Needs further discussion. RFC Request for comments. Feature requests and proposed changes. topic: Indexing Array indexing.
Projects
None yet
Development

No branches or pull requests

4 participants