pyaml.arrays.bpm_array#

BPM Array module.

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

Classes

BPMArray(arrayName, bpms[, use_aggregator])

Class that implements access to a BPM array.

RWBPMPosition(name, bpms)

Read/write access to BPM positions (horizontal and vertical).

RWBPMSinglePosition(name, bpms, idx)

Read/write access to single axis BPM positions.

class pyaml.arrays.bpm_array.BPMArray(arrayName, bpms, use_aggregator=True)#

Bases: ElementArray

Class that implements access to a BPM array.

Parameters:
  • arrayName (str) – Array name

  • bpms (list[pyaml.bpm.bpm.BPM]) – BPM 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

positions

Returns position of each bpm of this array

h

Returns horizontal position of each bpm of this array

v

Returns vertical position of each bpm of this array

Examples

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

>>> sr = Accelerator.load("acc.yaml") # Load the accelerator
>>> bpms = sr.design.get_bpms("BPM")  # Retrieve BPM array
>>> orbit = bpms.positions.get()      # Get the orbit

or can be created by code using pyaml.arrays.bpm.BPM.

property h: RWBPMSinglePosition#

Returns horizontal position of each bpm of this array

property positions: RWBPMPosition#

Returns position of each bpm of this array

property v: RWBPMSinglePosition#

Returns vertical position of each bpm of this array

class pyaml.arrays.bpm_array.RWBPMPosition(name, bpms)#

Bases: ReadFloatArray

Read/write access to BPM positions (horizontal and vertical).

This class provides access to both horizontal and vertical positions of a list of BPMs. It supports both individual access and aggregated access through a device access list for improved performance.

Parameters:
  • name (str) – Name of the position accessor

  • bpms (list[pyaml.bpm.bpm.BPM]) – List of BPM objects to access

Methods

get()

Get BPM positions.

unit()

Get the units for BPM positions.

set_aggregator()

Set the device access list aggregator for improved performance.

get()#

Get BPM positions.

Returns:

np.array – Array of shape (n_bpms, 2) containing horizontal and vertical positions for each BPM

Return type:

array

set_aggregator(agg)#

Set the device access list aggregator for improved performance.

Parameters:

agg (DeviceAccessList) – Device access list for aggregated reads

unit()#

Get the units for BPM positions.

Returns:

list[str] – List of unit strings for each BPM

Return type:

list[str]

class pyaml.arrays.bpm_array.RWBPMSinglePosition(name, bpms, idx)#

Bases: ReadFloatArray

Read/write access to single axis BPM positions.

This class provides access to either horizontal or vertical positions of a list of BPMs. It supports both individual access and aggregated access through a device access list for improved performance.

Parameters:
  • name (str) – Name of the position accessor

  • bpms (list[pyaml.bpm.bpm.BPM]) – List of BPM objects to access

  • idx (int) – Index for the position axis (0 for horizontal, 1 for vertical)

Methods

get()

Get single axis BPM positions.

unit()

Get the units for BPM positions.

set_aggregator()

Set the device access list aggregator for improved performance.

get()#

Get single axis BPM positions.

Returns:

np.array – Array of positions for the specified axis (horizontal or vertical)

Return type:

array

set_aggregator(agg)#

Set the device access list aggregator for improved performance.

Parameters:

agg (DeviceAccessList) – Device access list for aggregated reads

unit()#

Get the units for BPM positions.

Returns:

list[str] – List of unit strings for each BPM

Return type:

list[str]