Workflow widgets example#

This notebook illustrates how we can use essreduce’s workflow widgets to generate a graphical interface for running the LoKI tutorial workflow.

Initializing the GUI#

It is as simple as importing the loki submodule and generating a GUI using workflow_widget (the workflow automatically registers itself to a library of workflows when imported).

[1]:
# Import loki submodule to register workflow
from ess import loki  # noqa: F401
from ess.reduce import ui

# Prepare a container for accessing the results computed by the GUI
results = {}

# Initialize the GUI widget
widget = ui.workflow_widget(result_registry=results)
widget
[1]:

Accessing the results#

We can now access the computed result in the results dictionary:

[3]:
results
[3]:
{ess.sans.types.IofQ[ess.reduce.nexus.types.SampleRun]: <scipp.DataArray>
 Dimensions: Sizes[Q:100, ]
 Coordinates:
   L1                        float64              [m]  ()  25.61
 * Q                         float64           [1/Å]  (Q [bin-edge])  [0.01, 0.0129, ..., 0.2971, 0.3]
 * gravity                   vector3          [m/s^2]  ()  (0, -9.80665, 0)
   incident_beam             vector3              [m]  ()  (0, 0, 25.61)
 * wavelength                float64             [Å]  (wavelength [bin-edge])  [2, 12]
 Data:
                             float32  [dimensionless]  (Q)  [4.35242, 4.75759, ..., 0.186054, 0.207492]  [0.000808932, 0.000567726, ..., 0.000558326, 0.000717547]
 }

The result can be plotted using

[4]:
(da,) = results.values()
da.plot(norm="log")
[4]:
../../_images/user-guide_loki_workflow-widget-loki_6_0.svg