Skip to content

Commit

Permalink
Fix spectral slice handling in tuple input case (e.g. crop)
Browse files Browse the repository at this point in the history
  • Loading branch information
rosteen committed Mar 7, 2023
1 parent b61fab1 commit 69ad345
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion specutils/spectra/spectrum1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,10 @@ def __getitem__(self, item):
"values is not currently allowed, "
"please use a slice.")
spec_item = slice(spec_item, spec_item+1, None)
item = item[:-1] + (spec_item,)
# We have to hack around updating this tuple entry
item = list(item)
item[self.spectral_axis_index] = spec_item
item = tuple(item)
else:
# Slicing on less than the full number of axes means we want
# to keep the whole spectral axis
Expand Down

0 comments on commit 69ad345

Please sign in to comment.