diff --git a/field.py b/field.py index ee906e9d94853a31ead5021bddd26352e7d6b889..8913fc52a2a35daaff54430d261b46bac6f4dc27 100644 --- a/field.py +++ b/field.py @@ -83,9 +83,9 @@ class Field: the outer loop loops over dimension 2, the second outer over dimension 1, and the inner loop over dimension 0. Also allowed: the strings 'numpy' (0,1,..d) or 'reverseNumpy' (d, ..., 1, 0) """ - if layout == 'numpy' or layout.lower() == 'c': + if isinstance(layout, str) and (layout == 'numpy' or layout.lower() == 'c'): layout = tuple(range(spatialDimensions)) - elif layout == 'reverseNumpy' or layout.lower() == 'f': + elif isinstance(layout, str) and (layout == 'reverseNumpy' or layout.lower() == 'f'): layout = tuple(reversed(range(spatialDimensions))) if len(layout) != spatialDimensions: raise ValueError("Layout")