LOKI Detector Diagnostics#
In this notebook, we showcase two tools that can be used to investigate/debug the Loki detectors:
LokiBankViewer: a 2D view of all detector panels with sliders to select straw and layerInstrumentView: a 3D view of detector panels with toggle buttons for panel selection
[1]:
%matplotlib widget
Load detector bank data#
We load all 9 detector banks from a Loki file:
[2]:
import scipp as sc
from ess import loki
import ess.loki.data # noqa: F401
from ess.sans.types import RawDetector, SampleRun, NeXusDetectorName, BeamCenter, Filename
wf = loki.LokiWorkflow()
wf[BeamCenter] = sc.vector([0, 0, 0], unit='m')
wf[Filename[SampleRun]] = loki.data.loki_coda_file_small()
data = sc.DataGroup()
for i in range(9):
key = f"loki_detector_{i}"
wf[NeXusDetectorName] = key
data[key] = wf.compute(RawDetector[SampleRun])
data.keys()
Downloading file 'loki_999999_00009928_small.hdf' from 'https://public.esss.dk/groups/scipp/ess/loki/2/loki_999999_00009928_small.hdf' to '/home/runner/.cache/ess/loki'.
[2]:
dict_keys(['loki_detector_0', 'loki_detector_1', 'loki_detector_2', 'loki_detector_3', 'loki_detector_4', 'loki_detector_5', 'loki_detector_6', 'loki_detector_7', 'loki_detector_8'])
The LokiBankViewer#
[3]:
from ess.loki.diagnostics import LokiBankViewer
viewer = LokiBankViewer(data.hist())
[5]:
viewer
[5]:
The InstrumentView#
We histogram the data into an additional event_time_offset dimension, which will be controlled via a slider below the instrument view.
[6]:
dhist = data.hist(event_time_offset=200)
[8]:
from ess.loki.diagnostics import InstrumentView
InstrumentView(dhist, dim='event_time_offset')
[8]: