Skip to content

Commit

Permalink
switch order of examples for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
woutdenolf committed Jul 1, 2024
1 parent 61343dd commit 939fb7e
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions base_classes/NXdata.nxdl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,28 @@

Note that `@x_indices` and `@y_indices` attributes can be omitted in this case. However it is strongly encouraged to provide them.

`2. Multi-dimensional axes`
`2. Data dimensions spanned by more than one axis`

A common case is the need to specify alternative axes for the same dimension

.. code-block::

data:NXdata
@signal = "data"
@axes = ["eta", "q"]
data: float[10,20]
@eta_indices = [0]
@tth_indices = [1]
@q_indices = [1]
eta: float[10] --> coordinates along the first dimension
tth: float[20] --> coordinates along the second dimension (alternative)
q: float[20] --> coordinates along the second dimension (default)

Note that to recognize `tth` as an axis, `@tth_indices` must be present. Readers that do
not use :ref:`AXISNAME_indices </NXdata@AXISNAME_indices-attribute>` attributes will
have no way to understand that `tth` is an axis and simple ignore it.

`3. Multi-dimensional axes`

When coordinates do not form a regular grid, multi-dimensional :ref:`AXISNAME </NXdata/AXISNAME-field>` fields
can be used. Just remember that the shape of an :ref:`AXISNAME </NXdata/AXISNAME-field>` field must be equal to the shape
Expand Down Expand Up @@ -171,7 +192,7 @@
This would be invalid since the shape `[10,20]` of `x` is not equal to the shape `[10]` of the spanned data dimensions.

Omitting indices for multi-dimensional axes can only be done by repeating the :ref:`AXISNAME </NXdata/AXISNAME-field>`
name in all positions of the :ref:`axes </NXdata@axes-attribute>` attribute which they span.
name in all positions of the :ref:`axes </NXdata@axes-attribute>` attribute which they span. For example

.. code-block::

Expand All @@ -184,8 +205,6 @@
Note that since ``NXdata`` does not describe how the data is to be plotted or even the dimensionality of the plot,
a reader would probably treat this particular example as a 1D signal and plot it as such.

`3. Dimensions spanned by more than one axis`

In the case of multi-dimensional axes, single-dimensional axes are often introduced as default axes
to support readers that does not use the :ref:`AXISNAME_indices </NXdata@AXISNAME_indices-attribute>` attributes
or cannot handle multi-dimensional axes.
Expand All @@ -212,25 +231,6 @@

Technically `@x_set_indices` and `@y_set_indices` can be omitted. However it is strongly encouraged to provide them.

Another common case is the need to specify alternative axes for the same dimension

.. code-block::

data:NXdata
@signal = "data"
@axes = ["eta", "q"]
data: float[10,20]
@eta_indices = [0]
@tth_indices = [1]
@q_indices = [1]
eta: float[10] --> coordinates along the first dimension
tth: float[20] --> coordinates along the second dimension (alternative)
q: float[20] --> coordinates along the second dimension (default)

Note that to recognize `tth` as an axis, `@tth_indices` must be present. Readers that do
not use :ref:`AXISNAME_indices </NXdata@AXISNAME_indices-attribute>` attributes will
have no way to understand that `tth` is an axis and simple ignore it.

`4. Axes without defaults`

Expanding on the 2D scatter example, a stack of 2D scatter data where the stack dimension
Expand Down

0 comments on commit 939fb7e

Please sign in to comment.