element#

class ElementConfigModel(*, name, description=None, lattice_names=None)[source]#

Bases: BaseModel

Base class for element configuration.

Parameters:
  • name (str) – The name of the PyAML element.

  • description (str, optional) – 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.

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.

description: str | None#
lattice_names: str | None#
name: str#
class Element(name)[source]#

Bases: object

Class providing access to one element of a physical or simulated lattice

name#

str The unique name identifying the element in the configuration file

attached_to()[source]#

Returns a string of which peer the element is attached to.

check_peer()[source]#

Throws an exception if the element is not attacched to a simulator or to a control system

get_description()[source]#

Returns the description of the element

get_lattice_names()[source]#

Returns the name of associated lattice element(s)

get_name()[source]#

Returns the name of the element

post_init()[source]#

Method triggered after all initialisations are done

set_energy(E)[source]#

Set the instrument energy on this element

set_harmonic(h)[source]#

Sets the harmonic number (number of bucket) on this element

set_mcf(alphac)[source]#

Set the instrument moment compaction factor on this element

property peer: ElementHolder#

Returns the peer simulator or control system