dodal.devices.apple2_undulator.Apple2#

class dodal.devices.apple2_undulator.Apple2[source]#

Apple2 Undulator Device

The Apple2 class represents an Apple 2 insertion device (undulator) used in synchrotron beamlines. This device provides additional degrees of freedom compared to standard undulators, allowing independent movement of magnet banks to produce X-rays with various polarisations and energies.

The class is designed to manage the undulator’s gap, phase motors, and polarisation settings, while abstracting hardware interactions and providing a high-level interface for beamline operations.

A pair of look up tables are needed to provide the conversion between motor position and energy.

gap#

The gap control device for the undulator.

Type:

UndulatorGap

phase#

The phase control device, consisting of four phase motors.

Type:

UndulatorPhaseAxes

energy#

A soft signal for the current energy readback.

Type:

SignalR

polarisation_setpoint#

A soft signal for the polarisation setpoint.

Type:

SignalR

polarisation#

A hardware-backed signal for polarisation readback and control.

Type:

SignalRW

lookup_tables#

A dictionary storing lookup tables for gap and phase motor positions, used for energy and polarisation conversion.

Type:

dict

_available_pol#

A list of available polarisations supported by the device.

Type:

list

Abstract Methods
----------------
set(value

Abstract method to set motor positions for a given energy and polarisation.

Type:

float) -> None

update_lookuptable None[source]#

Abstract method to load and validate lookup tables from external sources.

_set_pol_setpoint(pol: Pol) None[source]#

Sets the polarisation setpoint without moving hardware.

determine_phase_from_hardware(...) tuple[Pol, float][source]#

Determines the polarisation and phase value based on motor positions.

Notes

  • This class requires beamline-specific implementations of the abstract methods.

  • The lookup tables must follow the Lookuptable format and be validated before use.

  • The device supports multiple polarisation modes, including linear horizontal (LH), linear vertical (LV), positive circular (PC), negative circular (NC), and linear arbitrary (LA).

For more detail see UML for detail.

../../_images/apple2_design.png
Parameters:
  • id_gap (An UndulatorGap device.)

  • id_phase (An UndulatorPhaseAxes device.)

  • prefix (Not in use but needed for device_instantiation.)

  • name (Name of the device.)

  • id_gap

  • id_phase

  • prefix

  • name

Methods

determine_phase_from_hardware(top_outer, ...)

Determine polarisation and phase value using motor position patterns.

set(value)

Set should be in energy units, this will set the energy of the ID by setting the gap and phase motors to the correct position for the given energy and polarisation.

update_lookuptable()

Attributes

abstract set(value: float) None[source]#

Set should be in energy units, this will set the energy of the ID by setting the gap and phase motors to the correct position for the given energy and polarisation. This method should be implemented by the beamline specific ID class as the motor positions will be different for each beamline depending on the undulator design and the lookup table used. _set can be used to set the motor positions for the given energy and polarisation provided that all motors can be moved at the same time.

Examples

>>> RE( id.set(888.0)) # This will set the ID to 888 eV
>>> RE(scan([detector], id,600,700,100)) # This will scan the ID from 600 to 700 eV in 100 steps.
Parameters:

value (float)

Return type:

None

abstract update_lookuptable() None[source]#
Return type:

None

Abstract method to update the stored lookup tabled from file. This function should include check to ensure the lookuptable is in the correct format:

# ensure the importing lookup table is the correct format Lookuptable.model_validate(<loockuptable>)

determine_phase_from_hardware(top_outer: float, top_inner: float, btm_inner: float, btm_outer: float, gap: float) tuple[Pol, float][source]#

Determine polarisation and phase value using motor position patterns. However there is no way to return lh3 polarisation or higher harmonic setting. (May be for future one can use the inverse poly to work out the energy and try to match it with the current energy to workout the polarisation but during my test the inverse poly is too unstable for general use.)

Parameters:
Return type:

tuple[Pol, float]