pyaml.common.element#
Base classes for configured accelerator and lattice elements.
Functions
|
Configure the limits used by PyAML object representations. |
Classes
|
Base class for an element in a physical or simulated lattice. |
|
Base class for element configuration. |
|
Limits applied to PyAML object representations. |
- class pyaml.common.element.Element(name, lattice_names=None, description=None)#
Bases:
objectBase class for an element in a physical or simulated lattice.
- Parameters:
name (str) – Unique element name.
lattice_names (str or None, optional) –
Lattice element selector associated with this element. Defaults to
namewhen omitted. A pyAML element can be associated to several lattice elements.Supported syntax of lattice_names:list(name,[name]): Lattice element names[name]@idx[,idx]: Lattice element indices in the subset formed by name.[name]#start_idx..end_idx: Lattice element range in the subset formed by name.In the above syntax, if the name is not specficied, the whole set of lattice element is used for indexing.
namerefers to theFamNameof the lattice elements, or to the attribute configured in the simulator linker when one is used.description (str or None, optional) – Human-readable element description.
Attributes
Return the element name.
Return the lattice selector associated with the element.
Return the element description, if one is configured.
Return the simulator or control system attached to the element.
Methods
Return the element name.
Return the lattice selector associated with the element.
Return the element description, if available.
Set the beam energy used by this element, if supported.
Set the momentum compaction factor, if supported.
Set the RF harmonic number, if supported.
Raise an error if the element is not attached to a peer.
Return a human-readable description of the attached peer.
Perform post-construction initialization after attachment.
- attached_to()#
Return a human-readable description of the attached peer.
- Returns:
str – Peer type and name, or
"None"when unattached.- Return type:
str
- check_peer()#
Raise an error if the element is not attached to a peer.
- Raises:
PyAMLException – If the element is not attached to a simulator or control system.
- get_description()#
Return the element description, if available.
- get_lattice_names()#
Return the lattice selector associated with the element.
- get_name()#
Return the element name.
- post_init()#
Perform post-construction initialization after attachment.
Base elements do not require additional initialization.
- set_energy(E)#
Set the beam energy used by this element, if supported.
- Parameters:
E (float) – Beam energy.
- set_harmonic(h)#
Set the RF harmonic number, if supported.
- Parameters:
h (int) – Number of RF buckets per revolution.
- set_mcf(alphac)#
Set the momentum compaction factor, if supported.
- Parameters:
alphac (float) – Momentum compaction factor.
- property description: str | None#
Return the element description, if one is configured.
- property lattice_names: str#
Return the lattice selector associated with the element.
- property name: str#
Return the element name.
- property peer: ElementHolder#
Return the simulator or control system attached to the element.
- class pyaml.common.element.ElementConfigModel(*, name, description=None, lattice_names=None)#
Bases:
BaseModelBase class for element configuration.
- Parameters:
name (str) – The name of the PyAML element.
description (str, optional) – Human-readable description of the element.
lattice_names (str or None, optional) – The name(s) of the associated element(s) in the lattice. By default, the PyAML element name is used. lattice_name accept the following syntax: - list(name,[name]) : Element names - [name]@idx[,idx] : Element indices in the subset formed by name. - [name]#start_idx..end_idx : Element range in the subset formed by name. In the above syntax, if the name is not specficied, the whole set of lattice element is used for indexing.
namerefers to theFamNameof the lattice elements, or to the attribute configured in the simulator linker when one is used.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pyaml.common.element.ReprOptions(max_items=3, max_depth=2, max_length=800)#
Bases:
objectLimits applied to PyAML object representations.
- pyaml.common.element.set_repr_options(max_items=None, max_depth=None, max_length=None)#
Configure the limits used by PyAML object representations.
Passing no arguments returns the current options. Every supplied value must be a positive integer.