Skip to content

hdf5_utils#

Includes utility functions for HDF5 operations.

Functions:

  • load_hdf5_dict

    Loads the given HDF5 file and returns its contents as a dictionary.

  • save_hdf5_dict

    Saves a dictionary to an HDF5 file.

load_hdf5_dict #

load_hdf5_dict(filename: str) -> dict

Loads the given HDF5 file and returns its contents as a dictionary. The dictionary values can be either numpy arrays or scipy sparse matrices in CSR, COO, or CSC format. The dictionary keys should be strings in the format "[x,y,z]", where x, y, and z are the coordinates of the corresponding matrix in the hopping grid.

Parameters:

  • filename (str) –

    The path to the HDF5 file to load.

Returns:

  • dict

    A dictionary containing the contents of the HDF5 file.

save_hdf5_dict #

save_hdf5_dict(filename: str, data: dict)

Saves a dictionary to an HDF5 file. The dictionary values can be either numpy arrays or scipy sparse matrices in CSR, COO, or CSC format. The dictionary keys should be strings in the format "[x,y,z]", where x, y, and z are the coordinates of the corresponding matrix in the hopping grid.

Parameters:

  • filename (str) –

    The name of the HDF5 file to save the dictionary to.

  • data (dict) –

    The dictionary to save.

Returns:

  • None