Skip to content

Commit

Permalink
add validation of older NeXus NXdata convention
Browse files Browse the repository at this point in the history
  • Loading branch information
t20100 authored and Henri Payno committed Dec 2, 2021
1 parent 058b479 commit 138ad9e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/silx/io/nxdata/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,19 @@ def _validate(self):
signal_name,
auxiliary_signals_names)

if "axes" in self.group.attrs:
axes_names = get_attr_as_unicode(self.group, "axes")
if isinstance(axes_names, (str, bytes)):
axes_names = [axes_names]
axes_names = get_attr_as_unicode(self.group, "axes")
if axes_names is None:
# try @axes on signal dataset (older NXdata specification)
axes_names = get_attr_as_unicode(self.group[signal_name], "axes")
if axes_names is not None:
# we expect a comma separated string
if hasattr(axes_names, "split"):
axes_names = axes_names.split(":")

if isinstance(axes_names, (str, bytes)):
axes_names = [axes_names]

if axes_names:
self.issues += validate_number_of_axes(self.group, signal_name,
num_axes=len(axes_names))

Expand Down

0 comments on commit 138ad9e

Please sign in to comment.