FAIRmat-NFDI / pynxtools

https://fairmat-nfdi.github.io/pynxtools/
Apache License 2.0
13 stars 8 forks source link

[Bug]: read_nexus fails on illegal AXISNAME_indices #436

Open rettigl opened 2 months ago

rettigl commented 2 months ago

Contact Details

rettig@fhi-berlin.mpg.de

What happened?

When reading a nexus file that contains inside an NXdata section a AXISNAME_indices field, and the corresponding AXISNAME does not exist, read_nexus exits with a KeyError, rather than reporting the incorrect NXdata group.

Relevant log output

DEBUG: value:  
Traceback (most recent call last):
  File "/mnt/pcshare/users/Laurenz/AreaB/pynxtools/.pyenv/bin/read_nexus", line 8, in <module>
    sys.exit(main())
  File "/mnt/pcshare/users/Laurenz/AreaB/pynxtools/.pyenv/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/mnt/pcshare/users/Laurenz/AreaB/pynxtools/.pyenv/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/mnt/pcshare/users/Laurenz/AreaB/pynxtools/.pyenv/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/mnt/pcshare/users/Laurenz/AreaB/pynxtools/.pyenv/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/mnt/pcshare/users/Laurenz/AreaB/pynxtools/pynxtools/src/pynxtools/nexus/nexus.py", line 843, in main
    nexus_helper.process_nexus_master_file(None)
  File "/mnt/pcshare/users/Laurenz/AreaB/pynxtools/pynxtools/src/pynxtools/nexus/nexus.py", line 780, in process_nexus_master_file
    get_default_plotable(self.in_file, self.logger)
  File "/mnt/pcshare/users/Laurenz/AreaB/pynxtools/pynxtools/src/pynxtools/nexus/nexus.py", line 497, in get_default_plotable
    axis_helper(dim, nxdata, signal, axes, logger)
  File "/mnt/pcshare/users/Laurenz/AreaB/pynxtools/pynxtools/src/pynxtools/nexus/nexus.py", line 621, in axis_helper
    and nxdata[attr.split("_indices")[0]] not in ax_list
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "/mnt/pcshare/users/Laurenz/AreaB/pynxtools/.pyenv/lib/python3.8/site-packages/h5py/_hl/group.py", line 357, in __getitem__
    oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py/h5o.pyx", line 190, in h5py.h5o.open
KeyError: "Unable to open object (object 'pump_probe_delay2' doesn't exist)"