Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a44e789
Updates NXtransformations docs (#114)
domna Jan 9, 2024
1427694
change @depends_on docstring in NXtransformations
lukaspie Jan 9, 2024
b1c770e
clarify docstring in NXtransformations depends_on attribute
lukaspie Jan 12, 2024
03c0ece
regenerate nxdl files
lukaspie Jul 3, 2024
dceceed
ci/cd fix
lukaspie Jul 3, 2024
fe3910c
revert unintentional changes from cherry-pick
lukaspie Sep 16, 2024
f2dbbe9
remove unmerged docs update in NXtransformations
lukaspie Sep 23, 2024
e95cd7c
bring in NXcoordinate_system
lukaspie Sep 29, 2024
e7a818a
add NXcoordinate_system_set
lukaspie Sep 30, 2024
a758081
remove NXcoordinate_system_set from contributed
lukaspie Oct 17, 2024
32a339c
separate rotation conventions and predefined coordinate systems
lukaspie Jan 16, 2025
f047610
port docs of NXcoordinate_system_set to NXcoordinate_system
lukaspie Jan 16, 2025
ed27280
clean up docs in NXrotation_conventions
lukaspie Jan 16, 2025
dbce912
rebase contributed
lukaspie Jan 16, 2025
0d1d663
remove duplicated definition
lukaspie Jan 16, 2025
5b58510
fix issues with links in nxdl files
lukaspie Jan 16, 2025
6531735
remove specified coordinate systems for EM/APM
lukaspie Jan 16, 2025
406caf3
typo fix
lukaspie Feb 13, 2025
ec69344
remove NXcoordinate_system/alias
lukaspie Feb 13, 2025
b40467d
use consistent underscores
lukaspie Feb 13, 2025
9fe9d16
Merge remote-tracking branch 'upstream/main' into fairmat-2024-nxtran…
lukaspie Feb 13, 2025
4465edf
use hyperreferences in NXrotation_conventions
lukaspie Feb 14, 2025
e58aca4
remove undefined as option from NXrotation_conventions
lukaspie Feb 14, 2025
4c7d3a8
Apply suggestions from code review
lukaspie Feb 14, 2025
b3333b2
use more precise language for coordinate system docs
lukaspie Feb 14, 2025
f07acee
add hyperreference
lukaspie Feb 14, 2025
e1c3a61
Merge remote-tracking branch 'upstream/main' into fairmat-2024-nxtran…
lukaspie Mar 4, 2025
3e8ab32
remove NXrotation_conventions for now
lukaspie Apr 14, 2025
83e7b0c
remove handedness
lukaspie Apr 14, 2025
58f6197
add explicit between CS and transformations
lukaspie Apr 14, 2025
ee872b5
connect transformations and coordinate systems
lukaspie Apr 14, 2025
65bb31d
ensure rotation handedness is right handed in a given CS
lukaspie Apr 14, 2025
08ac13d
add fallback mechanism for depends_on
lukaspie Apr 15, 2025
dbefd09
clean up language arounds depends_on
lukaspie Apr 15, 2025
f028a83
Apply suggestions from code review
lukaspie May 5, 2025
34ff2cb
rename to Euclidean space
lukaspie May 5, 2025
9c8a31f
Apply suggestions from code review
lukaspie May 6, 2025
cb286dc
add clarifications as review suggested
lukaspie May 6, 2025
29e6c50
Update base_classes/NXcoordinate_system.nxdl.xml
lukaspie May 9, 2025
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
212 changes: 212 additions & 0 deletions base_classes/NXcoordinate_system.nxdl.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl"?>
<!--
# NeXus - Neutron and X-ray Common Data Format
#
# Copyright (C) 2014-2024 NeXus International Advisory Committee (NIAC)
Comment thread
lukaspie marked this conversation as resolved.
Outdated
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# For further information, see http://www.nexusformat.org
-->
<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" category="base" type="group" name="NXcoordinate_system" extends="NXobject" xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd">
<doc>
Base class to detail a coordinate system (CS).

Whenever possible, all instances of :ref:`NXcoordinate_system`
should be used at the top-level (i.e, directly below ``NXentry``)
within an application definition or within a NeXus file.

How many nodes of type :ref:`NXcoordinate_system` should be used in
Comment thread
lukaspie marked this conversation as resolved.
Outdated
an application definition?

* 0; if there is no instance of `NXcoordinate_system`` across
the application definition, the default NeXus
`McStas &lt;https://mailman2.mcstas.org/pipermail/mcstas-users/2021q2/001431.html&gt;`_
coordinate system is assumed.

McStas is used if no instance of NXcoordinate_system is specified.
However, for the sake of clarity, even in this case it is better
to be explicit like for every other coordinate system definition
Comment thread
lukaspie marked this conversation as resolved.
Outdated
to support users with interpreting the content and logic behind
every instance of the tree.

* 1; if only one :ref:`NXcoordinate_system` is defined, it should be
placed as high up in the node hierarchy (ideally right below an
Comment thread
lukaspie marked this conversation as resolved.
Outdated
instance of NXentry) of the application definition tree as possible.
This coordinate system shall be named such that it is clear how this
coordinate system is typically referred to in a community. For the
NeXus McStas coordinate system, it is advised to call it ``mcstas``
for the sake of improved clarity.

If this is the case, it is assumed that this ``NXcoordinate_system``
overwrites the NeXus default McStas coordinate system, i.e. users
can thereby conveniently and explicitly specify the speicific
Comment thread
lukaspie marked this conversation as resolved.
Outdated
coordinate system that they wish to use.

This case has the advantage that it is explicit and faces no
Comment thread
lukaspie marked this conversation as resolved.
Outdated
ambiguities. However, in reality typically multiple coordinate
systems have to be mastered especially for complex multi-signal
modality experiments.

* 2 and more; as soon as more than one :ref:`NXcoordinate_system`
is specified somewhere in the tree, different interpretations are
possible as to which of these coordinate system sets and instances
Comment thread
lukaspie marked this conversation as resolved.
Outdated
apply or take preference.
While these ambiguities should be avoided at all costs, the
opportunity for multiple sets and their instances enables to
Comment thread
lukaspie marked this conversation as resolved.
Outdated
have branch-specific coordinate system conventions which are
Comment thread
PeterC-DLS marked this conversation as resolved.
Outdated
especially useful for deep classes where multiple scientific
Comment thread
lukaspie marked this conversation as resolved.
Outdated
methods are combined or cases where having a definition of global
translation and conversion tables how to convert between
Comment thread
lukaspie marked this conversation as resolved.
Outdated
representations in different coordinate systems is not desired
or available for now.

If this case is realized, the best practice is that in every
case where a coordinate system should be referred to the respective
class has a ``depends_on`` field, which resolves the possible
Comment thread
lukaspie marked this conversation as resolved.
Outdated
ambiguities which specific coordinate systems is referred to.

In the case of two or more instances of ``NXcoordinate_system`` it
is advised to specify the relationship between the two coordinate
systems by using the :ref:`NXtransformations` group within
``NXcoordinate_system``.

In any case, users are encouraged to write explicit and clean
``depends_on`` fields in all groups that encode information for which
the interpretation of coordinate systems is relevant. If these
Comment thread
lukaspie marked this conversation as resolved.
Outdated
``depends_on`` hints are not provided, it is automatically assumed
that all branches (to arbitrary depth) use either the only
``NXcoordinate_system`` instance in the tree or the application
definition is considered underconstrained. In the latter case, which
should be avoided at all costs, McStas is assumed again.
Comment thread
lukaspie marked this conversation as resolved.
Outdated
</doc>
<field name="origin" type="NX_CHAR">
<doc>
Human-readable field telling where the origin of this CS is.
Comment thread
lukaspie marked this conversation as resolved.
Outdated
Exemplar values could be *left corner of the lab bench*, *door handle*
*pinhole through which the electron beam exists the pole piece*.
*barycenter of the triangle*, *center of mass of the stone*.
</doc>
</field>
<field name="alias" type="NX_CHAR">
Comment thread
lukaspie marked this conversation as resolved.
Outdated
<doc>
An alternative name given to this coordinate system.
</doc>
</field>
<field name="type" type="NX_CHAR">
<doc>
Coordinate system type.
</doc>
<enumeration>
Comment thread
PeterC-DLS marked this conversation as resolved.
Outdated
<item value="undefined"/>
<item value="cartesian"/>
</enumeration>
</field>
<field name="handedness" type="NX_CHAR">
<doc>
Handedness of the coordinate system if it is a Cartesian.
</doc>
<enumeration>
<item value="not applicable"/>
Comment thread
lukaspie marked this conversation as resolved.
Outdated
<item value="right_handed"/>
<item value="left_handed"/>
</enumeration>
</field>
<field name="x_alias" type="NX_CHAR">
<doc>
Opportunity to define an alias for the name of the x-axis.
</doc>
</field>
<field name="x_direction" type="NX_CHAR">
<doc>
Human-readable field telling in which direction the x-axis points if that
instance of :ref:`NXcoordinate_system` has no reference to any parent and as such
is the mighty world reference frame.

Exemplar values could be direction of gravity.
</doc>
</field>
<field name="x" type="NX_NUMBER" units="NX_LENGTH">
<doc>
Basis unit vector along the first axis which spans the coordinate system.
Comment thread
PeterC-DLS marked this conversation as resolved.
Outdated
This axis is frequently referred to as the x-axis in real space and
Comment thread
PeterC-DLS marked this conversation as resolved.
Outdated
the i-axis in reciprocal space.
</doc>
<dimensions rank="1">
<dim index="1" value="3"/>
Comment thread
PeterC-DLS marked this conversation as resolved.
</dimensions>
</field>
<field name="y_alias" type="NX_CHAR">
<doc>
Opportunity to define an alias for the name of the y-axis.
</doc>
</field>
<field name="y_direction" type="NX_CHAR">
<doc>
Human-readable field telling in which direction the y-axis points if that
instance of :ref:`NXcoordinate_system` has no reference to any parent and as such
is the mighty world reference frame.

See docstring of ``x_direction`` for further details.
</doc>
</field>
<field name="y" type="NX_NUMBER" units="NX_LENGTH">
<doc>
Basis unit vector along the second axis which spans the coordinate system.
This axis is frequently referred to as the y-axis in real space and
the j-axis in reciprocal space.
</doc>
<dimensions rank="1">
<dim index="1" value="3"/>
</dimensions>
</field>
<field name="z_alias" type="NX_CHAR">
<doc>
Opportunity to define an alias for the name of the z-axis.
</doc>
</field>
<field name="z_direction" type="NX_CHAR">
<doc>
Human-readable field telling in which direction the z-axis points if that
instance of :ref:`NXcoordinate_system` has no reference to any parent and as such
is the mighty world reference frame.

See docstring of x_alias for further details.
</doc>
</field>
<field name="z" type="NX_NUMBER" units="NX_LENGTH">
<doc>
Basis unit vector along the third axis which spans the coordinate system.
This axis is frequently referred to as the z-axis in real space and
the k-axis in reciprocal space.
</doc>
<dimensions rank="1">
<dim index="1" value="3"/>
</dimensions>
</field>
<field name="depends_on" type="NX_CHAR">
<doc>
This specifies the relation to another coordinate system by pointing to the last
transformation in the transformation chain in the NXtransformations group.
</doc>
</field>
<group type="NXtransformations">
<doc>
Collection of axis-based translations and rotations to describe this coordinate system
with respect to another coordinate system.
</doc>
</group>
</definition>
116 changes: 116 additions & 0 deletions base_classes/NXrotation_conventions.nxdl.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl"?>
<!--
# NeXus - Neutron and X-ray Common Data Format
#
# Copyright (C) 2014-2024 NeXus International Advisory Committee (NIAC)
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# For further information, see http://www.nexusformat.org
-->
<!--
express conventions explicitly and understandable
use depends_on field - not attribute - to point to conventions used-->
<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" category="base" type="group" name="NXrotation_conventions" extends="NXobject" xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd">
<doc>
Base class to hold different rotation and angle conventions.

This base class should be used at the top-level (i.e, directly below
``NXentry``) within an application definition to enable the usage of
consistent conventions within one NeXus entry.

The definitions of these conventions follows those given in
Rowenhorst et al 2015 Modelling Simul. Mater. Sci. Eng. 23 083501,
`DOI: 10.1088/0965-0393/23/8/083501 &lt;https://www.doi.org/10.1088/0965-0393/23/8/083501&gt;`_.
</doc>
<field name="rotation_handedness" type="NX_CHAR">
<doc>
Convention how a positive rotation angle is defined when viewing
from the end of the rotation unit vector towards its origin,
i.e. in accordance with convention 2 of
DOI: 10.1088/0965-0393/23/8/083501.
Counter_clockwise is equivalent to a right-handed choice.
Clockwise is equivalent to a left-handed choice.
</doc>
<enumeration>
<item value="undefined"/>
<item value="counter_clockwise"/>
<item value="clockwise"/>
</enumeration>
</field>
<field name="rotation_convention" type="NX_CHAR">
<doc>
How are rotations interpreted into an orientation
according to convention 3 of
DOI: 10.1088/0965-0393/23/8/083501.
</doc>
<enumeration>
<item value="undefined"/>
Comment thread
lukaspie marked this conversation as resolved.
Outdated
<item value="passive"/>
<item value="active"/>
</enumeration>
</field>
<field name="euler_angle_convention" type="NX_CHAR">
<doc>
How are Euler angles interpreted given that
there are several choices (e.g. zxz, xyz)
according to convention 4 of DOI: 10.1088/0965-0393/23/8/083501.
Comment thread
lukaspie marked this conversation as resolved.
Outdated

The most frequently used convention is zxz, which is based on the
work of H.-J. Bunge, but other conventions are possible. If any
option other than "undefined" is, proper Euler angles are
distinguished from (improper) Tait-Bryan angles.
</doc>
<enumeration>
<item value="undefined"/>
<item value="zxz"/>
<item value="xyx"/>
<item value="yzy"/>
<item value="zyz"/>
<item value="xzx"/>
<item value="yxy"/>
<item value="xyz"/>
<item value="yzx"/>
<item value="zxy"/>
<item value="xzy"/>
<item value="zyx"/>
<item value="yxz"/>
</enumeration>
</field>
<field name="axis_angle_convention" type="NX_CHAR">
<doc>
To which angular range is the rotation angle argument of an
axis-angle pair parameterization constrained according to
convention 5 of DOI: 10.1088/0965-0393/23/8/083501.
</doc>
<enumeration>
<item value="undefined"/>
<item value="rotation_angle_on_interval_zero_to_pi"/>
</enumeration>
</field>
<field name="sign_convention" type="NX_CHAR">
<doc>
Which sign convention is followed when converting orientations
between different parameterizations/representations according
to convention 6 of DOI: 10.1088/0965-0393/23/8/083501.
Comment thread
lukaspie marked this conversation as resolved.
Outdated
</doc>
<enumeration>
<item value="undefined"/>
Comment thread
lukaspie marked this conversation as resolved.
Outdated
<item value="p_plus_one"/>
<item value="p_minus_one"/>
</enumeration>
</field>
</definition>
9 changes: 5 additions & 4 deletions base_classes/NXtransformations.nxdl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,9 @@
</attribute>
<attribute name="depends_on" type="NX_CHAR">
<doc>
Points to the path to a field defining the axis on which this
depends or the string ".".
Points to the path of a field defining the axis on which this instance of
NXtransformations depends or the string ".". It can also point to an instance of
Comment thread
lukaspie marked this conversation as resolved.
``NX_coordinate_system`` if this transformation depends on it.
</doc>
</attribute>
<attribute name="equipment_component" type="NX_CHAR">
Expand Down Expand Up @@ -202,7 +203,7 @@
the corresponding axis moves during the exposure of a frame. Ideally, the
value of this field added to each value of ``AXISNAME`` would agree with the
corresponding values of ``AXISNAME_end``, but there is a possibility of significant
differences. Use of ``AXISNAME_end`` is recommended.
differences. Use of ``AXISNAME_end`` is recommended.
</doc>
</field>
<attribute name="default">
Expand All @@ -218,4 +219,4 @@
for a summary of the discussion.
</doc>
</attribute>
</definition>
</definition>