-
-
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
Bugfix for Issue 218: NDCube slicing with numpy.int64 #223
Conversation
Thanks for the pull request @DanRyanIrish! Everything looks great! |
e176bd6
to
8481fee
Compare
8481fee
to
85eb2c2
Compare
ndcube/utils/wcs.py
Outdated
@@ -207,7 +207,7 @@ def _wcs_slicer(wcs, missing_axes, item): | |||
item_ = _slice_list(item_checked) | |||
new_wcs = wcs.slice(item_) | |||
for i, it in enumerate(item_checked): | |||
if isinstance(it, int): | |||
if isinstance(it, (int, np.int64, np.int32)): |
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.
I think this will work
if isinstance(it, (int, np.int64, np.int32)): | |
if isinstance(it, numbers.Integral): |
having done a import numbers
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.
Looks like it does! Thanks!
Hi @Cadair. Is there a better way to capture all int-types rather than just listing them out as is done in this PR? |
85eb2c2
to
f92e222
Compare
f92e222
to
0797e99
Compare
If an axis after the first axis was sliced with a non-native int type, e.g. numpy.int64, the slixing would crash due to missing_axes not being altered. This commit adds support for nupy.int64 and numpy.int32 types.
0797e99
to
3e05ca4
Compare
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.
CI fails are unrelated, although they need investigating before a patch release.
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.
Looks fine!
Description
If an NDCube axis after the first axis was sliced with a non-native int type,
e.g. numpy.int64, the slicing would crash due to missing_axes not being
altered. This commit adds support for numpy.int64 and numpy.int32 types.
Fixes #218