scippneutron.tof.chopper_cascade.FrameSequence#
- class scippneutron.tof.chopper_cascade.FrameSequence(frames)[source]#
A sequence of frames, created from a single neutron pulse, potentially chopped into subframes by choppers.
It is recommended to use the
from_source_pulse()constructor to create a frame sequence from a source pulse. Then, a chopper cascade can be applied usingchop().- __init__(frames)#
Methods
__init__(frames)Draw a chopper acceptance diagram.
chop(choppers)Chop the frame sequence by a list of choppers.
draw([linewidth, fill, alpha, transpose, ...])Draw frames using matplotlib.
from_source_pulse(time_min, time_max, ...)Initialize a frame sequence from min/max time and wavelength of a pulse.
propagate_to(distance)Propagate the frame sequence to a distance, adding a new frame.
Attributes
frames- acceptance_diagram()[source]#
Draw a chopper acceptance diagram.
See, e.g., J.R.D. Copley, An acceptance diagram analysis of the contaminant pulse removal problem with direct geometry neutron chopper spectrometers, https://doi.org/10.1016/S0168-9002(03)01731-5 for more background.
- chop(choppers)[source]#
Chop the frame sequence by a list of choppers.
The choppers will be sorted by their distance, and applied in order.
- Parameters:
- Returns:
FrameSequence– New frame sequence.
- draw(linewidth=0, fill=True, alpha=None, transpose=False, colors=None, grid=True, title='Frame propagation through chopper cascade', time_unit='ms', wavelength_unit='angstrom')[source]#
Draw frames using matplotlib.
- Parameters:
linewidth (
float, default:0) – Line width of frame edges.fill (
bool, default:True) – Fill frame with color.alpha (
Optional[float], default:None) – Transparency of frame.transpose (
bool, default:False) – Transpose axes.colors (
Optional[list[str]], default:None) – List of colors to use for frames. If None, use default matplotlib colors.grid (
bool, default:True) – Show grid.time_unit (
str, default:'ms') – Unit for time axis. Default is ms.wavelength_unit (
str, default:'angstrom') – Unit for wavelength axis. Default is angstrom.
- Return type:
- static from_source_pulse(time_min, time_max, wavelength_min, wavelength_max)[source]#
Initialize a frame sequence from min/max time and wavelength of a pulse.
The distance is set to 0 m.
- propagate_to(distance)[source]#
Propagate the frame sequence to a distance, adding a new frame.
Use this, e.g., to propagate to the sample position after applying choppers.
- Parameters:
distance (
Variable) – Distance to propagate.- Returns:
FrameSequence– New frame sequence.