pyiron_base.interfaces.object.HasStorage#
- class pyiron_base.interfaces.object.HasStorage(*args, group_name=None, **kwargs)[source]#
Bases:
HasHDF,ABCA base class for objects that use HDF5 data serialization via the DataContainer class.
Unless you know what you are doing sub classes should pass the group_name argument to
__init__()or overrideget_hdf_group_name()to force a default name for the HDF group the object should write itself to.- __init__(*args, group_name=None, **kwargs)[source]#
- Parameters:
group_name (str) – default name of the HDF group where the whole object should be written to.
Methods
__init__(*args[, group_name])- param group_name:
default name of the HDF group where the whole object should be written to.
from_hdf(hdf[, group_name])Read object to HDF.
from_hdf_args(hdf)Read arguments for instance creation from HDF5 file.
rewrite_hdf(hdf[, group_name])Update the HDF representation.
to_hdf(hdf[, group_name])Write object to HDF.
Attributes
storage- from_hdf(hdf: ProjectHDFio, group_name: str = None)#
Read object to HDF.
If group_name is given descend into subgroup in hdf first.
- Parameters:
hdf (
ProjectHDFio) – HDF group to read fromgroup_name (str, optional) – name of subgroup
- classmethod from_hdf_args(hdf: ProjectHDFio) dict#
Read arguments for instance creation from HDF5 file.
- Parameters:
hdf (ProjectHDFio) – HDF5 group object
- Returns:
arguments that can be **kwarg-passed to cls().
- Return type:
dict
- rewrite_hdf(hdf: ProjectHDFio, group_name: str = None)#
Update the HDF representation.
If an object is read from an older layout, this will remove the old data and rewrite it in the newest layout.
- Parameters:
hdf (
ProjectHDFio) – HDF group to read/writegroup_name (str, optional) – name of subgroup
- to_hdf(hdf: ProjectHDFio, group_name: str = None)#
Write object to HDF.
If group_name is given create a subgroup in hdf first.
- Parameters:
hdf (
ProjectHDFio) – HDF group to write togroup_name (str, optional) – name of subgroup