dump_dict

support.hdf5_util.dump_dict(f_obj_or_group, data_dict)

Dump the contents of a data dictionary into some file object or group.

Examples:

import numpy as np
import h5py

from support.hdf5_util import dump_dict

data_dict = {
    "level0": {
        "level1":{
            "level2": np.ones(100)
        }
    }
}
f_obj = h5py.File("example.hdf5","r+")
dump_dict(f_obj, data_dict)
print(f_obj["level0/level1/level2"][...])
# >>> bunch of ones!
f_obj.close()
Parameters
  • f_obj_or_group (h5py.File/h5py.Group) – h5py file or group object

  • data_dict (dict) – dictionary whose contents we want to dump

Returns

None