From 9ce4573b12660fcbcb7be092df4fe829ccfff3b8 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 29 Jan 2022 23:16:57 +0100 Subject: [PATCH] docstring polishing --- python/damask/_grid.py | 13 +++++-------- python/damask/util.py | 25 +++++++++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/python/damask/_grid.py b/python/damask/_grid.py index 0b3a067e2..b08f99757 100644 --- a/python/damask/_grid.py +++ b/python/damask/_grid.py @@ -786,9 +786,8 @@ class Grid: Parameters ---------- - directions : (sequence of) str + directions : (sequence of) {'x', 'y', 'z'} Direction(s) along which the grid is mirrored. - Valid entries are 'x', 'y', 'z'. reflect : bool, optional Reflect (include) outermost layers. Defaults to False. @@ -832,16 +831,14 @@ class Grid: def flip(self, - directions: Union[Literal['x', 'y', 'z'], - Sequence[Literal['x', 'y', 'z']]]) -> 'Grid': + directions: Sequence[str]) -> 'Grid': """ Flip grid along given directions. Parameters ---------- - directions : (sequence of) str + directions : (sequence of) {'x', 'y', 'z'} Direction(s) along which the grid is flipped. - Valid entries are 'x', 'y', 'z'. Returns ------- @@ -1176,9 +1173,9 @@ class Grid: ---------- periodic : bool, optional Assume grid to be periodic. Defaults to True. - directions : (sequence of) string, optional + directions : (sequence of) {'x', 'y', 'z'}, optional Direction(s) along which the boundaries are determined. - Valid entries are 'x', 'y', 'z'. Defaults to 'xyz'. + Defaults to 'xyz'. Returns ------- diff --git a/python/damask/util.py b/python/damask/util.py index 0cf6606fb..0bbc1e7b5 100644 --- a/python/damask/util.py +++ b/python/damask/util.py @@ -305,16 +305,20 @@ def project_equal_angle(vector: np.ndarray, normalize : bool Ensure unit length of input vector. Defaults to True. keepdims : bool - Maintain three-dimensional output coordinates. Defaults to False. - Two-dimensional output uses right-handed frame spanned by - the next and next-next axis relative to the projection direction, - e.g. x-y when projecting along z and z-x when projecting along y. + Maintain three-dimensional output coordinates. + Defaults to False. Returns ------- coordinates : numpy.ndarray, shape (...,2 | 3) Projected coordinates. + Notes + ----- + Two-dimensional output uses right-handed frame spanned by + the next and next-next axis relative to the projection direction, + e.g. x-y when projecting along z and z-x when projecting along y. + Examples -------- >>> import damask @@ -349,16 +353,21 @@ def project_equal_area(vector: np.ndarray, normalize : bool Ensure unit length of input vector. Defaults to True. keepdims : bool - Maintain three-dimensional output coordinates. Defaults to False. - Two-dimensional output uses right-handed frame spanned by - the next and next-next axis relative to the projection direction, - e.g. x-y when projecting along z and z-x when projecting along y. + Maintain three-dimensional output coordinates. + Defaults to False. Returns ------- coordinates : numpy.ndarray, shape (...,2 | 3) Projected coordinates. + Notes + ----- + Two-dimensional output uses right-handed frame spanned by + the next and next-next axis relative to the projection direction, + e.g. x-y when projecting along z and z-x when projecting along y. + + Examples -------- >>> import damask