Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add motor info to QNexuswidget #1088

Merged
merged 6 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/PyMca5/PyMcaCore/NexusTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,28 @@ def getPositionersGroup(h5file, path):
positioners = group
return positioners

def getStartingPositionersGroup(h5file, path):
"""
Retrieve the start positioners group associated to a path
retrieving them from the same entry.

It assumes they are either in:

- NXentry/NXinstrument/positioners_start or
woutdenolf marked this conversation as resolved.
Show resolved Hide resolved

"""
entry_path = getEntryName(path, h5file=h5file)
instrument = getNXClassGroups(h5file, entry_path, ["NXinstrument", b"NXinstrument"], single=True)
positioners = None
if len(instrument):
instrument = instrument[0]
for key in instrument.keys():
if key in ["positioners_start", b"positioners_start"]:
positioners = instrument[key]
if not isGroup(positioners):
positioners = None
return positioners

def getMeasurementGroup(h5file, path):
"""
Retrieve the measurement group associated to a path
Expand Down
4 changes: 3 additions & 1 deletion src/PyMca5/PyMcaGui/io/hdf5/NexusInfo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import h5py

from PyMca5.PyMcaGui import PyMcaQt as qt
from PyMca5.PyMcaCore.NexusTools import getStartingPositionersGroup

from . import HDF5Info


Expand Down Expand Up @@ -94,7 +96,7 @@ def get_motor_positions(hdf5File, node):
if not isinstance(nxentry, h5py.Group):
return dict()

nxpositioners = nxentry.get("instrument/positioners_start", None)
nxpositioners = getStartingPositionersGroup(hdf5File, nxentry_name)
if nxpositioners is None or not isinstance(nxpositioners, h5py.Group):
return dict()

Expand Down
Loading