Workflow widgets example#
This notebook illustrates how we can use ESSreduce’s workflow widgets to generate a graphical interface for running the DREAM GEANT4 workflow.
Initializing the GUI#
It is as simple as importing the dream submodule and generating a GUI using workflow_widget
(the workflow automatically registers itself to a library of workflows when imported).
[1]:
# Import dream submodule to register workflow
from ess import dream
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.powder.types.IofDspacing[ess.reduce.nexus.types.SampleRun]: <scipp.DataArray>
Dimensions: Sizes[dspacing:200, ]
Coordinates:
* detector string <no unit> () "mantle"
* dspacing float64 [Å] (dspacing [bin-edge]) [0, 0.011717, ..., 2.33168, 2.3434]
* gravity vector3 [m/s^2] () (0, -9.80665, 0)
sample_position vector3 [mm] () (0, 0, 0)
source_position vector3 [mm] () (-3.478, 0, -76550)
Data:
DataArrayView <no unit> (dspacing) binned data: dim='event', content=DataArray(
dims=(event: 1270162),
data=float64[dimensionless],
coords={'event_time_zero':datetime64[ns], 'event_time_offset':float64[ns],
'dspacing':float64[Å]})
Masks:
zero_vanadium bool <no unit> (dspacing) [True, True, ..., False, False]
}
The result can be plotted using
[4]:
(da,) = results.values()
da.hist(dspacing=200).plot()
[4]: