From 8191a8b06cf4b3d11b4032beddaa8e25f138a689 Mon Sep 17 00:00:00 2001 From: David Zwicker Date: Thu, 18 Apr 2024 20:27:14 +0200 Subject: [PATCH] Improved documentation (#558) --- pde/fields/__init__.py | 9 +++++---- pde/tools/modelrunner.py | 6 +++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pde/fields/__init__.py b/pde/fields/__init__.py index 317122da..7e5507a8 100644 --- a/pde/fields/__init__.py +++ b/pde/fields/__init__.py @@ -22,9 +22,6 @@ .. codeauthor:: David Zwicker """ -# DataFieldBase has been moved to its own module on 2024-04-18. -# Add it back to `base` for the time being, so dependent code doesn't break -from . import base from .base import FieldBase from .collection import FieldCollection from .datafield_base import DataFieldBase @@ -32,5 +29,9 @@ from .tensorial import Tensor2Field from .vectorial import VectorField +# DataFieldBase has been moved to its own module on 2024-04-18. +# Add it back to `base` for the time being, so dependent code doesn't break +from . import base # isort:skip + base.DataFieldBase = DataFieldBase # type: ignore -del base +del base # clean namespaces diff --git a/pde/tools/modelrunner.py b/pde/tools/modelrunner.py index 9b70c4b2..623926ee 100644 --- a/pde/tools/modelrunner.py +++ b/pde/tools/modelrunner.py @@ -1,6 +1,10 @@ """ Establishes hooks for the interplay between :mod:`pde` and :mod:`modelrunner` +This package is usually loaded automatically during import if :mod:`modelrunner` is +available. In this case, grids and fields of :mod:`pde` can be directly written to +storages from :mod:`modelrunner.storage`. + .. codeauthor:: David Zwicker """ @@ -65,7 +69,7 @@ def load_field(storage: StorageBase, loc: Sequence[str]) -> FieldBase: Returns: :class:`~pde.fields.base.FieldBase`: the loaded field """ - # get grid class that was stored + # get field class that was stored stored_cls = decode_class(storage._read_attrs(loc).get("__class__")) attributes = stored_cls.unserialize_attributes(storage.read_attrs(loc)) # type: ignore return stored_cls.from_state(attributes, data=storage.read_array(loc)) # type: ignore