diff --git a/droplets/droplets.py b/droplets/droplets.py index d140adf..821aeaf 100644 --- a/droplets/droplets.py +++ b/droplets/droplets.py @@ -866,7 +866,7 @@ def _get_mpl_patch(self, dim=None, *, color=None, **kwargs): class PerturbedDroplet2D(PerturbedDropletBase): - r"""Represents a single droplet in two dimensions with a perturbed shape. + r"""Represents a single 2D droplet with a perturbed shape. The shape is described using the distance :math:`R(\phi)` of the interface from the `position`, which is a function of the polar angle :math:`\phi`. This function is @@ -946,7 +946,7 @@ def interface_position(self, φ: np.ndarray) -> np.ndarray: Array with coordinates of interfacial points associated with each angle φ """ dist = self.interface_distance(φ) - pos = dist[:, None] * np.transpose([np.sin(φ), np.cos(φ)]) + pos = dist[:, None] * np.transpose([np.cos(φ), np.sin(φ)]) return self.position[None, :] + pos # type: ignore @preserve_scalars @@ -1044,7 +1044,7 @@ def _get_mpl_patch(self, dim=2, **kwargs): class PerturbedDroplet3D(PerturbedDropletBase): - r"""Represents a single droplet in three dimensions with a perturbed shape. + r"""Represents a single 3D droplet with a perturbed shape. The shape is described using the distance :math:`R(\theta, \phi)` of the interface from the origin as a function of the azimuthal angle :math:`\theta` and the polar @@ -1205,7 +1205,7 @@ def volume_approx(self) -> float: class PerturbedDroplet3DAxisSym(PerturbedDropletBase): - r"""Represents a droplet axisymmetrically perturbed shape in three dimensions. + r"""Represents a 3D droplet with axisymmetrically perturbed shape. The shape is described using the distance :math:`R(\theta)` of the interface from the origin as a function of the azimuthal angle :math:`\theta`, while polar symmetry diff --git a/droplets/image_analysis.py b/droplets/image_analysis.py index d198741..e8f1165 100644 --- a/droplets/image_analysis.py +++ b/droplets/image_analysis.py @@ -541,8 +541,8 @@ def refine_droplet( phase_field: ScalarField, droplet: DiffuseDroplet, *, - vmin: float = 0.0, - vmax: float = 1.0, + vmin: float | None = 0.0, + vmax: float | None = 1.0, adjust_values: bool = False, tolerance: float | None = None, least_squares_params: dict[str, Any] | None = None, @@ -565,7 +565,7 @@ def refine_droplet( vmax (float): The intensity value inside the droplet. If `None`, the value will be determined automatically. - adjust_value (bool): + adjust_values (bool): Flag determining whether the intensity values will be included in the fitting procedure. The default value `False` implies that the intensity values are regarded fixed. diff --git a/tests/conftest.py b/tests/conftest.py index f26f09e..7c93873 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -24,6 +24,8 @@ def init_random_number_generators(): @pytest.fixture(scope="function", autouse=True) def setup_and_teardown(): """Helper function adjusting environment before and after tests.""" + # ensure we use the Agg backend, so figures are not displayed + plt.switch_backend("agg") # raise all underflow errors np.seterr(all="raise", under="ignore") diff --git a/tests/test_examples.py b/tests/test_examples.py index 303c7d6..0dbf274 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -31,6 +31,7 @@ def test_example(path): env = os.environ.copy() env["PYTHONPATH"] = str(PACKAGE_PATH) + ":" + env.get("PYTHONPATH", "") + env["MPLBACKEND"] = "agg" proc = sp.Popen([sys.executable, path], env=env, stdout=sp.PIPE, stderr=sp.PIPE) try: outs, errs = proc.communicate(timeout=30)