Skip to content

Commit

Permalink
Fix uppercase attribute namefit
Browse files Browse the repository at this point in the history
  • Loading branch information
domna committed Feb 8, 2024
1 parent 42904b9 commit cac78c6
Show file tree
Hide file tree
Showing 2 changed files with 164 additions and 9 deletions.
6 changes: 0 additions & 6 deletions pynxtools/nexus/nxdl_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
167 changes: 164 additions & 3 deletions tests/data/dataconverter/readers/mpes/Ref_nexus_mpes.log
Original file line number Diff line number Diff line change
Expand Up @@ -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 - <<OPTIONAL>>
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']
Expand All @@ -321,24 +361,145 @@ DEBUG - NXmpes.nxdl.xml:/ENTRY/data@energy_indices - [NX_CHAR]
DEBUG - <<RECOMMENDED>>
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']
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 - <<OPTIONAL>>
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']
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 - <<OPTIONAL>>
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']
Expand Down

0 comments on commit cac78c6

Please sign in to comment.