magnet#

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

Bases: ElementConfigModel

Configuration model for magnet elements.

model#

Object in charge of converting magnet strengths to power supply values

Type:

MagnetModel or None, optional

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.

model: MagnetModel | None#
class Magnet(name, model=None)[source]#

Bases: Element

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

Construct a magnet

Parameters:
  • name (str) – Element name

  • model (MagnetModel) – Magnet model in charge of computing coil(s) current

attach(peer, strength, hardware)[source]#

Create a new reference to attach this magnet to a simulator or a control systemand.

get_model_name()[source]#

Returns the model name of this magnet

set_energy(energy)[source]#

Set the energy in eV to compute and set the magnet rigidity on the underlying magnet model.

set_model_name(name)[source]#

Sets the name of this magnet in the model (Used for combined function manget)

property hardware: ReadWriteFloatScalar#

Gives access to the strength of this magnet in hardware unit when possible

property model: MagnetModel#

Returns a handle to the underlying magnet model

property strength: ReadWriteFloatScalar#

Gives access to the strength of this magnet in physics unit