pyaml.arrays.magnet_array#
Magnet Array module.
This module provides magnet array functionality for the PyAML accelerator middle layer.
Classes
|
Class that implements access to a magnet array. |
|
Array accessor for the hardware values of a magnet family. |
|
Array accessor for the strengths of a magnet family. |
- class pyaml.arrays.magnet_array.MagnetArray(arrayName, magnets, use_aggregator=True)#
Bases:
ElementArrayClass 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
Give access to strength of each magnet of this array
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:
ReadWriteFloatArrayArray 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
Return the hardware value of every magnet in the array.
Set the hardware value of every magnet in the array.
Set every hardware value and wait for the readbacks to converge.
Return the hardware unit of every magnet in the array.
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;
Nonerestores 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:
ReadWriteFloatArrayArray 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
Return the strength of every magnet in the array.
Set the strength of every magnet in the array.
Set every strength and wait for the readbacks to converge.
Return the strength unit of every magnet in the array.
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;
Nonerestores 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.