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
28 changes: 8 additions & 20 deletions docs/user-guide/tof/dream.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"import plopp as pp\n",
"import scipp as sc\n",
"from scippneutron.chopper import DiskChopper\n",
"from ess.reduce.nexus.types import AnyRun, DetectorData, SampleRun\n",
"from ess.reduce.nexus.types import AnyRun, RawDetector, SampleRun\n",
"from ess.reduce.time_of_flight import *"
]
},
Expand Down Expand Up @@ -300,10 +300,10 @@
"source": [
"wf = GenericTofWorkflow(run_types=[SampleRun], monitor_types=[])\n",
"\n",
"wf[DetectorData[SampleRun]] = raw_data\n",
"wf[RawDetector[SampleRun]] = raw_data\n",
"wf[DetectorLtotal[SampleRun]] = Ltotal\n",
"\n",
"wf.visualize(DetectorTofData[SampleRun])"
"wf.visualize(TofDetector[SampleRun])"
]
},
{
Expand Down Expand Up @@ -436,7 +436,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "30",
"metadata": {},
Expand All @@ -457,7 +456,7 @@
"wf[TimeOfFlightLookupTable] = table\n",
"\n",
"# Compute time-of-flight of neutron events\n",
"tofs = wf.compute(DetectorTofData[SampleRun])\n",
"tofs = wf.compute(TofDetector[SampleRun])\n",
"tofs"
]
},
Expand Down Expand Up @@ -616,11 +615,11 @@
"outputs": [],
"source": [
"# Update workflow\n",
"wf[DetectorData[SampleRun]] = raw_data\n",
"wf[RawDetector[SampleRun]] = raw_data\n",
"wf[DetectorLtotal[SampleRun]] = Ltotal\n",
"\n",
"# Compute tofs and wavelengths\n",
"tofs = wf.compute(DetectorTofData[SampleRun])\n",
"tofs = wf.compute(TofDetector[SampleRun])\n",
"wav_wfm = tofs.transform_coords(\"wavelength\", graph=graph)\n",
"\n",
"# Compare in plot\n",
Expand Down Expand Up @@ -795,13 +794,13 @@
"metadata": {},
"outputs": [],
"source": [
"wf[DetectorData[SampleRun]] = ess_beamline.get_monitor(\"detector\")[0]\n",
"wf[RawDetector[SampleRun]] = ess_beamline.get_monitor(\"detector\")[0]\n",
"wf[DetectorLtotal[SampleRun]] = Ltotal\n",
"\n",
"wf[TimeOfFlightLookupTable] = table\n",
"\n",
"# Compute time-of-flight\n",
"tofs = wf.compute(DetectorTofData[SampleRun])\n",
"tofs = wf.compute(TofDetector[SampleRun])\n",
"# Compute wavelength\n",
"wav_wfm = tofs.transform_coords(\"wavelength\", graph=graph)\n",
"\n",
Expand All @@ -823,17 +822,6 @@
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
Expand Down
32 changes: 7 additions & 25 deletions docs/user-guide/tof/frame-unwrapping.ipynb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "0",
"metadata": {},
Expand Down Expand Up @@ -32,7 +31,7 @@
"import plopp as pp\n",
"import scipp as sc\n",
"from scippneutron.chopper import DiskChopper\n",
"from ess.reduce.nexus.types import AnyRun, DetectorData, SampleRun\n",
"from ess.reduce.nexus.types import AnyRun, RawDetector, SampleRun\n",
"from ess.reduce.time_of_flight import *\n",
"import tof\n",
"\n",
Expand Down Expand Up @@ -161,10 +160,10 @@
"source": [
"wf = GenericTofWorkflow(run_types=[SampleRun], monitor_types=[])\n",
"\n",
"wf[DetectorData[SampleRun]] = nxevent_data\n",
"wf[RawDetector[SampleRun]] = nxevent_data\n",
"wf[DetectorLtotal[SampleRun]] = nxevent_data.coords[\"Ltotal\"]\n",
"\n",
"wf.visualize(DetectorTofData[SampleRun])"
"wf.visualize(TofDetector[SampleRun])"
]
},
{
Expand Down Expand Up @@ -271,7 +270,7 @@
"wf[TimeOfFlightLookupTable] = table\n",
"\n",
"# Compute neutron tofs\n",
"tofs = wf.compute(DetectorTofData[SampleRun])\n",
"tofs = wf.compute(TofDetector[SampleRun])\n",
"\n",
"tof_hist = tofs.hist(tof=sc.scalar(500.0, unit=\"us\"))\n",
"pp.plot({det.name: tof_hist[\"detector_number\", i] for i, det in enumerate(detectors)})"
Expand Down Expand Up @@ -456,11 +455,11 @@
"# Reduction workflow\n",
"wf = GenericTofWorkflow(run_types=[SampleRun], monitor_types=[])\n",
"nxevent_data = results.to_nxevent_data()\n",
"wf[DetectorData[SampleRun]] = nxevent_data\n",
"wf[RawDetector[SampleRun]] = nxevent_data\n",
"wf[DetectorLtotal[SampleRun]] = nxevent_data.coords[\"Ltotal\"]\n",
"wf[TimeOfFlightLookupTable] = table\n",
"\n",
"tofs = wf.compute(DetectorTofData[SampleRun])\n",
"tofs = wf.compute(TofDetector[SampleRun])\n",
"\n",
"tof_hist = tofs.hist(tof=sc.scalar(500.0, unit=\"us\"))\n",
"pp.plot({det.name: tof_hist[\"detector_number\", i] for i, det in enumerate(detectors)})"
Expand Down Expand Up @@ -500,24 +499,7 @@
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3"
}
},
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}
28 changes: 5 additions & 23 deletions docs/user-guide/tof/wfm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"import plopp as pp\n",
"import scipp as sc\n",
"from scippneutron.chopper import DiskChopper\n",
"from ess.reduce.nexus.types import AnyRun, DetectorData, SampleRun\n",
"from ess.reduce.nexus.types import AnyRun, RawDetector, SampleRun\n",
"from ess.reduce.time_of_flight import *"
]
},
Expand Down Expand Up @@ -321,10 +321,10 @@
"source": [
"wf = GenericTofWorkflow(run_types=[SampleRun], monitor_types=[])\n",
"\n",
"wf[DetectorData[SampleRun]] = raw_data\n",
"wf[RawDetector[SampleRun]] = raw_data\n",
"wf[DetectorLtotal[SampleRun]] = Ltotal\n",
"\n",
"wf.visualize(DetectorTofData[SampleRun])"
"wf.visualize(TofDetector[SampleRun])"
]
},
{
Expand Down Expand Up @@ -442,7 +442,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "27",
"metadata": {},
Expand All @@ -466,7 +465,7 @@
"source": [
"wf[TimeOfFlightLookupTable] = table\n",
"\n",
"tofs = wf.compute(DetectorTofData[SampleRun])\n",
"tofs = wf.compute(TofDetector[SampleRun])\n",
"tofs"
]
},
Expand Down Expand Up @@ -549,24 +548,7 @@
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3"
}
},
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}
10 changes: 5 additions & 5 deletions src/ess/reduce/live/raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import scippnexus as snx

from ess.reduce.nexus.types import (
CalibratedDetector,
EmptyDetector,
Filename,
NeXusComponent,
NeXusDetectorName,
Expand Down Expand Up @@ -305,7 +305,7 @@ def transform_weights(

@staticmethod
def from_detector_and_histogrammer(
detector: CalibratedDetector[SampleRun],
detector: EmptyDetector[SampleRun],
window: RollingDetectorViewWindow,
projection: Histogrammer,
) -> RollingDetectorView:
Expand All @@ -320,10 +320,10 @@ def from_detector_and_histogrammer(
def from_detector_with_projection(
projection: Callable[[sc.DataArray], sc.DataArray] | None,
) -> Callable[
[CalibratedDetector[SampleRun], RollingDetectorViewWindow], RollingDetectorView
[EmptyDetector[SampleRun], RollingDetectorViewWindow], RollingDetectorView
]:
def factory(
detector: CalibratedDetector[SampleRun],
detector: EmptyDetector[SampleRun],
window: RollingDetectorViewWindow,
) -> RollingDetectorView:
"""Helper for constructing via a Sciline workflow."""
Expand Down Expand Up @@ -591,7 +591,7 @@ def gaussian_position_noise(sigma: PositionNoiseSigma) -> PositionNoise:

def position_with_noisy_replicas(
*,
detector: CalibratedDetector[SampleRun],
detector: EmptyDetector[SampleRun],
position_noise: PositionNoise,
replicas: PositionNoiseReplicaCount,
) -> CalibratedPositionWithNoisyReplicas:
Expand Down
18 changes: 6 additions & 12 deletions src/ess/reduce/nexus/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,25 +199,19 @@ class MonitorPositionOffset(
"""Offset for the monitor position, added to base position."""


class CalibratedDetector(sciline.Scope[RunType, sc.DataArray], sc.DataArray):
"""Calibrated data from a detector."""
class EmptyDetector(sciline.Scope[RunType, sc.DataArray], sc.DataArray):
"""Detector without neutron data."""


class CalibratedBeamline(sciline.Scope[RunType, sc.DataArray], sc.DataArray):
"""Calibrated beamline with detector and other components."""
class EmptyMonitor(sciline.Scope[RunType, MonitorType, sc.DataArray], sc.DataArray):
"""Monitor without neutron data."""


class CalibratedMonitor(
sciline.Scope[RunType, MonitorType, sc.DataArray], sc.DataArray
):
"""Calibrated data from a monitor."""


class DetectorData(sciline.Scope[RunType, sc.DataArray], sc.DataArray):
class RawDetector(sciline.Scope[RunType, sc.DataArray], sc.DataArray):
"""Calibrated detector merged with neutron event or histogram data."""


class MonitorData(sciline.Scope[RunType, MonitorType, sc.DataArray], sc.DataArray):
class RawMonitor(sciline.Scope[RunType, MonitorType, sc.DataArray], sc.DataArray):
"""Calibrated monitor merged with neutron event or histogram data."""


Expand Down
Loading
Loading