fpd_to_tuple fails with h5py version 3
By default, when installing fpd
via pip
the latest version of h5py is installed (currently v3.1.0). fpd_to_tuple
fails with this version of h5py, whereas it works with version 2.10.0.
The issue appears to be similar to one reported for TensorFlow and h5py version 3:
https://github.com/h5py/h5py/issues/1732
Their solution for now is to pin the h5py version to 2.10.0 in the requirements list.
Here is the code and error output when using h5py 3.1.0:
import fpd.fpd_file as fpdf
import h5py as h5
print(h5.__version__)
3.1.0
h5filename = 'data.hdf5'
fpdt = fpd.fpd_file.fpd_to_tuple(h5filename)
Detected emd groups: ['DAC', 'DM0', 'Exposure', 'Threshold', 'Unixtime', 'binary_hdr', 'fpd_data', 'fpd_sum_dif', 'fpd_sum_im']
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-13-25aa02a62f17> in <module>
1 h5filename = rootpath + dirs[3] + "/HighMw_Annealed.hdf5"
----> 2 fpdt = fpd.fpd_file.fpd_to_tuple(h5filename)
~/miniconda3/envs/fpd/lib/python3.8/site-packages/fpd/fpd_file.py in fpd_to_tuple(fpg, group_names, nd_max, gigabytes_max, fpd_check)
3207 nbytes = dct[data_name].size
3208 if nd <= nd_max and nbytes / 1e9 <= gigabytes_max:
-> 3209 dct.update({data_name: emd_dg[data_name].value})
3210
3211 # add axes
AttributeError: 'Dataset' object has no attribute 'value'
When using h5py version 2.10.0, fpd_to_tuple successfully reads the data, but a DeprecationWarning
is raised that may suggest the origin of the error in version 3.1.0.
import fpd.fpd_file as fpdf
import h5py as h5
print(h5.__version__)
2.10.0
h5filename = 'data.hdf5'
fpdt = fpd.fpd_file.fpd_to_tuple(h5filename)
Detected emd groups: ['DAC', 'DM0', 'Exposure', 'Threshold', 'Unixtime', 'binary_hdr', 'fpd_data', 'fpd_sum_dif', 'fpd_sum_im']
/home/aherzing/miniconda3/envs/fpd/lib/python3.8/site-packages/fpd/fpd_file.py:3209: H5pyDeprecationWarning: dataset.value has been deprecated. Use dataset[()] instead.
dct.update({data_name: emd_dg[data_name].value})
/home/aherzing/miniconda3/envs/fpd/lib/python3.8/site-packages/fpd/fpd_file.py:3216: H5pyDeprecationWarning: dataset.value has been deprecated. Use dataset[()] instead.
ax_dct.update({'data': ax_gp.value})