save_to_hdf5

  • full name: tenpy.tools.hdf5_io.save_to_hdf5

  • parent module: tenpy.tools.hdf5_io

  • type: function

tenpy.tools.hdf5_io.save_to_hdf5(h5group, obj, path='/')[source]

Save an object obj into a hdf5 file or group.

Roughly equivalent to h5group[path] = obj, but handle different types of obj. For example, dictionaries are handled recursively. See Saving to disk: input/output for a specification of what can be saved and what the resulting datastructure is.

Parameters:
  • h5group (Group) – The HDF5 group (or h5py File) to which obj should be saved.

  • obj (object) – The object (=data) to be saved.

  • path (str) – Path within h5group under which the obj should be saved. To avoid unwanted overwriting of important data, the group/object should not yet exist, except if path is the default '/'.

Returns:

h5obj – The h5py group or dataset under which obj was saved.

Return type:

Group | Dataset