accelerator#

Accelerator class

class ConfigModel(*, facility, machine, energy, alphac=None, harmonic_number=None, controls=None, simulators=None, data_folder, description=None, arrays=None, devices)[source]#

Bases: BaseModel

Configuration model for Accelerator

Parameters:
  • facility (str) – Facility name

  • machine (str) – Accelerator name

  • energy (float) – Accelerator nominal energy. For ramped machine, this value can be dynamically set

  • alphac (float, optional) – Moment compaction factor.

  • harmonic_number (int, optional) – Number of bucket

  • controls (list[ControlSystem], optional) – List of control system used. An accelerator can access several control systems

  • simulators (list[Simulator], optional) – Simulator list

  • data_folder (str) – Data folder

  • arrays (list[ArrayConfig], optional) – Element family

  • description (str , optional) – Acceleration description

  • devices (list[.common.element.Element]) – Element list

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.

alphac: float | None#
arrays: list[ArrayConfig]#
controls: list[ControlSystem]#
data_folder: str#
description: str | None#
devices: list[Element]#
energy: float#
facility: str#
harmonic_number: int | None#
machine: str#
simulators: list[Simulator]#
class Accelerator(cfg)[source]#

Bases: object

PyAML top level class

static from_dict(config_dict, ignore_external=False)[source]#

Construct an accelerator from a dictionary.

Parameters:
  • config_dict (str) – Dictionary containing accelerator config

  • ignore_external (bool) – Ignore external modules and return None for object that cannot be created. pydantic schema that support that an object is not created should handle None fields.

static load(filename, use_fast_loader=False, ignore_external=False)[source]#

Load an accelerator from a config file.

Parameters:
  • filename (str) – Configuration file name, yaml or json.

  • use_fast_loader (bool) – Use fast yaml loader. When specified, no line number are reported in case of error, only the element name that triggered the error will be reported in the exception)

  • ignore_external (bool) – Ignore external modules and return None for object that cannot be created. pydantic schema that support that an object is not created should handle None fields.

add_device(config, ignore_external=False)[source]#

Dynamically add a device to this accelerator

config_dictstr

Dictionary containing accelerator config

ignore_external: bool

Ignore external modules and return None for object that cannot be created. pydantic schema that support that an object is not created should handle None fields.

controls()[source]#

Return all registered control modes.

get_description()[source]#

Returns the description of the accelerator

modes()[source]#

Return all registered control and simulator modes.

post_init()[source]#

Method triggered after all initialisations are done

set_energy(E)[source]#

Set the energy for all simulators and control systems.

Parameters:

E (float) – Energy value to set in eV

set_harmonic_number(h)[source]#

Set the number of bucket.

Parameters:

h (int) – Number of bucket

set_mcf(alphac)[source]#

Set the moment compaction factor for all simulators and control systems.

Parameters:

alphac (float) – Moment compaction factor

simulators()[source]#

Return all registered simulator modes.

property design: Simulator#

Get the design simulator.

Returns:

Simulator – The design simulator instance

property live: ControlSystem#

Get the live control system.

Returns:

ControlSystem – The live control system instance

property yellow_pages: YellowPages#