scippneutron.chopper.disk_chopper.DiskChopper#
- class scippneutron.chopper.disk_chopper.DiskChopper(axle_position, frequency, beam_position, phase, slit_begin, slit_end, slit_height=None, radius=None)[source]#
A disk chopper.
This is a dataclass that encodes parameters of a single disk chopper and provides methods for computing slit opening times.
This class requires that the chopper is in phase with the neutron source and that the rotation frequency is constant. It, therefore, does not accept time-dependent parameters. If your data is time-dependent, you need to select a time range where the chopper is in phase and compute a constant rotation frequency and phase for this range. In particular, the top-dead-center timestamps need to be subsumed by the
phase
together with the source frequency.See also
scippneutron.chopper.disk_chopper
For detailed documentation of the definitions and calculations used by
DiskChopper
.scippneutron.chopper.nexus_chopper.post_process_disk_chopper
A function for converting NeXus chopper data into a supported layout.
- __init__(axle_position, frequency, beam_position, phase, slit_begin, slit_end, slit_height=None, radius=None)#
Methods
__init__
(axle_position, frequency, ...[, ...])from_nexus
(chopper)Construct a new DiskChopper from data loaded from NeXus.
make_svg
([image_size])Generate an SVG image for this chopper.
open_duration
(*, pulse_frequency)Return how long the chopper is open for.
time_offset_angle_at_beam
(*, angle[, ...])Return the time offset when an angle on the chopper is at the beam.
time_offset_close
(*, pulse_frequency)Return the opening time offsets of the chopper slits.
time_offset_open
(*, pulse_frequency)Return the opening time offsets of the chopper slits.
Attributes
Rotation speed as an angular frequency in
rad * frequency.unit
.Return True if the chopper rotates clockwise.
Number of slits.
Radius of the chopper.
Distance from chopper outer edge to bottom of slits.
Position of the chopper.
Rotation frequency of the chopper.
Angle where the beam crosses the chopper.
Phase of the chopper rotation relative to the source pulses.
Begin-edges of the slits as angles measured anticlockwise from top-dead-center.
Begin-edges of the slits as angles measured anticlockwise from top-dead-center.
- property angular_frequency: Variable#
Rotation speed as an angular frequency in
rad * frequency.unit
.
-
axle_position:
Variable
# Position of the chopper.
This is the center point of the chopper’s axle in the face towards the source. See https://manual.nexusformat.org/classes/base_classes/NXdisk_chopper.html
- classmethod from_nexus(chopper)[source]#
Construct a new DiskChopper from data loaded from NeXus.
Keys in the input correspond to the fields of NXdisk_chopper. The values have to be post-processed, e.g., with
post_process_disk_chopper()
. See its documentation for the required steps. Also, note the class docs ofDiskChopper
about time-dependent fields.- Parameters:
chopper (
Mapping
[str
,Variable
|DataArray
]) – Data group with fields loaded from anNXdisk_chopper
and post-processed as described above.- Returns:
DiskChopper
– A newDiskChopper
instance.
- open_duration(*, pulse_frequency)[source]#
Return how long the chopper is open for.
- Parameters:
pulse_frequency; – Frequency of the neutron source.
- Returns:
Variable
– Variable of opening durations.
-
phase:
Variable
# Phase of the chopper rotation relative to the source pulses.
Defined as \(\phi = \omega (t_0 + \delta t - T_0)\), where \(t_0\) is a TDC timestamp, \(\delta t\) is the chopper delay, and \(T_0\) is the pulse time.
-
slit_begin:
Variable
# Begin-edges of the slits as angles measured anticlockwise from top-dead-center.
The order is arbitrary but must match the order of
slit_end
.
-
slit_end:
Variable
# Begin-edges of the slits as angles measured anticlockwise from top-dead-center.
The order is arbitrary but must match the order of
slit_end
.
- time_offset_angle_at_beam(*, angle, n_repetitions=1)[source]#
Return the time offset when an angle on the chopper is at the beam.
The time is an offset from the given pulse time. It encodes the time when the given angle passes by the beam position.
Computes \(\Delta t_g(\theta)\) as defined in
scippneutron.chopper.disk_chopper
.
- time_offset_close(*, pulse_frequency)[source]#
Return the opening time offsets of the chopper slits.
Computes \(\Delta t_g(\theta)\) as defined in
scippneutron.chopper.disk_chopper
with \(\theta\) =slit_end
for clockwise rotation and \(\theta\) =slit_start
otherwise.If the chopper spins at a multiple of the pulse frequency, each slit shows up multiple times in the result such that the array covers an entire pulse length. If the chopper spins slower than the pulse frequency, only one time per slit is returned, but the result covers more than one pulse in time. See the module documentation
scippneutron.chopper.disk_chopper
for details.- Parameters:
pulse_frequency; – Frequency of the neutron source.
- Returns:
Variable
– Variable of opening times as offsets from the pulse time.
- time_offset_open(*, pulse_frequency)[source]#
Return the opening time offsets of the chopper slits.
Computes \(\Delta t_g(\theta)\) as defined in
scippneutron.chopper.disk_chopper
with \(\theta\) =slit_begin
for clockwise rotation and \(\theta\) =slit_end
otherwise.If the chopper spins at a multiple of the pulse frequency, each slit shows up multiple times in the result such that the array covers an entire pulse length. If the chopper spins slower than the pulse frequency, only one time per slit is returned, but the result covers more than one pulse in time. See the module documentation
scippneutron.chopper.disk_chopper
for details.- Parameters:
pulse_frequency; – Frequency of the neutron source.
- Returns:
Variable
– Variable of opening times as offsets from the pulse time.