hexrd.utils.hdf5 module

hexrd.utils.hdf5.unwrap_dict_to_h5(grp, d, asattr=False)[source]

Unwraps a dictionary to an HDF5 file of the same structure.

Parameters

grpHDF5 group object

The HDF5 group to recursively unwrap the dict into.

ddict

Input dict (of dicts).

asattrbool, optional

Flag to write end member in dictionary tree to an attribute. If False, if writes the object to a dataset using numpy. The default is False.

Returns

None.

hexrd.utils.hdf5.unwrap_h5_to_dict(f, d)[source]

Unwraps a simple HDF5 file to a dictionary of the same structure.

Parameters

fHDF5 file (mode r)

The input HDF5 file object.

ddict

dictionary object to update.

Returns

None.

Notes

As written, ignores attributes and uses numpy to cast HDF5 datasets to dict entries. Checks for ‘O’ type arrays and casts to strings; also converts single-element arrays to scalars.