Skip to content

Commit

Permalink
Clarify rank and units issues for NXmx and NXtransformations
Browse files Browse the repository at this point in the history
For Nxmx, clarify the possibility of 2- or 3-dimensional images by
adding a dataRank variable.

For NXtransformations, as suggested by Andreas Foerster clarify the
handling of units for different transformation types.
  • Loading branch information
yayahjb committed Jan 23, 2017
1 parent 85a6952 commit 7bcfb8a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 27 deletions.
Binary file added .DS_Store
Binary file not shown.
38 changes: 24 additions & 14 deletions applications/NXmx.nxdl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
two-dimensional images. Some will produce three-dimensional
images, using one of the indices to select a detector element.
</doc>
<symbol name="dataRank">
<doc>rank of the ``data`` field</doc>
</symbol>
<symbol name="np">
<doc>number of scan points</doc>
</symbol>
Expand Down Expand Up @@ -91,10 +94,10 @@
in the field group_index, and the level in the hierarchy
given in the group_parent field. For example if an x-ray
detector, DET, consists of four elements in a rectangular array::
DTL DTR
DLL DLR
DTL DTR
DLL DLR
We could have::

group_names: ["DET", "DTL", "DTR", "DLL", "DLR"]
Expand Down Expand Up @@ -138,7 +141,7 @@
</group>
<group type="NXdetector">
<doc>
Normally the detector group will usually have the name detector
Normally the detector group will have the name ``detector``.
However, in the case of multiple detector elements, each element
needs a uniquely named NXdetector group.
</doc>
Expand All @@ -161,13 +164,16 @@

<field name="data" type="NX_NUMBER">
<doc>
This is the example for a dimension-2 detector. For a
a dimension-3 detector, a rank-4 data field is needed.
For a dimension-2 detector, the rank of the data array will be 3.
For a dimension-3 detector, the rank of the data array will be 4.
This allows for the introduction of the frame number as the
first index.
</doc>
<dimensions rank="3">
<dimensions rank="dataRank">
<dim index="1" value="np" />
<dim index="2" value="i" />
<dim index="3" value="j" />
<dim index="4" value="k" minOccurs="0"/>
</dimensions>
</field>

Expand Down Expand Up @@ -326,9 +332,10 @@

<field name="angular_calibration" type="NX_FLOAT" minOccurs="0">
<doc>Angular calibration data.</doc>
<dimensions rank="2">
<dimensions rank="dataRank">
<dim index="1" value="i" />
<dim index="2" value="j" />
<dim index="3" value="k" minOccurs="0"/>
</dimensions>
</field>

Expand All @@ -341,17 +348,19 @@

<field name="flatfield" type="NX_FLOAT" minOccurs="0">
<doc>Flat field correction data.</doc>
<dimensions rank="2">
<dimensions rank="dataRank">
<dim index="1" value="i" />
<dim index="2" value="j" />
<dim index="3" value="k" minOccurs="0"/>
</dimensions>
</field>

<field name="flatfield_error" type="NX_FLOAT" minOccurs="0">
<doc>Errors of the flat field correction data.</doc>
<dimensions rank="2">
<dimensions rank="dataRank">
<dim index="1" value="i" />
<dim index="2" value="j" />
<dim index="3" value="k" minOccurs="0"/>
</dimensions>
</field>

Expand Down Expand Up @@ -396,9 +405,10 @@
If the full bit depths is not required, providing a
mask with fewer bits is permissible.
</doc>
<dimensions rank="2">
<dimensions rank="dataRank">
<dim index="1" value="i" />
<dim index="2" value="j" />
<dim index="3" value="k" minOccurs="0"/>
</dimensions>
</field>

Expand Down Expand Up @@ -551,10 +561,10 @@

<field name="incident_beam_size" type="NX_FLOAT" units="NX_LENGTH" minOccurs="0">
<doc>
Two-dimensional array of FWHM (if Gaussian or Airy function) or
Two-element array of FWHM (if Gaussian or Airy function) or
diameters (if top hat) of beam in the order x, y
</doc>
<dimensions rank="1" />
<dimensions rank="1" value="2" />
</field>

<field name="profile" type="NX_CHAR" minOccurs="0">
Expand Down
37 changes: 24 additions & 13 deletions base_classes/NXtransformations.nxdl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@
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.
-->
<!--
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 @@ -49,7 +50,10 @@
There will be one or more transformations (axes) defined by one or more fields
for each transformation. The all-caps name AXISNAME designates the
particular axis generating a transformation (e.g. a rotation axis or a translation
axis or a general axis).
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
``general``.

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 @@ -93,7 +97,7 @@
This entire explanation is not clear.
-->

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

Expand All @@ -116,19 +120,26 @@
<item value="general" />
</enumeration>
</attribute>
<attribute name="vector" type="NX_NUMBER">
<attribute name="vector" units="NX_DIMENSIONLESS" type="NX_NUMBER">
<doc>
Three values that define the axis for this transformation
Three values that define the axis for this transformation.
The axis should be normalized to unit length, making it
dimensionless. For ``rotation`` axes, the direction should be
chosen for a right-handed rotation with increasing angle.
For ``translation`` axes the direction should be chosen for
increasing displacement.
</doc>
<dimensions rank="1" value="3" />
</attribute>
<attribute name="offset" type="NX_NUMBER">
<doc>
A fixed offset applied before the transformation (three vector components).
</doc>
<dimensions rank="1" value="3" />
</attribute>
<attribute name="offset_units" type="NX_CHAR">
<doc>
Units of the offset.
Units of the offset. Values should be consistent with NX_LENGTH.
</doc>
</attribute>
<attribute name="depends_on" type="NX_CHAR">
Expand All @@ -138,7 +149,7 @@
</doc>
</attribute>
</field>
<field name="AXISNAME_end" nameType="any" type="NX_NUMBER" minOccurs="0">
<field name="AXISNAME_end" units="AXISUNITS" 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 @@ -147,7 +158,7 @@
at the corresponding positions given in the AXISNAME field.
</doc>
</field>
<field name="AXISNAME_range" nameType="any" type="NX_NUMBER" minOccurs="0">
<field name="AXISNAME_range" units="AXISUNITS" 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 @@ -156,7 +167,7 @@
in the field AXISNAME_end and the field AXISNAME.
</doc>
</field>
<field name="AXISNAME_average_range" nameType="any" type="NX_NUMBER" minOccurs="0">
<field name="AXISNAME_average_range" units="AXISUNITS" nameType="any" type="NX_NUMBER" minOccurs="0">
<doc>
AXISNAME_average_range is a placeholder for a name constructed from the actual
name of an axis to which ``_average_range`` has been appended.
Expand Down

0 comments on commit 7bcfb8a

Please sign in to comment.