Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions docs/api/quicknxs.ui.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ quicknxs.ui package
Submodules
----------

quicknxs.ui.binningtype\_combobox module
------------------------------------------

.. automodule:: quicknxs.ui.binningtype_combobox
:members:
:undoc-members:
:show-inheritance:

quicknxs.ui.compare\_plots module
------------------------------------------

Expand Down
3 changes: 3 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,6 @@

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True

# include both class and __init__ docstrings
autoclass_content = "both"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/binning_options_per_run.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/binning_options_reduction_table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/constant_q_binning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/final_rebin_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/images/final_rebin_global.png
Binary file not shown.
Binary file removed docs/images/q_steps_global0.png
Binary file not shown.
Binary file removed docs/images/q_steps_global1.png
Binary file not shown.
Binary file removed docs/images/q_steps_per_run0.png
Binary file not shown.
Binary file removed docs/images/q_steps_per_run1.png
Binary file not shown.
136 changes: 60 additions & 76 deletions docs/user/binning.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
.. _binning:

Binning a Reduced Workspace in QuickNXS
=======================================
Binning
=======

Overview
--------

Binning is an essential process in reflectivity reduction within QuickNXS, organizing raw data into manageable intervals for accurate analysis.
Several binning options are available at various steps of the data reduction process.
An initial time-of-flight binning options is available to process the raw data, which is later converted into Q bins.
A final Q rebinning is optionally available for user who want their reflectivity output in specific Q binning.
This guide explains the available binning options
in QuickNXS and how to configure them for the best results.
Binning is an essential process in reflectivity reduction within QuickNXS,
organizing raw data into manageable intervals for accurate analysis.
There are two types of binning: time-of-flight binning and Q binning.

An initial **time-of-flight binning** step processes the raw event data from the
sample run and direct beam run to allow for normalization. This step is
mandatory.

There is an optional **Q binning** step, which is the last thing that happens
when the reflectivity curve is calculated.

This guide explains the available binning options in QuickNXS and how to configure them.

.. note:: All binning options are ultimately passed to the `MagnetismReflectometryReduction algorithm <https://docs.mantidproject.org/nightly/algorithms/MagnetismReflectometryReduction-v1.html>`_ in Mantid.

Expand Down Expand Up @@ -40,92 +46,66 @@ The following options allow users to fine-tune binning behavior:
**Entering the Bin Width**


**Final Rebin** (Checkbox, Per-Run or Global)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- **What It Does:** Controls whether the final reduced workspace (converted to Q-space) undergoes additional rebinning.
- **How It Works:**

- When enabled, rebinning is performed using `Q Steps`, in units of 1/Å, as the bin width.
- This option is **only available** if `Constant-Q Binning` is **disabled**.
- If `Constant-Q Binning` is enabled, it **takes priority** over `Final Rebin`.
- If `Final Rebin` is enabled **per-run**, the `Q Steps` values can be viewed and updated in the reduction data table under the `Q-Steps` column. If it is enabled globally, it takes priority over any per-run `Q Steps` values.

- **How to Use It:** Check this box if you want to apply final rebinning.

.. figure::
../images/final_rebin_global.png
:alt: Final Rebin Global

**Enabling Final Rebin Globally**

.. figure::
../images/final_rebin_per_run.png
:alt: Final Rebin Per-Run

**Enabling Final Rebin Per-Run**


**Constant-Q Binning** (Checkbox, Applied Globally)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**Binning Type** (Multi-select, Per-Run)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- **What It Does:** uses the position of each pixel and the specified TOF binning to sum counts directly in Q bins. This differs from the traditional reflectivity calculation, which assumes that all counts in a TOF bin has the same Q value regardless of where they landed on the detector.
- **What It Does:** Controls the binning of the final reduced workspace (converted to Q-space).
- **How It Works:**
- There are three options for `Q binning`, which happens when the reflectivity
data is converted to Q-space:

- When enabled, `Final Rebin` is not performed.
- Enabling Constant-Q binning changes the way R(q) is calculated.
- `Q Steps` is used to determine binning:
1. `None`: the counts from the pixels in the region-of-interest are summed
in pixel-time space and then converted to Q. No additional binning.
2. `Normal binning`: the counts from the pixels in the region-of-interest
are summed in pixel-time space and then converted to Q. Finally, the
resulting counts vs Q data is binned according to the configured Q
binning.
3. `Constant-Q binning`: the data is first converted to Q and then summed
according to the configured Q binning to produce counts vs Q.

- If **positive**, bins are evenly spaced.
- If **negative**, bins are spaced logarithmically using a geometric progression.
- For `Normal binning` and `Constant-Q binning`, rebinning is performed
using `Q Steps`, in units of 1/Å:

- This setting is **global** and cannot be adjusted per-run.
- If **positive**, bins are evenly spaced.
- If **negative**, bins are spaced logarithmically using a geometric progression.

- **How to Use It:** Check this box if you want to maintain constant-Q binning. Ensure `Q Steps` is set appropriately for either linear or logarithmic binning.
- **How to Use It:** Select the binning type either in the reduction table
or (for the active run) in the left-hand side panel `Reflectivity
Extraction (Per Run)`.

.. figure::
../images/constant_q_binning.png
:alt: Constant-Q Binning

**Enabling Constant-Q Binning**

**Q Steps** (Numeric Input, Per-Run or Global)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**Q Steps** (Numeric Input, Per-Run)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- **Constraints:** Must be a floating point value between -0.1 and 0.1 units of 1/Å.
- **What It Does:** Defines the bin width for the final rebinning in Q-space.
- **What It Does:** Defines the bin width for the rebinning in Q-space.
- **How It Works:**

- `Q Steps` is used in both `Final Rebin` and `Constant-Q Binning`.
- When `Final Rebin` is enabled, `Q Steps` sets the bin width for the final rebinning.
- When `Constant-Q Binning` is enabled, `Q Steps` determines whether binning follows a **linear** or **logarithmic** scale.
- `Q Steps` is used for both `Normal` and `Constant-Q` binning.
- It controls the resolution of the final reduced workspace.

- It controls the resolution of the final reduced workspace.
- If `Q Steps` is **positive**, linear binning is applied with evenly spaced bins.
- If `Q Steps` is **negative**, logarithmic binning is applied, where bin edges follow a geometric progression.

- **How to Use It:** Enter a numeric value to specify the bin width for Q-space rebinning. Use negative values for logarithmic binning.
- **How to Use It:** Enter a numeric value to specify the bin width for
Q-space binning. Use negative values for logarithmic binning.

.. figure::
../images/q_steps_global0.png
:alt: Q Steps Global
../images/binning_options_per_run.png
:alt: Binning Options for the Active Run

**Changing Binning Options for the Active Run**

.. figure::
../images/q_steps_global1.png
:alt: Q Steps Global
../images/binning_options_reduction_table.png
:alt: Binning Options in the Reduction Table

**Setting Q Steps Globally disables the Q-Steps column in the reduction table**

.. figure::
../images/q_steps_per_run0.png
:alt: Q Steps Per-Run
**Changing Binning Options in the Reduction Table**

.. figure::
../images/q_steps_per_run1.png
:alt: Q Steps Per-Run
../images/binning_options_button_apply_to_all_runs.png
:alt: Apply the Same Binning Options to All Runs

**Setting Q Steps Per-Run adds the value to the Q-Steps column in the reduction table**
**Apply the Same Binning Options to All Runs in the Reduction Table**

Binning Workflow
----------------
Expand All @@ -139,12 +119,16 @@ To apply binning settings effectively, follow these steps:
- If TOF min is ≤ 0, `Bin Width` will also be used as the TOF minimum.
- The direct beam workspace is automatically rebinned to match this setting.

1. **Apply Final Binning (Optional):**
2. **Apply Q Binning (Optional):**
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- If `Constant-Q Binning` is **enabled**, it takes priority over `Final Rebin`.
- If `Constant-Q Binning` is **disabled** and additional Q-space binning is required, check `Final Rebin` and specify a `Q Steps` value.
- If `Final Rebin` is enabled **per-run**, the `Q Steps` values can be viewed and updated in the reduction data table under the `Q-Steps` column.
- If using `Constant-Q Binning`, ensure `Q Steps` is appropriately set for linear or logarithmic binning.
- Select the binning type and Q steps for each run, either in the reduction
table or in the panel `Reflectivity Extraction (Per Run)`. Alternatively,
to set the same binning type and Q steps for all runs in the reduction
table, use the button `Apply to all runs` under `Reflectivity Extraction
(Global)`.
- The reflectivity plot is updated automatically when updating binning
options.

By adjusting these options, users can customize their reflectivity reduction workflow to achieve the desired data resolution and accuracy.
By adjusting these options, users can customize their reflectivity reduction
workflow to achieve the desired data resolution and accuracy.
Loading
Loading