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.IofTof: <scipp.DataArray>
Dimensions: Sizes[tof:200, ]
Coordinates:
L1 float64 [mm] () 76550
* gravity vector3 [m/s^2] () (0, -9.80665, 0)
incident_beam vector3 [mm] () (3.478, 0, 76550)
sample_position vector3 [mm] () (0, 0, 0)
source_position vector3 [mm] () (-3.478, 0, -76550)
* tof float64 [µs] (tof [bin-edge]) [0, 332.591, ..., 66185.6, 66518.2]
Data:
DataArrayView <no unit> (tof) binned data: dim='event', content=DataArray(
dims=(event: 1267540),
data=float64[dimensionless],
coords={'event_time_offset':float64[µs], 'event_time_zero':float64[µs],
'tof':float64[µs]})
}
The result can be plotted using
[4]:
(da,) = results.values()
da.hist(tof=200).plot()
[4]: