bundle.hdf5¶
Submodules¶
Classes¶
Simple HDF5 store for reading and writing datasets and attributes. |
Package Contents¶
- class bundle.hdf5.Store(path: pathlib.Path | str, mode: str = 'r')¶
Simple HDF5 store for reading and writing datasets and attributes.
Usage:
with Store("data.h5", mode="w") as store: store.write_dataset("group/data", np.array([1, 2, 3])) store.write_attrs("group", {"version": "1.0"}) with Store("data.h5", mode="r") as store: arr = store.read_dataset("group/data") attrs = store.read_attrs("group")
- path¶
- mode = 'r'¶
- property file: h5py.File¶
- write_dataset(name: str, data: numpy.ndarray, **kwargs)¶
Write or overwrite a dataset at the given path.
- write_attrs(path: str, attrs: dict | bundle.core.data.Data)¶
Write attributes to a group or dataset (creating a group if path doesn’t exist).
Accepts a plain dict or a
bundle.core.data.Datainstance (usesmodel_dump()). Only scalar and string values are stored; complex nested objects are JSON-serialised.