sidpy.hdf.dtype_utils.get_compound_sub_dtypes

sidpy.hdf.dtype_utils.get_compound_sub_dtypes(struct_dtype)[source]

Returns a dictionary of the dtypes of each of the fields in the given structured array dtype

Parameters:

struct_dtype (numpy.dtype) – dtype of a structured array

Returns:

dtypes – Dictionary whose keys are the field names and values are the corresponding dtypes

Return type:

dict

Examples

>>> import numpy as np
>>> import sidpy
>>> struct_dtype = np.dtype({'names': ['r', 'g', 'b'],
>>>                      'formats': [np.float32, np.uint16, np.float64]})
>>> sub_dtypes = sidpy.dtype_utils.get_compound_sub_dtypes(struct_dtype)
>>> for key, val in sub_dtypes.items():
>>>     print('{} : {}'.format(key, val))
g : uint16
r : float32
b : float64