Skip to content

Commit

Permalink
using utils.sequence.slice_sequence in __getitem__ for all
Browse files Browse the repository at this point in the history
  • Loading branch information
hayesla committed Apr 10, 2020
1 parent 7509ca9 commit 18f88fb
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions ndcube/ndcube_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,9 @@ def cube_like_world_axis_physical_types(self):
return self.data[0].world_axis_physical_types

def __getitem__(self, item):
print(item)
if isinstance(item, numbers.Integral):
return self.data[item]
else:
result = copy.deepcopy(self)
if isinstance(item, slice):
result.data = self.data[item]
else:
result.data = np.array([cube[item[1:]] for cube in self.data[item[0]]])
return utils.sequence.slice_sequence(self, item)

return result

@property
def index_as_cube(self):
"""
Expand Down

0 comments on commit 18f88fb

Please sign in to comment.