Hdf5Exportable¶
full name: tenpy.tools.hdf5_io.Hdf5Exportable
parent module:
tenpy.tools.hdf5_iotype: class
Inheritance Diagram

Methods
|
Initialize self. |
|
Load instance from a HDF5 file. |
|
Export self into a HDF5 file. |
-
class
tenpy.tools.hdf5_io.Hdf5Exportable[source]¶ Bases:
objectInterface specification for a class to be exportable to our HDF5 format.
To allow a class to be exported to HDF5 with
save_to_hdf5(), it only needs to implement thesave_hdf5()method as documented below. To allow import, a class should implement the classmethodfrom_hdf5(). During the import, the class already needs to be defined; loading can only initialize instances, not define classes.The implementation given works for sufficiently simple (sub-)classes, for which all data is stored in
__dict__. In particular, this works for python-defined classes which simply store data usingself.data = datain their methods.-
save_hdf5(hdf5_saver, h5gr, subpath)[source]¶ Export self into a HDF5 file.
This method saves all the data it needs to reconstruct self with
from_hdf5().This implementation saves the content of
__dict__withsave_dict_content(), storing the format under the attribute'format'.
-
classmethod
from_hdf5(hdf5_loader, h5gr, subpath)[source]¶ Load instance from a HDF5 file.
This method reconstructs a class instance from the data saved with
save_hdf5().
-