scippneutron.tof.unwrap#

This module provides functionality for unwrapping raw frames of neutron time-of-flight data.

The module handles standard unwrapping, unwrapping in pulse-skipping mode, and unwrapping for WFM instruments, as well as combinations of the latter two. The functions defined here are meant to be used as providers for a Sciline pipeline. See https://scipp.github.io/sciline/ on how to use Sciline.

Module Attributes

ChopperCascadeFrames

Result of passing the source pulse through the chopper cascade.

Choppers

Choppers used to define the frame parameters.

FrameAtSample

Result of passing the source pulse through the chopper cascade.

FrameAtDetector

Result of passing the source pulse through the chopper cascade to the detector.

CleanFrameAtDetector

Version of the frame at the detector with subframes that do not overlap.

FrameBounds

The computed frame boundaries, used to unwrap the raw timestamps.

FrameForTimeOfFlightOrigin

Frame used to compute the time-of-flight origin.

FramePeriod

The period of a frame, a (small) integer multiple of the source period.

FrameWrappedTimeOffset

Time offsets wrapped around at the frame period.

Ltotal

Total distance between the source and the detector(s).

PulseOffset

Offset from the start of the frame in pulse-skipping mode, multiple of pulse period.

PulsePeriod

Period of the source pulses, i.e., time between consecutive pulse starts.

PulseStride

Stride of used pulses.

PulseWrappedTimeOffset

Time offsets wrapped at the pulse period, typically NXevent_data/event_time_offset.

RawData

Raw detector data loaded from a NeXus file, e.g., NXdetector containing NXevent_data.

SourceChopperName

Name of the chopper defining the source location and time-of-flight time origin.

SourceChopper

Chopper defining the source location and time-of-flight time origin.

SampleDistance

Location of the sample along the incident beam.

SourceTimeRange

Time range of the source pulse, used for computing frame bounds.

SourceWavelengthRange

Wavelength range of the source pulse, used for computing frame bounds.

TimeZero

Time of the start of the most recent pulse, typically NXevent_data/event_time_zero.

UnwrappedData

Detector data with unwrapped time offset and pulse time coordinates.

TimeOfFlightOriginDistance

Distance from the source to the position the time-of-flight origin.

TimeOfFlightOriginTime

Time of the time-of-flight origin for each subframe.

TofData

Detector data with time-of-flight and time zero coordinates.

TimeOffset

Unwrapped time offset relative to the pulse time.

DeltaFromWrapped

Positive delta to be added to the input time offsets to unwrap them.

Functions

chopper_cascade_frames(...)

Return all the chopper frames.

frame_at_detector(frames, ltotal)

Return the frame at the detector.

frame_bounds(frame)

frame_period(pulse_period, pulse_stride)

frame_wrapped_time_offset(offset)

Without pulse-skipping, this is an identity function.

frame_wrapped_time_offset_pulse_skipping(...)

Return the time offset wrapped around at the frame period.

maybe_clip_detector_subframes(frame, ltotal, ...)

Check for time overlap between subframes.

offset_from_wrapped(wrapped_time_offset, ...)

Offset of the input time offsets from the start of the frame emitting the neutron.

pulse_offset(pulse_period, pulse_stride, ...)

Return the offset of a pulse within a frame.

pulse_wrapped_time_offset(da)

In NXevent_data, event_time_offset is the time offset since event_time_zero, which is the start of the most recent pulse.

source_chopper(choppers, source_time_range, ...)

Return the chopper defining the source location and time-of-flight time origin.

time_of_flight_origin_from_chopper(...)

Compute the time-of-flight origin from a source chopper.

time_of_flight_origin_from_choppers_providers([wfm])

Return the providers for computing the time-of-flight origin via the chopper cascade.

time_of_flight_origin_wfm(frames, ...)

Compute the time-of-flight origin in the WFM case.

time_of_flight_providers()

Return the providers computing the time-of-flight and time-zero coordinates.

time_offset(unwrapped)

Extract the time offset coord of the unwrapped input data.

time_zero(da)

In NXevent_data, event_time_zero is the start of the most recent pulse.

to_time_of_flight(da, origin, ltotal)

Return the input data with 'tof', 'time_zero', and corrected 'Ltotal' coordinates.

unwrap_data(da, delta)

Return the input data with unwrapped time offset and pulse time.

unwrap_providers([pulse_skipping])

Return the list of providers for unwrapping frames.

Classes

TimeOfFlightOrigin(time, distance)

The origin of the time-of-flight, time since pulse time and distance from source.