tof.Chopper#
- class tof.Chopper(*, frequency, distance, name, phase=None, open=None, close=None, centers=None, widths=None, direction=Direction.CLOCKWISE)[source]#
A chopper is a rotating device with cutouts that blocks the beam at certain times.
- Parameters:
frequency (
Variable) – The frequency of the chopper. Must be positive.distance (
Variable) – The distance from the source to the chopper.name (
str) – The name of the chopper.phase (
Variable|None, default:None) – The phase of the chopper. Because the phase offset implemented as a time delay on real beamline choppers, it is applied in the opposite direction to the chopper rotation direction. For example, if the chopper rotates clockwise, a phase of 10 degrees will shift all window angles by 10 degrees in the anticlockwise direction, which will result in the windows opening later.open (
Variable|None, default:None) – The opening angles of the chopper cutouts.close (
Variable|None, default:None) – The closing angles of the chopper cutouts.centers (
Variable|None, default:None) – The centers of the chopper cutouts.widths (
Variable|None, default:None) – The widths of the chopper cutouts.
Notes
Either open and close or centers and widths must be provided, but not both.
- __init__(*, frequency, distance, name, phase=None, open=None, close=None, centers=None, widths=None, direction=Direction.CLOCKWISE)[source]#
Methods
__init__(*, frequency, distance, name[, ...])as_dict()Return the chopper as a dictionary.
as_json()Return the chopper as a JSON-serializable dictionary.
from_diskchopper(disk_chopper[, name])Create a Chopper from a scippneutron DiskChopper.
from_nexus(nexus_chopper[, name])Create a Chopper from a NeXus chopper group.
open_close_times([time_limit, unit])The times at which the chopper opens and closes.
Export the chopper as a scippneutron DiskChopper.
Attributes
The angular velocity of the chopper.
- classmethod from_diskchopper(disk_chopper, name=None)[source]#
Create a Chopper from a scippneutron DiskChopper.
- Return type:
Example
>>> import scipp as sc >>> import tof >>> from scippneutron.chopper import DiskChopper >>> disk_chopper = DiskChopper( ... frequency=sc.scalar(28.0, unit='Hz'), ... beam_position=sc.scalar(30.0, unit='deg'), ... slit_begin=sc.array( ... dims=['slit'], values=[0.0, 90.0, 150.0], unit='deg' ... ), ... slit_end=sc.array( ... dims=['slit'], values=[60.0, 120.0, 210.0], unit='deg' ... ), ... phase=sc.scalar(15.0, unit='deg'), ... axle_position=sc.vector(value=[0.0, 0.0, 13.0], unit='m'), ... ) >>> chopper = tof.Chopper.from_diskchopper(disk_chopper)
- classmethod from_nexus(nexus_chopper, name=None)[source]#
Create a Chopper from a NeXus chopper group.
- Return type:
Example
>>> # Assuming a chopper NeXus structure >>> import scipp as sc >>> import tof >>> nexus_chopper = { ... 'position': sc.vector([0.0, 0.0, 2.0], unit='m'), ... 'rotation_speed': sc.scalar(12.0, unit='Hz'), ... 'beam_position': sc.scalar(45.0, unit='deg'), ... 'phase': sc.scalar(20.0, unit='deg'), ... 'slit_edges': sc.array( ... dims=['slit'], ... values=[0.0, 60.0, 124.0, 126.0], ... unit='deg', ... ), ... 'slit_height': sc.scalar(0.4, unit='m'), ... 'radius': sc.scalar(0.5, unit='m'), ... } >>> chopper = tof.Chopper.from_nexus(nexus_chopper)
- open_close_times(time_limit=None, unit=None)[source]#
The times at which the chopper opens and closes.
- Parameters:
time_limit (
Variable|None, default:None) – Determines how many rotations the chopper needs to perform to reach the time limit. If not specified, the chopper will perform a single rotation.unit (
str|None, default:None) – The unit of the returned times. If not specified, the unit of time_limit is used.
- Return type: