Commit 5a767186 authored by Gordian Edenhofer's avatar Gordian Edenhofer
Browse files

selection_operators.py: Fix equal shape slicing

Allow the SliceOperator to handle a new shape which equals the old
shape.
parent 7be2eb8f
Pipeline #95737 passed with stages
in 11 minutes and 41 seconds
...@@ -65,9 +65,11 @@ class SliceOperator(LinearOperator): ...@@ -65,9 +65,11 @@ class SliceOperator(LinearOperator):
tgt = [] tgt = []
slc_by_ax = [] slc_by_ax = []
for i, d in enumerate(self._domain): for i, d in enumerate(self._domain):
if new_shape[i] is None or self._domain.shape[i] == new_shape[i]: if new_shape[i] is None or np.all(
np.array(self._domain.shape[i]) == np.array(new_shape[i])
):
tgt += [d] tgt += [d]
elif np.all(np.array(new_shape[i]) < np.array(d.shape)): elif np.all(np.array(new_shape[i]) <= np.array(d.shape)):
dom_kw = dict() dom_kw = dict()
if isinstance(d, RGSpace): if isinstance(d, RGSpace):
if preserve_dist: if preserve_dist:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment