-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Raise error if user slices NDCube with Ellipsis. #224
Conversation
Thanks for the pull request @DanRyanIrish! Everything looks great! |
bf9e12a
to
dce8a38
Compare
Getting an |
ndcube/utils/wcs.py
Outdated
@@ -183,6 +183,10 @@ def _wcs_slicer(wcs, missing_axes, item): | |||
new_wcs = wcs.slice(item_checked) | |||
# if it a tuple like [0:2, 0:3, 2] or [0:2, 1:3] | |||
elif isinstance(item, tuple): | |||
# Ellipsis slicing is currently not supported. | |||
# Raise an error if user tries to slice by ellipsis. | |||
if type(Ellipsis) in [type(item_i) for item_i in item]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you do this with:
if type(Ellipsis) in [type(item_i) for item_i in item]: | |
if Ellipsis in item: |
?
dce8a38
to
de06195
Compare
You should probably add a regression test 😀 |
A regression test?!?!?! |
yeah so we don't break this later 😛 |
@Cadair I don't understand the difference between a regression test and just running all the existing tests... |
Apart from a test, is there anything blocking you from approving this PR? |
Description
ndcube 1.x does not support slicing
NDCube
s withEllipses
. However, when a user tries this, the operation does not fail, but rather slices the data correctly, but the FITS-WCS incorrectly. This PR causes the operation to fail with an informative error.Fixes #216