Skip to content

Commit

Permalink
Use FIELDNAME_scaling_factor and FIELDNAME_offset
Browse files Browse the repository at this point in the history
This resolves ambiguity if there is more than one signal

For NXmx specify data_scaling_factor and data_offset since the field data is named in the NXdata group
  • Loading branch information
phyy-nx committed Jan 18, 2024
1 parent 6c4b856 commit 6ff76d6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
16 changes: 8 additions & 8 deletions applications/NXmx.nxdl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@
</dimensions>
</field>

<field name="scaling_factor" type="NX_FLOAT" optional="true">
<field name="data_scaling_factor" type="NX_FLOAT" optional="true">
<doc>
An optional scaling factor to apply to the values in data.

The elements in data are often stored as integers for efficiency reasons and need
further correction, generating floats. The two fields scaling_factor and offset
allow linear corrections using the following convention:
further correction, generating floats. The two fields data_scaling_factor and
data_offset allow linear corrections using the following convention:

.. code-block::

Expand All @@ -160,21 +160,21 @@
Use these fields to specify gain and/or pedestal constants that need to be applied
to the data to correct it to physical values. For example, if the detector gain
is 10 counts per photon and a constant background of 400 needs to be subtracted
off the pixels, specify scaling_factor as 0.1 and offset as -400 to specifiy the
required conversion from raw counts to pedestal-corrected photons. It is implied
processing software will apply these corrections on-the-fly during processing.
off the pixels, specify data_scaling_factor as 0.1 and data_offset as -400 to
specifiy the required conversion from raw counts to pedestal-corrected photons. It
is implied processing software will apply these corrections on-the-fly during processing.

The rank of these fields should either be a single value for the full dataset, a
single per-pixel array applied to every image (rank (i, j) or (i, j, k)),
a per-image correction specified with an array whose slowest rank is nP (rank
(np, 1), (np, i, j) or (np, i, j, k)).
</doc>
</field>
<field name="offset" type="NX_FLOAT" optional="true">
<field name="data_offset" type="NX_FLOAT" optional="true">
<doc>
An optional offset to apply to the values in data.

See :ref:`scaling_factor &lt;/NXmx/ENTRY/DATA/scaling_factor-field&gt;` for more information.
See :ref:`data_scaling_factor &lt;/NXmx/ENTRY/DATA/data_scaling_factor-field&gt;` for more information.
</doc>
</field>

Expand Down
28 changes: 21 additions & 7 deletions base_classes/NXdata.nxdl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -398,13 +398,13 @@
</field>

<!-- Data vs. plot coordinates -->
<field name="scaling_factor" type="NX_FLOAT">
<field name="FIELDNAME_scaling_factor" type="NX_FLOAT">
<doc>
An optional scaling factor to apply to the values in data.
An optional scaling factor to apply to the values in FIELDNAME (usually the signal).

The elements in data are often stored as integers for efficiency reasons and need
further correction, generating floats. The two fields scaling_factor and offset
allow linear corrections using the following convention:
further correction, generating floats. The two fields FIELDNAME_scaling_factor and
FIELDNAME_offset allow linear corrections using the following convention:

.. code-block::

Expand All @@ -413,14 +413,28 @@
This formula will derive the value to plot, when necessary.
</doc>
</field>
<field name="offset" type="NX_FLOAT">
<field name="FIELDNAME_offset" type="NX_FLOAT">
<doc>
An optional offset to apply to the values in data.
An optional offset to apply to the values in FIELDNAME (usually the signal).

See :ref:`scaling_factor &lt;/NXdata/scaling_factor-field&gt;` for more information.
See :ref:`FIELDNAME_scaling_factor &lt;/NXdata/FIELDNAME_scaling_factor-field&gt;` for more information.
</doc>
</field>

<field name="scaling_factor" type="NX_FLOAT" deprecated="Use FIELDNAME_scaling_factor instead">
<doc>
Due to scaling_factor being ambiguous in the case of multiple signals, use
FIELDNAME_scaling_factor instead
</doc>
</field>
<field name="offset" type="NX_FLOAT" deprecated="Use FIELDNAME_offset instead">
<doc>
Due to offset being ambiguous in the case of multiple signals, use
FIELDNAME_offset instead
</doc>
</field>


<!-- Other fields -->
<field name="title">
<doc>
Expand Down

0 comments on commit 6ff76d6

Please sign in to comment.