dodal.devices.i10.i10_apple2.I10EnergyMotorLookup#

class dodal.devices.i10.i10_apple2.I10EnergyMotorLookup[source]#
Handles lookup tables for I10 Apple2 ID, converting energy and polarisation to gap

and phase. Fetches and parses lookup tables from a config server, supports dynamic updates, and validates input.

Parameters:
  • lookuptable_dir (str)

  • source (tuple[str, str])

  • config_client (ConfigServer)

  • mode (str, default: 'Mode')

  • min_energy (str, default: 'MinEnergy')

  • max_energy (str, default: 'MaxEnergy')

  • gap_file_name (str, default: 'IDEnergy2GapCalibrations.csv')

  • phase_file_name (str, default: 'IDEnergy2PhaseCalibrations.csv')

  • poly_deg (list | None, default: None)

Initialise the I10EnergyMotorLookup class with lookup table headers provided.

Parameters:
  • look_up_table_dir – The path to look up table.

  • source (tuple[str, str]) – The column name and the name of the source in look up table. e.g. ( “source”, “idu”)

  • config_client (ConfigServer) – The config server client to fetch the look up table.

  • mode (str, default: 'Mode') – The column name of the mode in look up table.

  • min_energy (str, default: 'MinEnergy') – The column name that contain the maximum energy in look up table.

  • max_energy (str, default: 'MaxEnergy') – The column name that contain the maximum energy in look up table.

  • poly_deg (list | None, default: None) – The column names for the parameters for the energy conversion polynomial, starting with the least significant.

  • lookuptable_dir (str)

  • gap_file_name (str, default: 'IDEnergy2GapCalibrations.csv')

  • phase_file_name (str, default: 'IDEnergy2PhaseCalibrations.csv')

Methods

convert_csv_to_lookup(file, source[, mode, ...])

Convert a CSV file to a lookup table dictionary.

get_motor_from_energy(energy, pol)

Convert energy and polarisation to gap and phase motor positions.

update_lookuptable()

Update lookup tables from files and validate their format.

Attributes

available_pol

update_lookuptable()[source]#

Update lookup tables from files and validate their format.

get_motor_from_energy(energy: float, pol: Pol) tuple[float, float][source]#

Convert energy and polarisation to gap and phase motor positions.

Parameters:
  • energy (float) – Desired energy in eV.

  • pol (Pol) – Polarisation mode.

Returns:

(gap, phase) motor positions.

Return type:

tuple[float, float]

convert_csv_to_lookup(file: str, source: tuple[str, str], mode: str | None = 'Mode', min_energy: str | None = 'MinEnergy', max_energy: str | None = 'MaxEnergy', poly_deg: list | None = None) dict[str | None, dict[str, dict[str, dict[str, Any]]]][source]#

Convert a CSV file to a lookup table dictionary.

Returns:

Dictionary in Apple2 lookup table format.

Return type:

dict

Raises:

RuntimeError – If the CSV cannot be converted.

Parameters: