Issue with HDF5 dataset having missing values.
If a dataset from 'positioners' get less value than there is frame then we can get the following error:
----------------------------- TypeError Exception -----------------------------
Traceback (most recent call last):
File "/home/payno/dev/esrf/darkfield/darfix/src/darfix/gui/dimensionsWidget.py", line 286, in _find_dimensions
self._dataset.find_dimensions(
File "/home/payno/dev/esrf/darkfield/darfix/src/darfix/core/dataset.py", line 610, in find_dimensions
unique_values, unique_counts = array_utils.unique(
^^^^^^^^^^^^^^^^^^^
File "/home/payno/dev/esrf/darkfield/darfix/src/darfix/core/array_utils.py", line 13, in unique
unique_values, unique_indices, *other_indices = numpy.unique(
^^^^^^^^^^^^^
File "/home/payno/dev/esrf/darkfield/venv/lib/python3.11/site-packages/numpy/lib/arraysetops.py", line 274, in unique
ret = _unique1d(ar, return_index, return_inverse, return_counts,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/payno/dev/esrf/darkfield/venv/lib/python3.11/site-packages/numpy/lib/arraysetops.py", line 333, in _unique1d
perm = ar.argsort(kind='mergesort' if return_index else 'quicksort')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '>' not supported between instances of 'int' and 'NoneType'
-------------------------------------------------------------------------------
When the "dimensiondefinition" widget/find dimension is called.
Today the _HDF5MetadataReader
get_value always return a value
class _HDF5MetadataReader:
"""
Equivalent of silx.io.fabioh5.FabioReader to give access to HDF5 metadata
FIXME: remove this class. Storage and reading of metadata has been based on EDF. This class is a work-around
Design of handle metadata shouldn't be based on the data type but more abstracted
"""
def get_value(self, kind, name):
return self._metadata.get(name, None)
Which is not the case for EDF. darfix.core.dataset.extract_metadata_values
has a specific handling of the missing keys to define a default value directly at this level.