Skip to content

Commit 1c2853b

Browse files
Fix MultiFab getitem for single imaginary index (#477)
This fixes the indexing of MultiFabs when a single imaginary index is given, for example `Ex[1j]`. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 6601b43 commit 1c2853b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/amrex/extensions/MultiFab.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,9 @@ def _process_index(self, index):
312312

313313
if index == Ellipsis:
314314
index = [] # This will be filled in below to cover the valid cells
315-
elif isinstance(index, slice) or isinstance(index, int):
315+
elif (
316+
isinstance(index, slice) or isinstance(index, int) or isinstance(index, complex)
317+
):
316318
# If only one slice or integer passed in, it was not wrapped in a tuple
317319
index = [index]
318320
elif isinstance(index, tuple):

0 commit comments

Comments
 (0)