我有一个复杂的h5文件。 2D阵列。我想展示它。但是我有以下错误。怎么了?
import h5py
import numpy as np
import matplotlib.pyplot as plt
with h5py.File('obj_0001.h5','r') as hdf:
ls = list(hdf.keys())
print('List of datasets in thies file: \n',ls)
data = hdf.get('dataset')
diff = np.array(data)
print('Shape of dataset: \n',diff.shape)
plt.figure(1)
plt.imshow(np.abs(diff))
plt.savefig('diff_test.png')
plt.show()
UFuncTypeError: ufunc 'absolute' did not contain a loop with signature matching types dtype([('real','<f4'),('imag','<f4')]) -> dtype([('real','<f4')])