From 650cfc143e34046c4af5d4625bc70a893828c0e7 Mon Sep 17 00:00:00 2001 From: Aaron Brewster Date: Tue, 21 Nov 2023 14:50:56 -0800 Subject: [PATCH 01/14] Rewrite the NXdata scaling_factor and offset fields --- applications/NXmx.nxdl.xml | 37 ++++++++++++++++++++++++++++++++++++ base_classes/NXdata.nxdl.xml | 18 +++++++++++++----- 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/applications/NXmx.nxdl.xml b/applications/NXmx.nxdl.xml index 02ec76cbbe..55c0254750 100644 --- a/applications/NXmx.nxdl.xml +++ b/applications/NXmx.nxdl.xml @@ -142,6 +142,43 @@ + + + + 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: + + .. code-block:: + + corrected_data = (data + offset) * scaling_factor + + This formula will derive the actual physical value, when necessary. + + 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. + + 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)). + + + + + An optional offset to apply to the values in data. + + See :ref:`scaling_factor` for more information. + + + + diff --git a/base_classes/NXdata.nxdl.xml b/base_classes/NXdata.nxdl.xml index 2c9d69620d..d5f4a9d9c7 100644 --- a/base_classes/NXdata.nxdl.xml +++ b/base_classes/NXdata.nxdl.xml @@ -400,16 +400,24 @@ - The elements in data are usually float values really. For - efficiency reasons these are usually stored as integers - after scaling with a scale factor. This value is the scale - factor. It is required to get the actual physical value, - when necessary. + 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: + + .. code-block:: + + corrected_data = (data + offset) * scaling_factor + + This formula will derive the actual physical value, when necessary. An optional offset to apply to the values in data. + + See :ref:`scaling_factor` for more information. From 1ddde5ae1b3622f0ab289531b19a1c1bc859ec73 Mon Sep 17 00:00:00 2001 From: Aaron Brewster Date: Tue, 21 Nov 2023 15:21:30 -0800 Subject: [PATCH 02/14] Fix references --- applications/NXmx.nxdl.xml | 2 +- base_classes/NXdata.nxdl.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/NXmx.nxdl.xml b/applications/NXmx.nxdl.xml index 55c0254750..c1156169c6 100644 --- a/applications/NXmx.nxdl.xml +++ b/applications/NXmx.nxdl.xml @@ -174,7 +174,7 @@ An optional offset to apply to the values in data. - See :ref:`scaling_factor` for more information. + See :ref:`scaling_factor </NXmx/ENTRY/DATA/scaling_factor-field>` for more information. diff --git a/base_classes/NXdata.nxdl.xml b/base_classes/NXdata.nxdl.xml index d5f4a9d9c7..2c06ba4e29 100644 --- a/base_classes/NXdata.nxdl.xml +++ b/base_classes/NXdata.nxdl.xml @@ -417,7 +417,7 @@ An optional offset to apply to the values in data. - See :ref:`scaling_factor` for more information. + See :ref:`scaling_factor </NXdata/scaling_factor-field>` for more information. From 6c4b8562b95f6b3fd51a57d4bf194159458b8cc6 Mon Sep 17 00:00:00 2001 From: Aaron Brewster Date: Tue, 2 Jan 2024 17:02:46 -0800 Subject: [PATCH 03/14] Code review Change NXdata scaling_factor to refer to "plotted" data Change NXdata to refer to "corrected" data, in addition to "physical" data, since it describes units of photons --- applications/NXmx.nxdl.xml | 2 +- base_classes/NXdata.nxdl.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/NXmx.nxdl.xml b/applications/NXmx.nxdl.xml index c1156169c6..335a9d7337 100644 --- a/applications/NXmx.nxdl.xml +++ b/applications/NXmx.nxdl.xml @@ -155,7 +155,7 @@ corrected_data = (data + offset) * scaling_factor - This formula will derive the actual physical value, when necessary. + This formula will derive the corrected value, when necessary. 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 diff --git a/base_classes/NXdata.nxdl.xml b/base_classes/NXdata.nxdl.xml index 2c06ba4e29..970ee94be0 100644 --- a/base_classes/NXdata.nxdl.xml +++ b/base_classes/NXdata.nxdl.xml @@ -408,9 +408,9 @@ .. code-block:: - corrected_data = (data + offset) * scaling_factor + plotted_data = (data + offset) * scaling_factor - This formula will derive the actual physical value, when necessary. + This formula will derive the value to plot, when necessary. From 6ff76d6b5e67cb83acf2938969a2a7cc3a3206f2 Mon Sep 17 00:00:00 2001 From: Aaron Brewster Date: Thu, 18 Jan 2024 14:28:20 -0800 Subject: [PATCH 04/14] Use FIELDNAME_scaling_factor and FIELDNAME_offset 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 --- applications/NXmx.nxdl.xml | 16 ++++++++-------- base_classes/NXdata.nxdl.xml | 28 +++++++++++++++++++++------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/applications/NXmx.nxdl.xml b/applications/NXmx.nxdl.xml index 335a9d7337..78be8b2eee 100644 --- a/applications/NXmx.nxdl.xml +++ b/applications/NXmx.nxdl.xml @@ -143,13 +143,13 @@ - + 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:: @@ -160,9 +160,9 @@ 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)), @@ -170,11 +170,11 @@ (np, 1), (np, i, j) or (np, i, j, k)). - + An optional offset to apply to the values in data. - See :ref:`scaling_factor </NXmx/ENTRY/DATA/scaling_factor-field>` for more information. + See :ref:`data_scaling_factor </NXmx/ENTRY/DATA/data_scaling_factor-field>` for more information. diff --git a/base_classes/NXdata.nxdl.xml b/base_classes/NXdata.nxdl.xml index 970ee94be0..c468a454cf 100644 --- a/base_classes/NXdata.nxdl.xml +++ b/base_classes/NXdata.nxdl.xml @@ -398,13 +398,13 @@ - + - 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:: @@ -413,14 +413,28 @@ This formula will derive the value to plot, when necessary. - + - 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 </NXdata/scaling_factor-field>` for more information. + See :ref:`FIELDNAME_scaling_factor </NXdata/FIELDNAME_scaling_factor-field>` for more information. + + + Due to scaling_factor being ambiguous in the case of multiple signals, use + FIELDNAME_scaling_factor instead + + + + + Due to offset being ambiguous in the case of multiple signals, use + FIELDNAME_offset instead + + + + From 691f56a20824265d2f098c268216e89b3723397c Mon Sep 17 00:00:00 2001 From: Aaron Brewster Date: Tue, 6 Feb 2024 14:14:38 -0800 Subject: [PATCH 05/14] Apply comments from code review - NXmx: fully define pedestal, bias, and gain and how they relate to offset and scaling_factor - Add reserved suffixes _scaling_factor and _offset - NXdata: define better how the stored values in FIELDNAME are converted to physical values - NXdata: more clarification on how scaling_factor and offset without FIELDNAME are ambiguous --- applications/NXmx.nxdl.xml | 11 +++++++---- base_classes/NXdata.nxdl.xml | 20 ++++++++++++-------- manual/source/datarules.rst | 7 ++++++- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/applications/NXmx.nxdl.xml b/applications/NXmx.nxdl.xml index beef5c9482..4b732885f3 100644 --- a/applications/NXmx.nxdl.xml +++ b/applications/NXmx.nxdl.xml @@ -145,9 +145,9 @@ - An optional scaling factor to apply to the values in data. + 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 + The elements in ``data`` are often stored as integers for efficiency reasons and need further correction, generating floats. The two fields data_scaling_factor and data_offset allow linear corrections using the following convention: @@ -157,11 +157,14 @@ This formula will derive the corrected value, when necessary. - Use these fields to specify gain and/or pedestal constants that need to be applied + data_scaling_factor is sometimes known as gain or bias and data_offset is sometimes + known as pedestal or background, depending on the community. + + Use these fields to specify 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 data_scaling_factor as 0.1 and data_offset as -400 to - specifiy the required conversion from raw counts to pedestal-corrected photons. It + specify the required conversion from raw counts to 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 diff --git a/base_classes/NXdata.nxdl.xml b/base_classes/NXdata.nxdl.xml index 74b16326c8..d048b1feb0 100644 --- a/base_classes/NXdata.nxdl.xml +++ b/base_classes/NXdata.nxdl.xml @@ -450,15 +450,17 @@ 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 FIELDNAME_scaling_factor and + The elements stored in NXdata datasets are often stored as integers for efficiency + reasons and need further correction or conversion, generating floats. For example, + raw values could be stored from a device that need to be converted to values that + represent the physical values. The two fields FIELDNAME_scaling_factor and FIELDNAME_offset allow linear corrections using the following convention: .. code-block:: - plotted_data = (data + offset) * scaling_factor + corrected values = (FIELDNAME + offset) * scaling_factor - This formula will derive the value to plot, when necessary. + This formula will derive the values to use in downstream applications, when necessary. @@ -471,14 +473,16 @@ - Due to scaling_factor being ambiguous in the case of multiple signals, use - FIELDNAME_scaling_factor instead + scaling_factor is ambiguous in the case of multiple signals, so use + FIELDNAME_scaling_factor instead, which has similar semantics, even + when only a single signal is present. - Due to offset being ambiguous in the case of multiple signals, use - FIELDNAME_offset instead + offset is ambiguous in the case of multiple signals, so use + FIELDNAME_offset instead, which has similar semantics, even + when only a single signal is present. diff --git a/manual/source/datarules.rst b/manual/source/datarules.rst index fcbd236a14..7f4fde0d21 100644 --- a/manual/source/datarules.rst +++ b/manual/source/datarules.rst @@ -231,6 +231,8 @@ the following table lists the suffixes reserved by NeXus. reserved suffixes; mask reserved suffixes; set reserved suffixes; weights + reserved suffixes; scaling_factor + reserved suffixes; offset ================== ========================================= ================================= suffix reference meaning @@ -242,10 +244,13 @@ suffix reference meaning ``_mask`` .. Field containing a signal mask, where 0 means the pixel is not masked. If required, bit masks are defined in :ref:`NXdetector` ``pixel_mask``. ``_set`` :ref:`target values ` Target value of ``DATASET`` ``_weights`` .. divide ``DATASET`` by these weights [#]_ +``_scaling_factor`` :ref:`NXdata` Multiply ``DATASET`` by this factor [#]_ +``_offset`` :ref:`NXdata` Add this factor to ``DATASET`` [#]_ ================== ========================================= ================================= .. [#] If ``DATASET_weights`` exists and has the same shape as the field, - you are supposed to divide ``DATASET`` by the weights. + you are supposed to divide ``DATASET`` by the weights. Similarly, if `DATASET_scaling_factor` and/or + `DATASET_offset` exist, apply this equation: (``DATASET`` + ``DATASET_offset``) * ``DATASET_scaling_factor`` .. Note that the following line might be added to the above table pending discussion: From 717998800eb5f5305714fdb48ef98ff4c567ee2d Mon Sep 17 00:00:00 2001 From: Aaron Brewster Date: Wed, 7 Feb 2024 13:35:18 -0800 Subject: [PATCH 06/14] Code review --- base_classes/NXdata.nxdl.xml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/base_classes/NXdata.nxdl.xml b/base_classes/NXdata.nxdl.xml index d048b1feb0..fa369cbfeb 100644 --- a/base_classes/NXdata.nxdl.xml +++ b/base_classes/NXdata.nxdl.xml @@ -473,16 +473,18 @@ - scaling_factor is ambiguous in the case of multiple signals, so use - FIELDNAME_scaling_factor instead, which has similar semantics, even - when only a single signal is present. + The scaling_factor and FIELDNAME_scaling_factor fields have similar semantics. + However, scaling_factor is ambiguous in the case of multiple signals. Therefore + scaling_factor is deprecated. Use FIELDNAME_scaling_factor instead, even when + only a single signal is present. - offset is ambiguous in the case of multiple signals, so use - FIELDNAME_offset instead, which has similar semantics, even - when only a single signal is present. + The offset and FIELDNAME_offset fields have similar semantics. + However, offset is ambiguous in the case of multiple signals. Therefore + offset is deprecated. Use FIELDNAME_offset instead, even when + only a single signal is present. From 9c524574ae628ed0aa29523f1ed45e83e6917ed7 Mon Sep 17 00:00:00 2001 From: Aaron Brewster Date: Mon, 15 Jul 2024 16:59:57 -0700 Subject: [PATCH 07/14] Remove 'bias' from data_scaling_factor and fix typo --- applications/NXmx.nxdl.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/NXmx.nxdl.xml b/applications/NXmx.nxdl.xml index 4b732885f3..f411537d21 100644 --- a/applications/NXmx.nxdl.xml +++ b/applications/NXmx.nxdl.xml @@ -157,7 +157,7 @@ This formula will derive the corrected value, when necessary. - data_scaling_factor is sometimes known as gain or bias and data_offset is sometimes + data_scaling_factor is sometimes known as gain and data_offset is sometimes known as pedestal or background, depending on the community. Use these fields to specify constants that need to be applied @@ -169,7 +169,7 @@ 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 + or a per-image correction specified with an array whose slowest rank is nP (rank (np, 1), (np, i, j) or (np, i, j, k)). From edf46708ebaebbf9535b7598f4639464fcc829ae Mon Sep 17 00:00:00 2001 From: Aaron Brewster Date: Mon, 15 Jul 2024 17:08:11 -0700 Subject: [PATCH 08/14] rank --> dimensions --- applications/NXmx.nxdl.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/NXmx.nxdl.xml b/applications/NXmx.nxdl.xml index f411537d21..eb0037f085 100644 --- a/applications/NXmx.nxdl.xml +++ b/applications/NXmx.nxdl.xml @@ -168,8 +168,8 @@ 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)), - or a per-image correction specified with an array whose slowest rank is nP (rank + single per-pixel array applied to every image (dimensions (i, j) or (i, j, k)), + or a per-image correction specified with an array whose slowest rank is nP (dimensions (np, 1), (np, i, j) or (np, i, j, k)). From 9d4c4d2bdd2fa49633e92ef8fc252f7cb21dbee5 Mon Sep 17 00:00:00 2001 From: Aaron Brewster Date: Mon, 19 Aug 2024 16:58:17 -0700 Subject: [PATCH 09/14] Code review - NX_FLOAT -> NX_NUMBER for scaling_factor and offset - Sync language with number #1396 for the FIELDNAME convention --- base_classes/NXdata.nxdl.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/base_classes/NXdata.nxdl.xml b/base_classes/NXdata.nxdl.xml index fa369cbfeb..9a43b3771d 100644 --- a/base_classes/NXdata.nxdl.xml +++ b/base_classes/NXdata.nxdl.xml @@ -446,9 +446,12 @@ - + - An optional scaling factor to apply to the values in FIELDNAME (usually the signal). + An optional scaling factor to apply to the values in any field named ``FIELDNAME`` + in this ``NXdata`` group. This can be a :ref:`DATA </NXdata/DATA-field>` field + (signal or auxiliary signal) or a :ref:`AXISNAME </NXdata/AXISNAME-field>` + field (axis). The elements stored in NXdata datasets are often stored as integers for efficiency reasons and need further correction or conversion, generating floats. For example, @@ -463,7 +466,7 @@ This formula will derive the values to use in downstream applications, when necessary. - + An optional offset to apply to the values in FIELDNAME (usually the signal). From 48ed5efd79f4fb29a55bd66ba3dc852d8117fb71 Mon Sep 17 00:00:00 2001 From: Aaron Brewster Date: Mon, 19 Aug 2024 17:03:47 -0700 Subject: [PATCH 10/14] Code review (shoulda been in the last commit) --- applications/NXmx.nxdl.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/NXmx.nxdl.xml b/applications/NXmx.nxdl.xml index eb0037f085..5b0ebab229 100644 --- a/applications/NXmx.nxdl.xml +++ b/applications/NXmx.nxdl.xml @@ -143,7 +143,7 @@ - + An optional scaling factor to apply to the values in ``data``. @@ -173,7 +173,7 @@ (np, 1), (np, i, j) or (np, i, j, k)). - + An optional offset to apply to the values in data. From 80577e5aab00d690ed31d256d55df633c105dde7 Mon Sep 17 00:00:00 2001 From: Aaron Brewster Date: Tue, 20 Aug 2024 07:49:28 -0700 Subject: [PATCH 11/14] Maybe fix build --- manual/source/datarules.rst | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/manual/source/datarules.rst b/manual/source/datarules.rst index 7f4fde0d21..999ef6a9ef 100644 --- a/manual/source/datarules.rst +++ b/manual/source/datarules.rst @@ -234,19 +234,19 @@ the following table lists the suffixes reserved by NeXus. reserved suffixes; scaling_factor reserved suffixes; offset -================== ========================================= ================================= -suffix reference meaning -================== ========================================= ================================= -``_end`` :ref:`NXtransformations` end points of the motions that start with ``DATASET`` -``_errors`` :ref:`NXdata` uncertainties (a.k.a., errors) -``_increment_set`` :ref:`NXtransformations` intended average range through which the corresponding axis moves during the exposure of a frame -``_indices`` :ref:`NXdata` Integer array that defines the indices of the signal field which need to be used in the ``DATASET`` in order to reference the corresponding axis value -``_mask`` .. Field containing a signal mask, where 0 means the pixel is not masked. If required, bit masks are defined in :ref:`NXdetector` ``pixel_mask``. -``_set`` :ref:`target values ` Target value of ``DATASET`` -``_weights`` .. divide ``DATASET`` by these weights [#]_ -``_scaling_factor`` :ref:`NXdata` Multiply ``DATASET`` by this factor [#]_ -``_offset`` :ref:`NXdata` Add this factor to ``DATASET`` [#]_ -================== ========================================= ================================= +=================== ========================================= ================================= +suffix reference meaning +=================== ========================================= ================================= +``_end`` :ref:`NXtransformations` end points of the motions that start with ``DATASET`` +``_errors`` :ref:`NXdata` uncertainties (a.k.a., errors) +``_increment_set`` :ref:`NXtransformations` intended average range through which the corresponding axis moves during the exposure of a frame +``_indices`` :ref:`NXdata` Integer array that defines the indices of the signal field which need to be used in the ``DATASET`` in order to reference the corresponding axis value +``_mask`` .. Field containing a signal mask, where 0 means the pixel is not masked. If required, bit masks are defined in :ref:`NXdetector` ``pixel_mask``. +``_set`` :ref:`target values ` Target value of ``DATASET`` +``_weights`` .. divide ``DATASET`` by these weights [#]_ +``_scaling_factor`` :ref:`NXdata` Multiply ``DATASET`` by this factor [#]_ +``_offset`` :ref:`NXdata` Add this factor to ``DATASET`` [#]_ +=================== ========================================= ================================= .. [#] If ``DATASET_weights`` exists and has the same shape as the field, you are supposed to divide ``DATASET`` by the weights. Similarly, if `DATASET_scaling_factor` and/or From 37f53ac54972918ad2cd5c0328be9c2b6ea98523 Mon Sep 17 00:00:00 2001 From: Aaron Brewster Date: Tue, 20 Aug 2024 08:04:24 -0700 Subject: [PATCH 12/14] Attempt 2 --- manual/source/datarules.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manual/source/datarules.rst b/manual/source/datarules.rst index 999ef6a9ef..2dd703d962 100644 --- a/manual/source/datarules.rst +++ b/manual/source/datarules.rst @@ -243,12 +243,12 @@ suffix reference meaning ``_indices`` :ref:`NXdata` Integer array that defines the indices of the signal field which need to be used in the ``DATASET`` in order to reference the corresponding axis value ``_mask`` .. Field containing a signal mask, where 0 means the pixel is not masked. If required, bit masks are defined in :ref:`NXdetector` ``pixel_mask``. ``_set`` :ref:`target values ` Target value of ``DATASET`` -``_weights`` .. divide ``DATASET`` by these weights [#]_ -``_scaling_factor`` :ref:`NXdata` Multiply ``DATASET`` by this factor [#]_ -``_offset`` :ref:`NXdata` Add this factor to ``DATASET`` [#]_ +``_weights`` .. divide ``DATASET`` by these weights [#suffix_note]_ +``_scaling_factor`` :ref:`NXdata` Multiply ``DATASET`` by this factor [#suffix_note]_ +``_offset`` :ref:`NXdata` Add this factor to ``DATASET`` [#suffix_note]_ =================== ========================================= ================================= -.. [#] If ``DATASET_weights`` exists and has the same shape as the field, +.. [#suffix_note] If ``DATASET_weights`` exists and has the same shape as the field, you are supposed to divide ``DATASET`` by the weights. Similarly, if `DATASET_scaling_factor` and/or `DATASET_offset` exist, apply this equation: (``DATASET`` + ``DATASET_offset``) * ``DATASET_scaling_factor`` From 314c7639209cef3d236353aeac26f984a1170676 Mon Sep 17 00:00:00 2001 From: Aaron Brewster Date: Wed, 21 Aug 2024 13:27:50 -0700 Subject: [PATCH 13/14] Add implied defaults for sclaing_factor and offset --- applications/NXmx.nxdl.xml | 4 ++++ base_classes/NXdata.nxdl.xml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/applications/NXmx.nxdl.xml b/applications/NXmx.nxdl.xml index 1a7c633a9e..6e5206a7d2 100644 --- a/applications/NXmx.nxdl.xml +++ b/applications/NXmx.nxdl.xml @@ -171,12 +171,16 @@ single per-pixel array applied to every image (dimensions (i, j) or (i, j, k)), or a per-image correction specified with an array whose slowest rank is nP (dimensions (np, 1), (np, i, j) or (np, i, j, k)). + + When ommited, the scaling factor is assumed to be 1. An optional offset to apply to the values in data. + When ommited, the offset is assumed to be 0. + See :ref:`data_scaling_factor </NXmx/ENTRY/DATA/data_scaling_factor-field>` for more information. diff --git a/base_classes/NXdata.nxdl.xml b/base_classes/NXdata.nxdl.xml index b53c68b166..9572b309a0 100644 --- a/base_classes/NXdata.nxdl.xml +++ b/base_classes/NXdata.nxdl.xml @@ -464,12 +464,16 @@ corrected values = (FIELDNAME + offset) * scaling_factor This formula will derive the values to use in downstream applications, when necessary. + + When ommited, the scaling factor is assumed to be 1. An optional offset to apply to the values in FIELDNAME (usually the signal). + When ommited, the offset is assumed to be 0. + See :ref:`FIELDNAME_scaling_factor </NXdata/FIELDNAME_scaling_factor-field>` for more information. From e8326dd83eda69de58241236f831d41054c440ee Mon Sep 17 00:00:00 2001 From: Aaron Brewster Date: Wed, 28 Aug 2024 10:24:23 -0700 Subject: [PATCH 14/14] Spelling --- applications/NXmx.nxdl.xml | 4 ++-- base_classes/NXdata.nxdl.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/applications/NXmx.nxdl.xml b/applications/NXmx.nxdl.xml index 6e5206a7d2..a8eda7a497 100644 --- a/applications/NXmx.nxdl.xml +++ b/applications/NXmx.nxdl.xml @@ -172,14 +172,14 @@ or a per-image correction specified with an array whose slowest rank is nP (dimensions (np, 1), (np, i, j) or (np, i, j, k)). - When ommited, the scaling factor is assumed to be 1. + When omitted, the scaling factor is assumed to be 1. An optional offset to apply to the values in data. - When ommited, the offset is assumed to be 0. + When omitted, the offset is assumed to be 0. See :ref:`data_scaling_factor </NXmx/ENTRY/DATA/data_scaling_factor-field>` for more information. diff --git a/base_classes/NXdata.nxdl.xml b/base_classes/NXdata.nxdl.xml index 9572b309a0..9562baa93f 100644 --- a/base_classes/NXdata.nxdl.xml +++ b/base_classes/NXdata.nxdl.xml @@ -465,14 +465,14 @@ This formula will derive the values to use in downstream applications, when necessary. - When ommited, the scaling factor is assumed to be 1. + When omitted, the scaling factor is assumed to be 1. An optional offset to apply to the values in FIELDNAME (usually the signal). - When ommited, the offset is assumed to be 0. + When omitted, the offset is assumed to be 0. See :ref:`FIELDNAME_scaling_factor </NXdata/FIELDNAME_scaling_factor-field>` for more information.