From de0619597c4f1f9bdd17e3501b468ef0c471fb2f Mon Sep 17 00:00:00 2001 From: DanRyanIrish Date: Mon, 16 Dec 2019 14:32:33 -0500 Subject: [PATCH] Raise error if user slices with ellipsis. --- changelog/224.bugfix.rst | 1 + ndcube/utils/wcs.py | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 changelog/224.bugfix.rst diff --git a/changelog/224.bugfix.rst b/changelog/224.bugfix.rst new file mode 100644 index 000000000..18e1f8680 --- /dev/null +++ b/changelog/224.bugfix.rst @@ -0,0 +1 @@ +Raises error if NDCube is sliced with an Ellipsis. diff --git a/ndcube/utils/wcs.py b/ndcube/utils/wcs.py index 981b8ca0c..80661b8ea 100644 --- a/ndcube/utils/wcs.py +++ b/ndcube/utils/wcs.py @@ -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 Ellipsis in item: + raise NotImplementedError("Slicing FITS-WCS by ellipsis not supported.") # this is used to not exceed the range of the item tuple # if the check of the missing_axes which is False if not dead # is a success than the the item of the tuple is added one by