jaxdem.utils.h5#

HDF5 save/load utilities using the shared JaxDEM schema.

Design goals (no API changes):

  • Generic object round-trip for JaxDEM dataclasses and common containers.

  • Store importable callables by validated identity; loading is trusted input.

  • Schema evolution: warn on unknown fields, warn and use defaults for missing fields.

  • Enforce Python types for dataclass fields marked metadata={“static”: True} to keep JAX static hashing happy (e.g. NeighborList.max_neighbors).

Schema-3 files carry a shared top-level manifest. Unversioned files remain readable through the schema-1 legacy path. Per-node tags (e.g. __kind__ and __class__) preserve Python types inside the explicit payload envelope.

Functions

load(path, *[, warn_missing, warn_unknown, ...])

Load an object saved with save().

save(obj, path, *[, overwrite])

jaxdem.utils.h5.save(obj: Any, path: str, *, overwrite: bool = True) → None[source]#
jaxdem.utils.h5.load(path: str, *, warn_missing: bool = True, warn_unknown: bool = True, state_shape: tuple[int, ...] | None = None) → Any[source]#

Load an object saved with save().

state_shape is an optional (N, dim) hint used to bootstrap a System skeleton when the file does not contain the datasets needed to infer it.