pyaml.tuning_tools.chromaticity#

Chromaticity correction and response-matrix tools.

The Chromaticity tool reads measured chromaticity, computes sextupole strength corrections from a response matrix, and applies those corrections to an accelerator model or control-system interface.

Classes

Chromaticity(name, sextu_array_name, ...)

Adjust horizontal and vertical chromaticity with sextupole strengths.

class pyaml.tuning_tools.chromaticity.Chromaticity(name, sextu_array_name, chromaticity_monitor_name, response_matrix)#

Bases: TuningTool, DynamicValidation

Adjust horizontal and vertical chromaticity with sextupole strengths.

A response matrix maps sextupole-strength changes to chromaticity changes. Its pseudoinverse is used to calculate the strength correction required for a requested chromaticity change.

Parameters:
  • name (str) – Name of the tuning tool.

  • sextu_array_name (str) – Name of the sextupole array used to adjust the chromaticity.

  • chromaticity_monitor_name (str) – Name of the chromaticity monitor used for readback.

  • response_matrix (str | ResponseMatrixData) – Chromaticity response matrix or path to a saved response matrix file.

Attributes

response_matrix

Return the loaded chromaticity response matrix, if available.

chromaticity_monitor

Return the chromaticity monitor used for readback.

sextupoles

Return the sextupole array used for correction.

Methods

load()

Load a chromaticity response matrix and prepare its pseudoinverse.

get()

Return the requested horizontal and vertical chromaticity.

readback()

Measure and return the current horizontal and vertical chromaticity.

set()

Iteratively correct chromaticity to a requested setpoint.

correct()

Calculate sextupole-strength changes for a chromaticity change.

add()

Apply a chromaticity correction relative to the current setpoint.

Configuration

- type: pyaml.tuning_tools.chromaticity
  name: CHROMATICITY_CORRECTION
  sextu_array_name: SEXTUPOLES
  chromaticity_monitor_name: CHROMATICITY_MONITOR
  response_matrix: path/to/chromaticity_response.json
add(dchroma, wait_time=0.0)#

Apply a chromaticity correction relative to the current setpoint.

Parameters:
  • dchroma (numpy.ndarray) – Horizontal and vertical chromaticity change to apply (dimensionless).

  • wait_time (float) – Delay in seconds after changing sextupole strengths.

correct(dchroma)#

Calculate sextupole-strength changes for a chromaticity change.

Parameters:

dchroma (numpy.ndarray) – Desired horizontal and vertical chromaticity change (dimensionless).

Returns:

numpy.ndarray – Sextupole-strength changes obtained from the response-matrix pseudoinverse, in the configured sextupole strength units (typically m^-2).

Raises:

PyAMLException – If no response matrix has been loaded or measured.

Return type:

array

get()#

Return the requested dimensionless horizontal and vertical chromaticity.

load(load_path)#

Load a chromaticity response matrix and prepare its pseudoinverse.

Parameters:

load_path (Path) – Path to the serialized ResponseMatrixData file.

readback()#

Measure and return the current dimensionless horizontal and vertical chromaticity.

set(chroma, iter=1, wait_time=0.0)#

Iteratively correct chromaticity to a requested setpoint.

Parameters:
  • chroma (numpy.ndarray) – Target horizontal and vertical chromaticity values (dimensionless).

  • iter (int) – Number of correction iterations.

  • wait_time (float) – Delay in seconds between correction iterations.

property chromaticity_monitor: ChromaticityMonitor#

Return the chromaticity monitor used for readback.

property response_matrix: ResponseMatrixData | None#

Return the loaded chromaticity response matrix, if available.

property sextupoles: MagnetArray#

Return the sextupole array used for correction.