Skip to content
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

fixes #545 - units type AXISUNITS #549

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
26 changes: 11 additions & 15 deletions base_classes/NXtransformations.nxdl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd"
>
<!--
nxdl.xsd rules do not allow us to show this as a variable name
- we'll use AXISNAME in ALL CAPS for consistency with the
use in NXDATA. We'll use ``AXISUNITS`` for the units appropriate
to the type of axis.
-->

<doc>
Collection of axis-based translations and rotations to describe a geometry.
Expand All @@ -51,12 +45,14 @@
needed to describe the position and orientation of any movable or fixed device.

There will be one or more transformations (axes) defined by one or more fields
for each transformation. The all-caps name ``AXISNAME`` designates the
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AXISNAME should not be changed here

for each transformation. The units type ``NX_TRANSFORMATION`` designates the
particular axis generating a transformation (e.g. a rotation axis or a translation
axis or a general axis). The all-caps name ``AXISUNITS`` designates the
units appropriate to the transformation_type value, i.e. ``NX_LENGTH`` for
``translation``, ``NX_ANGLE`` for ``rotation``, and ``NX_UNITLESS`` for
axes for which no transformation type is specified.
axis or a general axis). ``NX_TRANSFORMATION`` designates the
units will be appropriate to the ``transformation_type`` attribute:

* ``NX_LENGTH`` for ``translation``
* ``NX_ANGLE`` for ``rotation``
* ``NX_UNITLESS`` for axes for which no transformation type is specified

This class will usually contain all axes of a sample stage or goniometer or
a detector. The NeXus default McSTAS coordinate frame is assumed, but additional
Expand Down Expand Up @@ -101,7 +97,7 @@
This entire explanation is not clear.
-->

<field name="AXISNAME" nameType="any" units="AXISUNITS" type="NX_NUMBER" maxOccurs="unbounded">
<field name="AXISNAME" nameType="any" units="NX_TRANSFORMATION" type="NX_NUMBER" maxOccurs="unbounded">
<doc>
Units need to be appropriate for translation or rotation

Expand Down Expand Up @@ -159,7 +155,7 @@
</doc>
</attribute>
</field>
<field name="AXISNAME_end" units="AXISUNITS" nameType="any" type="NX_NUMBER" minOccurs="0">
<field name="AXISNAME_end" units="NX_TRANSFORMATION" nameType="any" type="NX_NUMBER" minOccurs="0">
<doc>
``AXISNAME_end`` is a placeholder for a name constructed from the actual
name of an axis to which ``_end`` has been appended.
Expand All @@ -169,7 +165,7 @@
</doc>
</field>
<!-- as per NIAC discussion, 13 Oct 2016, we have removed AXISNAME_range as duplicative.
<field name="AXISNAME_range" units="AXISUNITS" nameType="any" type="NX_NUMBER" minOccurs="0">
<field name="AXISNAME_range" units="NX_TRANSFORMATION" nameType="any" type="NX_NUMBER" minOccurs="0">
<doc>
AXISNAME_range is a placeholder for a name constructed from the actual
name of an axis to which ``_range`` has been appended.
Expand All @@ -179,7 +175,7 @@
</doc>
</field>
-->
<field name="AXISNAME_increment_set" units="AXISUNITS" nameType="any" type="NX_NUMBER" minOccurs="0">
<field name="AXISNAME_increment_set" units="NX_TRANSFORMATION" nameType="any" type="NX_NUMBER" minOccurs="0">
<doc>
``AXISNAME_increment_set`` is a placeholder for a name constructed from the actual
name of an axis to which ``_increment_set`` has been appended.
Expand Down
23 changes: 21 additions & 2 deletions nxdlTypes.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,27 @@
<xs:enumeration value="NX_TEMPERATURE"><xs:annotation><xs:documentation>example: K</xs:documentation></xs:annotation></xs:enumeration>
<xs:enumeration value="NX_TIME"><xs:annotation><xs:documentation>example: s</xs:documentation></xs:annotation></xs:enumeration>
<xs:enumeration value="NX_TIME_OF_FLIGHT"><xs:annotation><xs:documentation>(alias to NX_TIME) example: s</xs:documentation></xs:annotation></xs:enumeration>
<xs:enumeration value="NX_VOLTAGE"><xs:annotation><xs:documentation>example: V</xs:documentation></xs:annotation></xs:enumeration>
<xs:enumeration value="NX_VOLUME"><xs:annotation><xs:documentation>example: m3</xs:documentation></xs:annotation></xs:enumeration>
<xs:enumeration value="NX_VOLTAGE"><xs:annotation><xs:documentation>example: V</xs:documentation></xs:annotation></xs:enumeration>
<xs:enumeration value="NX_TRANSFORMATION">
<xs:annotation>
<xs:documentation>
could be any of these: ``NX_LENGTH``, ``NX_ANGLE``, or ``NX_UNITLESS``

There will be one or more transformations defined by one or more fields
for each transformation. The units type ``NX_TRANSFORMATION`` designates the
particular axis generating a transformation (e.g. a rotation axis or a translation
axis or a general axis). ``NX_TRANSFORMATION`` designates the
units will be appropriate to the type of transformation,
indicated in the :ref:`NXtransformations` base class
by the ``transformation_type`` value:

* ``NX_LENGTH`` for ``translation``
* ``NX_ANGLE`` for ``rotation``
* ``NX_UNITLESS`` for axes for which no transformation type is specified.
</xs:documentation>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This definition should be applied as a union, similar to NX_NUMBER

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BUT, the anyUnitsAttr is defined as <xs:restriction base="xs:string"> with <xs:enumeration value=.... These enumerations have no capability of <xs:union content. The refactor of anyUnitsAttr from xs:restriction to <xs:union could have other consequences.

That, in itself using only the existing schema, is worth exploring in its own branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That branch is off this PR, not master

</xs:annotation>
</xs:enumeration>
<xs:enumeration value="NX_VOLUME"><xs:annotation><xs:documentation>example: m3</xs:documentation></xs:annotation></xs:enumeration>
<xs:enumeration value="NX_UNITLESS"><xs:annotation><xs:documentation>for fields that don't have a unit (e.g. hkl) so that they don't inherit the wrong units (NOTE: not the same as NX_DIMENSIONLESS)</xs:documentation></xs:annotation></xs:enumeration>
<xs:enumeration value="NX_WAVELENGTH"><xs:annotation><xs:documentation>example: angstrom</xs:documentation></xs:annotation></xs:enumeration>
<xs:enumeration value="NX_WAVENUMBER"><xs:annotation><xs:documentation>units for Q, example: angstrom-1 or nm-1</xs:documentation></xs:annotation></xs:enumeration>
Expand Down