Skip to content

Commit f205782

Browse files
authored
Merge pull request #824 from HEXRD/rectangle-opt-fix-fancy-indexing
Fix fancy indexing within rectangle optimization
2 parents 7dc207b + 8cdbbef commit f205782

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

hexrd/imageseries/process.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,20 @@ def _process_frame(self, key):
7878
# optimized version. If the adapter provides one it should be
7979
# significantly faster if not it will fallback to the same
8080
# implementation that _rectangle provides.
81-
if oplist and oplist[0][0] == self.RECT:
81+
if oplist and oplist[0][0] == self.RECT:
8282
region = oplist[0][1]
83-
img = self._rectangle_optimized(key,region)
83+
if isinstance(key, int):
84+
idx = key
85+
rest = []
86+
else:
87+
# Handle fancy indexing
88+
idx = key[0]
89+
rest = key[1:]
90+
91+
img = self._rectangle_optimized(idx, region)
92+
93+
if rest:
94+
img = img[*rest]
8495

8596
# remove the first operation since we already used it
8697
oplist = oplist[1:]

0 commit comments

Comments
 (0)