From efd6b5e492e9f621b367d9735ea9780a3f2e23b2 Mon Sep 17 00:00:00 2001 From: David Zwicker Date: Tue, 3 Oct 2023 18:01:07 +0200 Subject: [PATCH] Minor updates of docstrings and other small things --- pde/fields/scalar.py | 5 +++-- pde/grids/base.py | 12 +++++++----- pde/visualization/__init__.py | 2 +- pde/visualization/movies.py | 3 +-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pde/fields/scalar.py b/pde/fields/scalar.py index 99363120..6183ad72 100644 --- a/pde/fields/scalar.py +++ b/pde/fields/scalar.py @@ -167,8 +167,9 @@ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): arrs.append(arg) elif isinstance(arg, np.ndarray): if arg.shape != self.data.shape: - print(arg.shape, self.data.shape) - raise RuntimeError("Data shapes incompatible") + raise RuntimeError( + f"Data shapes incompatible ({arg.shape} != {self.data.shape}" + ) arrs.append(arg) elif isinstance(arg, self.__class__): self.assert_field_compatible(arg) diff --git a/pde/grids/base.py b/pde/grids/base.py index 2ff611f8..aa650dd1 100644 --- a/pde/grids/base.py +++ b/pde/grids/base.py @@ -571,14 +571,16 @@ def normalize_point( ) -> np.ndarray: """normalize grid coordinates by applying periodic boundary conditions - Here, the point is assumed to be specified by the physical values along the - non-symmetric axes of the grid. Normalizing points is useful to make sure they - lie within the domain of the grid. This function respects periodic boundary - conditions and can also reflect points off the boundary. + Here, points are assumed to be specified by the physical values along the + non-symmetric axes of the grid, e.g., by grid coordinates. Normalizing points is + useful to make sure they lie within the domain of the grid. This function + respects periodic boundary conditions and can also reflect points off the + boundary if `reflect = True`. Args: point (:class:`~numpy.ndarray`): - Coordinates of a single point + Coordinates of a single point or an array of points, where the last axis + denotes the point coordinates (e.g., a list of points). reflect (bool): Flag determining whether coordinates along non-periodic axes are reflected to lie in the valid range. If `False`, such coordinates are diff --git a/pde/visualization/__init__.py b/pde/visualization/__init__.py index d8cb3739..5cc5a953 100644 --- a/pde/visualization/__init__.py +++ b/pde/visualization/__init__.py @@ -7,7 +7,7 @@ movies plotting - + .. codeauthor:: David Zwicker """ diff --git a/pde/visualization/movies.py b/pde/visualization/movies.py index f2e06e5c..739d0fb6 100644 --- a/pde/visualization/movies.py +++ b/pde/visualization/movies.py @@ -9,8 +9,7 @@ movie_scalar movie_multiple movie - - + .. codeauthor:: David Zwicker """