pyaml.magnet.magnet#
Base interfaces for physical and simulated magnets.
This module defines the common magnet element interface and its access to strength, hardware, and magnet-model information.
Classes
|
Access one magnet of a physical or simulated lattice. |
- class pyaml.magnet.magnet.Magnet(name, model=None, lattice_names=None, description=None)#
Bases:
ElementAccess one magnet of a physical or simulated lattice.
A magnet couples a device to its calibration: the attached
MagnetModelowns the strength to hardware-current conversion and the underlying control-system device names. The same magnet is therefore readable and writable both as a physical strength and as a raw hardware value.- Parameters:
name (str) – Element name.
model (MagnetModel | None, optional) – Magnet model used to convert between strength and hardware value, and to resolve the underlying control-system device names.
lattice_names (str | None, optional) – Name or names of the matching element(s) in the simulated lattice. Defaults to
name.description (str | None, optional) – Human-readable description of the magnet.
Attributes
Read/write accessor for the physical strength, in the model’s strength unit.
Read/write accessor for the hardware value, in the model’s hardware unit.
Magnet model performing the strength to hardware conversion.
Methods
Return a copy of this magnet bound to a control system or simulator.
Set the energy in eV to compute and set the magnet rigidity on the underlying magnet model.
Sets the name of this magnet in the model (Used for combined function magnet)
Returns the model name of this magnet
- attach(peer, strength, hardware)#
Return a copy of this magnet bound to a control system or simulator.
- Parameters:
peer (ElementHolder) – Control system or simulator the copy is bound to.
strength (abstract.ReadWriteFloatScalar) – Accessor for the physical strength on that peer.
hardware (abstract.ReadWriteFloatScalar) – Accessor for the hardware value on that peer.
- Returns:
Self – Copy of this magnet bound to
peer.- Return type:
Self
- get_model_name()#
Returns the model name of this magnet
- set_energy(energy)#
Set the energy in eV to compute and set the magnet rigidity on the underlying magnet model.
- set_model_name(name)#
Sets the name of this magnet in the model (Used for combined function magnet)
- 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 model_name: str#
Name used to identify this magnet in its model.
- property strength: ReadWriteFloatScalar#
Gives access to the strength of this magnet in physics unit