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

Points accessor for datasets? #1602

Open
takluyver opened this issue Jul 30, 2020 · 1 comment · May be fixed by #1793
Open

Points accessor for datasets? #1602

takluyver opened this issue Jul 30, 2020 · 1 comment · May be fixed by #1793

Comments

@takluyver
Copy link
Member

HDF5 has a way to select points in a dataset, passing coordinates for each point to H5Sselect_elements. This is exposed in the low-level API of h5py, but the only way to use it in the high level is with a mask array (an boolean array with the same shape as the dataset). This is only practical for smaller datasets where you can make this mask in memory.

I propose adding a new way to read/write individual points in a dataset, something like this:

dset.points[[
    (0, 5),
    (2, 6),
    (3, 9),
]]

i.e. that would read 3 points from a 2D dataset. I think it's easier to understand which points we're looking at this way than with numpy fancy indexing on multiple dimensions, where the equivalent would look like arr[[0, 2, 3], [5, 6, 9]].

This may be something for after 3.0.

@dota17
Copy link
Contributor

dota17 commented Jul 30, 2020

Yes, I think this is more easier to understand these fancy indexing operation.

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

Successfully merging a pull request may close this issue.

2 participants