# PyMcaCore.NexusTools

PyMca5.PyMcaCore.NexusTools.getEntryName(path, h5file=None)

  Retrieve the top level name (not h5py object) associated to a given path despite being or not an NXentry group.

PyMca5.PyMcaCore.NexusTools.getMcaList(h5file, path, dataset=False, ignore=None)

  Retrieve the hdf5 dataset names down a given path where the interpretation attribute is set to “spectrum”.

  It also considers as eligible datasets, those whose last dimension is more than 1 and their name or parent group name start by mca.

  If dataset is False (default) it returns the dataset names. If dataset is True it returns the actual datasets.

  Apparently visititems ignores links. The following situation would not work:

  Actual dataset in /entry/detector/data with no interpretation attribute set and link to it named /entry/measurement/mca

PyMca5.PyMcaCore.NexusTools.getMcaObjectPaths(h5file, mcaPath)

  Given an h5py instance and the path to a dataset, try to retrieve all the paths with associated information needed to build an McaSpectrumObject.

  McaSpectrumObject is a DataObject where data are the counts and the info part contains the information below

  - live_time

  - preset_time

  - elapsed_time

  - counts

  - channels

  - calibration

  The information below will be read but is not used as it does not belong to the detector but to a yet-to-be-defined PyMca XRF application definition. Please do not rely on it.

  - i0

  - it

  - i0_to_flux_factor

  - it_to_flux_factor

PyMca5.PyMcaCore.NexusTools.getMeasurementGroup(h5file, path)

  Retrieve the measurement group associated to a path retrieving them from the same entry.

  It looks for:

  - A group named measurement at the entry level

  - The NXdata group at the entry level with the greater number of datasets

PyMca5.PyMcaCore.NexusTools.getNXClassGroups(h5file, path, classes, single=False)

  Retrieve the hdf5 groups inside a given path where the NX_class attribute matches one of the items in the classes list.

PyMca5.PyMcaCore.NexusTools.getNXClassList(h5file, path, classes, objects=False)

  Retrieve the hdf5 group names down a given path where the NXclass attribute is set to one of the items in the classes list.

  If objects is False (default) it returns the group names. If objects is True it returns the actual HDF5 group objects.

PyMca5.PyMcaCore.NexusTools.getNXdataList(h5file, path, objects=False)

  Retrieve the hdf5 group names down a given path where the NXclass attribute is set to “NXdata”.

  If groups is False (default) it returns the dataset names. If groups is True it returns the actual objects.

PyMca5.PyMcaCore.NexusTools.getPositionersGroup(h5file, path)

  Retrieve the positioners group associated to a path retrieving them from the same entry.

  It assumes they are either in:

  - NXentry/NXinstrument/positioners or

  - NXentry/measurement/pre_scan_snapshot

PyMca5.PyMcaCore.NexusTools.getScannedPositioners(h5file, path)

  Try to retrieve the positioners (aka. motors) that were moved.

  For that:

  > - Look for datasets present at measurement and positioners groups

  > - Look for positioners with more than one single value

  > - Look for datasets present at measurement and title

PyMca5.PyMcaCore.NexusTools.getStartingPositionerValues(h5file, path)

  Retrieve the start positioners names, values and units associated to a path retrieving them from the same entry.

  It assumes they are either in:

  - NXentry/NXinstrument/positioners_start or

  - NXentry/NXinstrument/positioners or

  - NXentry/measurement/pre_scan_snapshot

PyMca5.PyMcaCore.NexusTools.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

  - NXentry/NXinstrument/positioners or

  - NXentry/measurement/pre_scan_snapshot

PyMca5.PyMcaCore.NexusTools.getTitle(h5file, path)

  Retrieve the title associated to the entry asoociated to the provided path It returns an emptry string of not title is found

PyMca5.PyMcaCore.NexusTools.sanitizeFilePath(h5file, path, entry=None)

  This deals with the ESRF case of having a top-level entry being an external link to another top-level entry but with different name