-
Notifications
You must be signed in to change notification settings - Fork 68
Fairmat 2024: use NXcoordinate_system together with NXtransformations #1415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lukaspie
merged 39 commits into
nexusformat:main
from
FAIRmat-NFDI:fairmat-2024-nxtransformations
May 9, 2025
Merged
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 1427694
change @depends_on docstring in NXtransformations
lukaspie b1c770e
clarify docstring in NXtransformations depends_on attribute
lukaspie 03c0ece
regenerate nxdl files
lukaspie dceceed
ci/cd fix
lukaspie fe3910c
revert unintentional changes from cherry-pick
lukaspie f2dbbe9
remove unmerged docs update in NXtransformations
lukaspie e95cd7c
bring in NXcoordinate_system
lukaspie e7a818a
add NXcoordinate_system_set
lukaspie a758081
remove NXcoordinate_system_set from contributed
lukaspie 32a339c
separate rotation conventions and predefined coordinate systems
lukaspie f047610
port docs of NXcoordinate_system_set to NXcoordinate_system
lukaspie ed27280
clean up docs in NXrotation_conventions
lukaspie dbce912
rebase contributed
lukaspie 0d1d663
remove duplicated definition
lukaspie 5b58510
fix issues with links in nxdl files
lukaspie 6531735
remove specified coordinate systems for EM/APM
lukaspie 406caf3
typo fix
lukaspie ec69344
remove NXcoordinate_system/alias
lukaspie b40467d
use consistent underscores
lukaspie 9fe9d16
Merge remote-tracking branch 'upstream/main' into fairmat-2024-nxtran…
lukaspie 4465edf
use hyperreferences in NXrotation_conventions
lukaspie e58aca4
remove undefined as option from NXrotation_conventions
lukaspie 4c7d3a8
Apply suggestions from code review
lukaspie b3333b2
use more precise language for coordinate system docs
lukaspie f07acee
add hyperreference
lukaspie e1c3a61
Merge remote-tracking branch 'upstream/main' into fairmat-2024-nxtran…
lukaspie 3e8ab32
remove NXrotation_conventions for now
lukaspie 83e7b0c
remove handedness
lukaspie 58f6197
add explicit between CS and transformations
lukaspie ee872b5
connect transformations and coordinate systems
lukaspie 65bb31d
ensure rotation handedness is right handed in a given CS
lukaspie 08ac13d
add fallback mechanism for depends_on
lukaspie dbefd09
clean up language arounds depends_on
lukaspie f028a83
Apply suggestions from code review
lukaspie 34ff2cb
rename to Euclidean space
lukaspie 9c8a31f
Apply suggestions from code review
lukaspie cb286dc
add clarifications as review suggested
lukaspie 29e6c50
Update base_classes/NXcoordinate_system.nxdl.xml
lukaspie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
| # | ||
| # 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 | ||
|
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 <https://mailman2.mcstas.org/pipermail/mcstas-users/2021q2/001431.html>`_ | ||
| 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 | ||
|
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 | ||
|
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 | ||
|
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 | ||
|
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 | ||
|
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 | ||
|
lukaspie marked this conversation as resolved.
Outdated
|
||
| have branch-specific coordinate system conventions which are | ||
|
PeterC-DLS marked this conversation as resolved.
Outdated
|
||
| especially useful for deep classes where multiple scientific | ||
|
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 | ||
|
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 | ||
|
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 | ||
|
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. | ||
|
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. | ||
|
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"> | ||
|
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> | ||
|
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"/> | ||
|
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. | ||
|
PeterC-DLS marked this conversation as resolved.
Outdated
|
||
| This axis is frequently referred to as the x-axis in real space and | ||
|
PeterC-DLS marked this conversation as resolved.
Outdated
|
||
| the i-axis in reciprocal space. | ||
| </doc> | ||
| <dimensions rank="1"> | ||
| <dim index="1" value="3"/> | ||
|
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> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 <https://www.doi.org/10.1088/0965-0393/23/8/083501>`_. | ||
| </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"/> | ||
|
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. | ||
|
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. | ||
|
lukaspie marked this conversation as resolved.
Outdated
|
||
| </doc> | ||
| <enumeration> | ||
| <item value="undefined"/> | ||
|
lukaspie marked this conversation as resolved.
Outdated
|
||
| <item value="p_plus_one"/> | ||
| <item value="p_minus_one"/> | ||
| </enumeration> | ||
| </field> | ||
| </definition> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.