handle_hdf5_types

handle_hdf5_types#

ptyrad.utils.common.handle_hdf5_types(x)[source]#

Convert data to native Python or NumPy types. Especially when loaded by h5py.

Handles special cases like MATLAB v7.3 complex128 data types and ensures that data is converted to a format compatible with native Python or NumPy.

Also handles sentinel string “__NONE__” as a substitute for None in HDF5.

Parameters:

x – The input data to be converted.

Returns:

The converted data into native Python or NumPy types.