Skip to content

Commit 8a21050

Browse files
committed
Updated handling for 1-d shape elements
1 parent a6d2035 commit 8a21050

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arraypartition/partition.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ def _smooth_extent(self, extent):
153153

154154
smoothextent = []
155155
for x, ext in enumerate(extent):
156+
if isinstance(ext, int):
157+
smoothextent.append(ext)
158+
continue
156159
start = ext.start or 0
157160
stop = ext.stop or self.shape[x]
158161
step = ext.step or 1
@@ -801,7 +804,9 @@ def combine_slices(
801804
return newslice
802805
else:
803806
for dim in range(len(newslice)):
804-
if not _identical_extents(extent[dim], newslice[dim], shape[dim]):
807+
if isinstance(newslice[dim],int):
808+
extent[dim] = getattr(extent[dim],'start',None) or 0 + newslice[dim]*(getattr(extent[dim],'step',None) or 1)
809+
elif not _identical_extents(extent[dim], newslice[dim], shape[dim]):
805810
extent[dim] = combine_sliced_dim(extent[dim], newslice[dim], shape, dim)
806811
return extent
807812

0 commit comments

Comments
 (0)