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 03e62b2b4..1219cbc78 100644 --- a/python/damask/_table.py +++ b/python/damask/_table.py @@ -1,6 +1,6 @@ import re import copy -from typing import Union, Tuple, List +from typing import Union, Tuple, List, Iterable import pandas as pd import numpy as np @@ -14,7 +14,7 @@ class Table: def __init__(self, shapes: dict, data: np.ndarray, - comments: Union[str, list] = 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') @@ -434,8 +434,8 @@ class Table: def rename(self, - old: Union[str, List[str]], - new: Union[str, List[str]], + old: Union[str, Iterable[str]], + new: Union[str, Iterable[str]], info: str = None) -> 'Table': """ Rename column data. diff --git a/python/damask/_vtk.py b/python/damask/_vtk.py index 6baa16214..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. """ @@ -153,11 +153,11 @@ class VTK: Parameters ---------- - cells : iterable of int, len (3) + cells : sequence of int, len (3) Number of cells along each dimension. - size : iterable of float, len (3) + size : sequence of float, len (3) Physical length along each dimension. - origin : iterable of float, len (3), optional + origin : sequence of float, len (3), optional Coordinates of grid origin. Returns @@ -257,7 +257,7 @@ class VTK: Parameters ---------- - grid : iterables of floats, len (3) + grid : sequence of sequences of floats, len (3) Grid coordinates along x, y, and z directions. Returns