diff --git a/python/damask/_grid.py b/python/damask/_grid.py index f7acfe5aa..4e82a4180 100644 --- a/python/damask/_grid.py +++ b/python/damask/_grid.py @@ -50,15 +50,16 @@ class Grid: Coordinates of grid origin in meter. Defaults to [0.0,0.0,0.0]. initial_conditions : dictionary, optional Labels and values of the inital conditions at each material point. - comments : (list of) str, optional - Comments, e.g. history of operations. + comments : str or iterable of str, optional + Additional, human-readable information, e.g. history of operations. """ self.material = material self.size = size # type: ignore self.origin = origin # type: ignore self.initial_conditions = {} if initial_conditions is None else initial_conditions - self.comments = [] if comments is None else comments # type: ignore + comments_ = [comments] if isinstance(comments,str) else comments + self.comments = [] if comments_ is None else [str(c) for c in comments_] def __repr__(self) -> str: """Give short human-readable summary.""" diff --git a/python/damask/_table.py b/python/damask/_table.py index 293f8fb1a..daba4ab95 100644 --- a/python/damask/_table.py +++ b/python/damask/_table.py @@ -14,7 +14,7 @@ class Table: def __init__(self, shapes: dict, data: np.ndarray, - comments: Union[str, Iterable] = None): + comments: Union[str, Iterable[str]] = None): """ New spreadsheet. @@ -30,7 +30,7 @@ class Table: """ comments_ = [comments] if isinstance(comments,str) else comments - self.comments = [] if comments_ is None else [c for c in comments_] + self.comments = [] if comments_ is None else [str(c) for c in comments_] self.shapes = { k:(v,) if isinstance(v,(np.int64,np.int32,int)) else v for k,v in shapes.items() } self.data = pd.DataFrame(data=data) self._relabel('uniform') diff --git a/python/damask/_vtk.py b/python/damask/_vtk.py index 17d8afa53..c41470638 100644 --- a/python/damask/_vtk.py +++ b/python/damask/_vtk.py @@ -103,7 +103,7 @@ class VTK: Parameters ---------- - comments : str or list of str + comments : str or sequence of str Comments. """