Skip to content

Commit

Permalink
Fix crashing bug when slicing NDCube.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DanRyanIrish committed Dec 16, 2019
1 parent 37d2db2 commit 85eb2c2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/223.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix crashing bug when an NDCube axis after the first is sliced with a numpy.int64.
2 changes: 1 addition & 1 deletion ndcube/utils/wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)):
missing_axes[i] = True
else:
raise NotImplementedError("Slicing FITS-WCS by {} not supported.".format(type(item)))
Expand Down

0 comments on commit 85eb2c2

Please sign in to comment.