diff --git a/pynxtools/nexus/nxdl_utils.py b/pynxtools/nexus/nxdl_utils.py index 5c3722f9b..be9881448 100644 --- a/pynxtools/nexus/nxdl_utils.py +++ b/pynxtools/nexus/nxdl_utils.py @@ -227,8 +227,6 @@ def belongs_to(nxdl_elem, child, name, class_type=None, hdf_name=None): chk_name = hdf_name or name if act_htmlname == chk_name: return True - if not hdf_name: # search for name fits is only allowed for hdf_nodes - return False try: # check if nameType allows different name name_any = bool(child.attrib["nameType"] == "any") except KeyError: @@ -342,10 +340,6 @@ def get_own_nxdl_child( "nxdlpath", nxdl_elem.get("nxdlpath") + "/" + get_node_name(child) ) return child - for child in nxdl_elem: - if "name" in child.attrib and child.attrib["name"] == name: - child.set("nxdlbase", nxdl_elem.get("nxdlbase")) - return child for child in nxdl_elem: result = get_own_nxdl_child_reserved_elements(child, name, nxdl_elem) diff --git a/tests/data/dataconverter/readers/mpes/Ref_nexus_mpes.log b/tests/data/dataconverter/readers/mpes/Ref_nexus_mpes.log index b50f8cc4b..5a414add1 100644 --- a/tests/data/dataconverter/readers/mpes/Ref_nexus_mpes.log +++ b/tests/data/dataconverter/readers/mpes/Ref_nexus_mpes.log @@ -308,8 +308,48 @@ DEBUG - classes: NXmpes.nxdl.xml:/ENTRY/data NXentry.nxdl.xml:/DATA NXdata.nxdl.xml: -DEBUG - @delay_indices - IS NOT IN SCHEMA +DEBUG - NXdata.nxdl.xml:@delay_indices - [NX_INT] +DEBUG - <> +DEBUG - documentation (NXdata.nxdl.xml:/AXISNAME_indices): DEBUG - + Each ``AXISNAME_indices`` attribute indicates the dependency + relationship of the ``AXISNAME`` field (where ``AXISNAME`` + is the name of a field that exists in this ``NXdata`` group) + with one or more dimensions of the plottable data. + + Integer array that defines the indices of the *signal* field + (that field will be a multidimensional array) + which need to be used in the *AXISNAME* field in + order to reference the corresponding axis value. + + The first index of an array is ``0`` (zero). + + Here, *AXISNAME* is to be replaced by the name of each + field described in the ``axes`` attribute. + An example with 2-D data, :math:`d(t,P)`, will illustrate:: + + data_2d:NXdata + @signal="data" + @axes=["time", "pressure"] + @time_indices=0 + @pressure_indices=1 + data: float[1000,20] + time: float[1000] + pressure: float[20] + + This attribute is to be provided in all situations. + However, if the indices attributes are missing + (such as for data files written before this specification), + file readers are encouraged to make their best efforts + to plot the data. + Thus the implementation of the + ``AXISNAME_indices`` attribute is based on the model of + "strict writer, liberal reader". + + .. note:: Attributes potentially containing multiple values + (axes and _indices) are to be written as string or integer arrays, + to avoid string parsing in reading applications. + DEBUG - ===== ATTRS (//entry/data@energy_indices) DEBUG - value: 2 DEBUG - classpath: ['NXentry', 'NXdata'] @@ -321,6 +361,47 @@ DEBUG - NXmpes.nxdl.xml:/ENTRY/data@energy_indices - [NX_CHAR] DEBUG - <> DEBUG - documentation (NXmpes.nxdl.xml:/ENTRY/data/energy_indices): DEBUG - +DEBUG - NXdata.nxdl.xml:@energy_indices - [NX_INT] +DEBUG - documentation (NXdata.nxdl.xml:/AXISNAME_indices): +DEBUG - + Each ``AXISNAME_indices`` attribute indicates the dependency + relationship of the ``AXISNAME`` field (where ``AXISNAME`` + is the name of a field that exists in this ``NXdata`` group) + with one or more dimensions of the plottable data. + + Integer array that defines the indices of the *signal* field + (that field will be a multidimensional array) + which need to be used in the *AXISNAME* field in + order to reference the corresponding axis value. + + The first index of an array is ``0`` (zero). + + Here, *AXISNAME* is to be replaced by the name of each + field described in the ``axes`` attribute. + An example with 2-D data, :math:`d(t,P)`, will illustrate:: + + data_2d:NXdata + @signal="data" + @axes=["time", "pressure"] + @time_indices=0 + @pressure_indices=1 + data: float[1000,20] + time: float[1000] + pressure: float[20] + + This attribute is to be provided in all situations. + However, if the indices attributes are missing + (such as for data files written before this specification), + file readers are encouraged to make their best efforts + to plot the data. + Thus the implementation of the + ``AXISNAME_indices`` attribute is based on the model of + "strict writer, liberal reader". + + .. note:: Attributes potentially containing multiple values + (axes and _indices) are to be written as string or integer arrays, + to avoid string parsing in reading applications. + DEBUG - ===== ATTRS (//entry/data@kx_indices) DEBUG - value: 0 DEBUG - classpath: ['NXentry', 'NXdata'] @@ -328,8 +409,48 @@ DEBUG - classes: NXmpes.nxdl.xml:/ENTRY/data NXentry.nxdl.xml:/DATA NXdata.nxdl.xml: -DEBUG - @kx_indices - IS NOT IN SCHEMA +DEBUG - NXdata.nxdl.xml:@kx_indices - [NX_INT] +DEBUG - <> +DEBUG - documentation (NXdata.nxdl.xml:/AXISNAME_indices): DEBUG - + Each ``AXISNAME_indices`` attribute indicates the dependency + relationship of the ``AXISNAME`` field (where ``AXISNAME`` + is the name of a field that exists in this ``NXdata`` group) + with one or more dimensions of the plottable data. + + Integer array that defines the indices of the *signal* field + (that field will be a multidimensional array) + which need to be used in the *AXISNAME* field in + order to reference the corresponding axis value. + + The first index of an array is ``0`` (zero). + + Here, *AXISNAME* is to be replaced by the name of each + field described in the ``axes`` attribute. + An example with 2-D data, :math:`d(t,P)`, will illustrate:: + + data_2d:NXdata + @signal="data" + @axes=["time", "pressure"] + @time_indices=0 + @pressure_indices=1 + data: float[1000,20] + time: float[1000] + pressure: float[20] + + This attribute is to be provided in all situations. + However, if the indices attributes are missing + (such as for data files written before this specification), + file readers are encouraged to make their best efforts + to plot the data. + Thus the implementation of the + ``AXISNAME_indices`` attribute is based on the model of + "strict writer, liberal reader". + + .. note:: Attributes potentially containing multiple values + (axes and _indices) are to be written as string or integer arrays, + to avoid string parsing in reading applications. + DEBUG - ===== ATTRS (//entry/data@ky_indices) DEBUG - value: 1 DEBUG - classpath: ['NXentry', 'NXdata'] @@ -337,8 +458,48 @@ DEBUG - classes: NXmpes.nxdl.xml:/ENTRY/data NXentry.nxdl.xml:/DATA NXdata.nxdl.xml: -DEBUG - @ky_indices - IS NOT IN SCHEMA +DEBUG - NXdata.nxdl.xml:@ky_indices - [NX_INT] +DEBUG - <> +DEBUG - documentation (NXdata.nxdl.xml:/AXISNAME_indices): DEBUG - + Each ``AXISNAME_indices`` attribute indicates the dependency + relationship of the ``AXISNAME`` field (where ``AXISNAME`` + is the name of a field that exists in this ``NXdata`` group) + with one or more dimensions of the plottable data. + + Integer array that defines the indices of the *signal* field + (that field will be a multidimensional array) + which need to be used in the *AXISNAME* field in + order to reference the corresponding axis value. + + The first index of an array is ``0`` (zero). + + Here, *AXISNAME* is to be replaced by the name of each + field described in the ``axes`` attribute. + An example with 2-D data, :math:`d(t,P)`, will illustrate:: + + data_2d:NXdata + @signal="data" + @axes=["time", "pressure"] + @time_indices=0 + @pressure_indices=1 + data: float[1000,20] + time: float[1000] + pressure: float[20] + + This attribute is to be provided in all situations. + However, if the indices attributes are missing + (such as for data files written before this specification), + file readers are encouraged to make their best efforts + to plot the data. + Thus the implementation of the + ``AXISNAME_indices`` attribute is based on the model of + "strict writer, liberal reader". + + .. note:: Attributes potentially containing multiple values + (axes and _indices) are to be written as string or integer arrays, + to avoid string parsing in reading applications. + DEBUG - ===== ATTRS (//entry/data@signal) DEBUG - value: data DEBUG - classpath: ['NXentry', 'NXdata']