element#
- class ConfigModel(*, name, elements)[source]#
Bases:
ArrayConfigModelConfiguration model for
ElementArray.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 Element(cfg)[source]#
Bases:
ArrayConfigElementArrayconfiguration.Example
An element array configuration can also be created by code using the following example:
from pyaml.arrays.element import Element,ConfigModel as ElementArrayConfigModel elt_cfg = Element( ElementArrayConfigModel(name="MyArray", elements=["BPM_C04-01","SH1A-C04-H"]) )
- fill_array(holder)[source]#
Fill the
ElementArrayusing element holder (SimulatororControlSystem) and add the array to the holder. This method is called when anAcceleratoris loaded but can be used to create arrays by code as shown bellow:>>> elt_cfg.fill_array(sr.design) >>> names = sr.design.get_elements("MyArray").names() >>> print(names) ['BPM_C04-01', 'SH1A-C04-H']
- Parameters:
holder (ElementHolder) – The element holder to populate with element array