bpm#

class ConfigModel(*, name, elements)[source]#

Bases: ArrayConfigModel

Configuration model for BPMArray.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

class BPM(cfg)[source]#

Bases: ArrayConfig

BPMArray configuration.

Example

Here is an example using a yaml configuration file:

arrays:                    # Global array section
- type: pyaml.arrays.bpm   # Type of array
    name: BPM              # Name of the array
    elements:              # Element names
    - BPM_C04-01
    - BPM_C04-02
    - BPM_C04-03

A BPMArray configuration can also be created by code using the following example:

>>>  from pyaml.arrays.bpm import BPM,ConfigModel as BPMArrayConfigModel
>>>  bpm_cfg = BPM(BPMArrayConfigModel(
                name="BPM",
                elements=["BPM_C04-01","BPM_C04-02","BPM_C04-03"]
               ))
fill_array(holder)[source]#

Fill the BPMArray using element holder (Simulator or ControlSystem) and add the array to the holder. This method is called when an Accelerator is loaded but can be used to create arrays by code as shown bellow:

>>> bpm_cfg.fill_array(sr.design) # For arrays created on the fly
>>> orbit = sr.design.get_bpms("BPM").positions.get()
>>> print(orbit)
[[ 6.02736506e-10  0.00000000e+00]
 [-3.06292158e-08  0.00000000e+00]
 [-2.80366116e-08  0.00000000e+00]]
Parameters:

holder (ElementHolder) – The element holder to populate the BPMArray with.