Source code for ess.imaging.conversion
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2025 Scipp contributors (https://github.com/scipp)
"""
Contains the providers to compute neutron time-of-flight and wavelength.
"""
import scippneutron as scn
import scippnexus as snx
from .types import (
CoordTransformGraph,
GravityVector,
Position,
RunType,
TofDetector,
WavelengthDetector,
)
[docs]
def compute_detector_wavelength(
tof_data: TofDetector[RunType],
graph: CoordTransformGraph[RunType],
) -> WavelengthDetector[RunType]:
"""
Compute the wavelength of neutrons detected by the detector.
Parameters
----------
tof_data:
Data with a time-of-flight coordinate.
graph:
Graph of coordinate transformations.
"""
return WavelengthDetector[RunType](
tof_data.transform_coords("wavelength", graph=graph)
)
providers = (
make_coordinate_transform_graph,
compute_detector_wavelength,
)
"""Providers to compute neutron time-of-flight and wavelength."""