diff --git a/python/damask/_grid.py b/python/damask/_grid.py index 61b64e018..561f851be 100644 --- a/python/damask/_grid.py +++ b/python/damask/_grid.py @@ -1183,8 +1183,9 @@ class Grid: np.in1d(stencil,np.array(list(set(selection) - {me})))) offset_ = np.nanmax(self.material)+1 if offset is None else offset - selection_ = util.tbd(selection) if not invert_selection else \ - list(set(self.material.flatten()) - set(util.tbd(selection))) + selection_ = util.tbd(selection) + if selection_ is not None and invert_selection: + selection_ = list(set(self.material.flatten()) - set(selection_)) mask = ndimage.filters.generic_filter(self.material, tainted_neighborhood, size=1+2*vicinity, diff --git a/python/damask/util.py b/python/damask/util.py index 1588906a2..880e815e8 100644 --- a/python/damask/util.py +++ b/python/damask/util.py @@ -16,7 +16,7 @@ import numpy as np import h5py from . import version -from ._typehints import FloatSequence, NumpyRngSeed +from ._typehints import FloatSequence, NumpyRngSeed, IntCollection # limit visibility __all__=[ @@ -752,7 +752,7 @@ def tail_repack(extended: Union[str, Sequence[str]], list(extended[len(existing):])) -def tbd(arg) -> List: +def tbd(arg: Union[IntCollection,int,None]) -> Union[List,None]: if arg is None: return None elif isinstance(arg,(np.ndarray,Collection)):