pyaml.arrays.magnet_array#

Magnet Array module.

This module provides magnet array functionality for the PyAML accelerator middle layer.

Classes

MagnetArray(arrayName, magnets[, use_aggregator])

Class that implements access to a magnet array.

RWMagnetHardware(name, magnets)

Array accessor for the hardware values of a magnet family.

RWMagnetStrength(name, magnets)

Array accessor for the strengths of a magnet family.

class pyaml.arrays.magnet_array.MagnetArray(arrayName, magnets, use_aggregator=True)#

Bases: ElementArray

Class that implements access to a magnet array.

Parameters:
  • arrayName (str) – Array name

  • magnets (list[Magnet]) – Magnet list, all elements must be attached to the same instance of either a Simulator or a ControlSystem.

  • use_aggregator (bool) – Use aggregator to increase performance by using parallel access to underlying devices.

Attributes

strengths

Give access to strength of each magnet of this array

hardwares

Give access to hardware value of each magnet of this array

Examples

An array can be retrieved from the configuration as in the following example:

sr = Accelerator.load("acc.yaml")
quads = sr.design.get_magnets("QuadForTune")
property hardwares: RWMagnetHardware#

Give access to hardware value of each magnet of this array

property strengths: RWMagnetStrength#

Give access to strength of each magnet of this array

class pyaml.arrays.magnet_array.RWMagnetHardware(name, magnets)#

Bases: ReadWriteFloatArray

Array accessor for the hardware values of a magnet family.

Parameters:
  • name (str) – Name of the array, used when the accessor is reported or logged.

  • magnets (list[Magnet]) – Magnets making up the array, in the order their values are read and written.

Methods

get()

Return the hardware value of every magnet in the array.

set()

Set the hardware value of every magnet in the array.

set_and_wait()

Set every hardware value and wait for the readbacks to converge.

unit()

Return the hardware unit of every magnet in the array.

set_aggregator()

Install an aggregator so the array is read and written in a single call.

get()#

Return the hardware value of every magnet in the array.

set(value)#

Set the hardware value of every magnet in the array.

Parameters:

value (np.array) – Hardware value for each magnet, ordered like the array. A scalar is broadcast to every magnet.

set_aggregator(agg)#

Install an aggregator so the array is read and written in a single call.

Parameters:

agg (ScalarAggregator) – Aggregator performing grouped device access. Only available on the control-system side; None restores per-magnet access.

set_and_wait(value)#

Set every hardware value and wait for the readbacks to converge.

Parameters:

value (np.array) – Hardware value for each magnet, ordered like the array. A scalar is broadcast to every magnet.

Raises:

NotImplementedError – Waiting for readback convergence is not implemented for this accessor.

unit()#

Return the hardware unit of every magnet in the array.

class pyaml.arrays.magnet_array.RWMagnetStrength(name, magnets)#

Bases: ReadWriteFloatArray

Array accessor for the strengths of a magnet family.

Parameters:
  • name (str) – Name of the array, used when the accessor is reported or logged.

  • magnets (list[Magnet]) – Magnets making up the array, in the order their values are read and written.

Methods

get()

Return the strength of every magnet in the array.

set()

Set the strength of every magnet in the array.

set_and_wait()

Set every strength and wait for the readbacks to converge.

unit()

Return the strength unit of every magnet in the array.

set_aggregator()

Install an aggregator so the array is read and written in a single call.

get()#

Return the strength of every magnet in the array.

set(value)#

Set the strength of every magnet in the array.

Parameters:

value (np.array) – Strength for each magnet, ordered like the array. A scalar is broadcast to every magnet.

set_aggregator(agg)#

Install an aggregator so the array is read and written in a single call.

Parameters:

agg (ScalarAggregator) – Aggregator performing grouped device access. Only available on the control-system side; None restores per-magnet access.

set_and_wait(value)#

Set every strength and wait for the readbacks to converge.

Parameters:

value (np.array) – Strength for each magnet, ordered like the array. A scalar is broadcast to every magnet.

Raises:

NotImplementedError – Waiting for readback convergence is not implemented for this accessor.

unit()#

Return the strength unit of every magnet in the array.