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

Catch out of bounds indexing errors in datasets #303

Merged
merged 2 commits into from
Jun 14, 2018

Conversation

achilleas-k
Copy link
Member

DataSet.__getitem__ checks if the indexes or slices are out of bounds before calling the read_data() methods, in order to throw a more useful error message.

Fixes #299.

Catches out-of-bounds indexing before calling read_direct() in h5py to
make the error message and exception type clearer.
Check that out of bounds indexing for data raises IndexError (instead of
the h5py TypeError).
Copy link
Member

@gicmo gicmo left a comment

Choose a reason for hiding this comment

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

LGTM

@jgrewe jgrewe merged commit c4c2b60 into G-Node:master Jun 14, 2018
@achilleas-k achilleas-k deleted the catch-oob-early branch July 3, 2018 12:18
achilleas-k added a commit to achilleas-k/nixpy that referenced this pull request Jul 11, 2018
H5Py throws ValueError for out-of-bounds indexing. We catch it and throw
IndexError instead, reusing the error message from H5Py.

This also makes indexing more flexible. Slices now work the same as in
numpy, so no slice is ever out-of-bounds. The corresponding test has
been updated accordingly.

This is an updated version of PR G-Node#303, which was a fix for G-Node#299.
achilleas-k added a commit to achilleas-k/nixpy that referenced this pull request Jul 12, 2018
H5Py throws ValueError for out-of-bounds indexing. We catch it and throw
IndexError instead, reusing the error message from H5Py.

This also makes indexing more flexible. Slices now work the same as in
numpy, so no slice is ever out-of-bounds. The corresponding test has
been updated accordingly.

This is an updated version of PR G-Node#303, which was a fix for G-Node#299.
achilleas-k added a commit to achilleas-k/nixpy that referenced this pull request Jul 12, 2018
H5Py throws ValueError for out-of-bounds indexing. We catch it and throw
IndexError instead, reusing the error message from H5Py.

This also makes indexing more flexible. Slices now work the same as in
numpy, so no slice is ever out-of-bounds. The corresponding test has
been updated accordingly.

This is an updated version of PR G-Node#303, which was a fix for G-Node#299.
achilleas-k added a commit to achilleas-k/nixpy that referenced this pull request Jul 12, 2018
H5Py throws ValueError for out-of-bounds indexing. We catch it and throw
IndexError instead, reusing the error message from H5Py.

This also makes indexing more flexible. Slices now work the same as in
numpy, so no slice is ever out-of-bounds. The corresponding test has
been updated accordingly.

This is an updated version of PR G-Node#303, which was a fix for G-Node#299.
achilleas-k added a commit to achilleas-k/nixpy that referenced this pull request Jul 12, 2018
H5Py throws ValueError for out-of-bounds indexing. We catch it and throw
IndexError instead, reusing the error message from H5Py.

This also makes indexing more flexible. Slices now work the same as in
numpy, so no slice is ever out-of-bounds. The corresponding test has
been updated accordingly.

This is an updated version of PR G-Node#303, which was a fix for G-Node#299.
achilleas-k added a commit to achilleas-k/nixpy that referenced this pull request Jan 18, 2019
H5Py throws ValueError for out-of-bounds indexing. We catch it and throw
IndexError instead, reusing the error message from H5Py.

This also makes indexing more flexible. Slices now work the same as in
numpy, so no slice is ever out-of-bounds. The corresponding test has
been updated accordingly.

This is an updated version of PR G-Node#303, which was a fix for G-Node#299.
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.

None yet

3 participants