identity_cfm_model#

class ConfigModel(*, multipoles, powerconverters=None, physics=None, units)[source]#

Bases: BaseModel

Configuration model for identity combined function magnet model

Parameters:
  • multipoles (list[str]) – List of supported functions: A0, B0, A1, B1, etc (i.e. [B0, A1, B2])

  • powerconverters (list[DeviceAccess], optional) – Power converter devices to apply current

  • physics (list[DeviceAccess], optional) – Magnet devices to apply strength

  • units (list[str]) – List of strength units (i.e. [‘rad’, ‘m-1’, ‘m-2’])

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.

multipoles: list[str]#
physics: list[DeviceAccess | None] | None#
powerconverters: list[DeviceAccess | None] | None#
units: list[str]#
class IdentityCFMagnetModel(cfg)[source]#

Bases: MagnetModel

Class that map values to underlying devices without conversion

compute_hardware_values(strengths)[source]#

Compute hardware value(s) from magnet strength(s)

Parameters:

strengths (npt.NDArray[np.float64]) – Array of strengths. For a single multipole, strengths is an array of 1 item.

Returns:

npt.NDArray[np.float64] – Array of hardware values (i.e. currents or voltages).

compute_strengths(currents)[source]#

Compute magnet strength(s) from hardware value(s)

Parameters:

hardware_values (npt.NDArray[np.float64]) – Array of hardware values (i.e. currents or voltages)

Returns:

npt.NDArray[np.float64] – Array of strengths. For a single multipole, returns an array of 1 item

get_devices()[source]#

Get device handles

Returns:

list[DeviceAccess] – Array of DeviceAcess

get_hardware_units()[source]#

Get hardware units

Returns:

list[str] – Array of hardware units. For a single multipole, returns a list of 1 item

get_strength_units()[source]#

Get strength units

Returns:

list[str] – Array of strength units. For a single multipole, returns a list of 1 item

has_hardware()[source]#

Tells if the model allows to work in hardware unit.

Returns:

bool – True if the model supports hardware unit

has_physics()[source]#

Tells if the model allows to work in physics unit.

Returns:

bool – True if the model supports physics unit

set_magnet_rigidity(brho)[source]#

Set magnet rigidity

Parameters:

brho (np.double) – Magnet rigidity used to calculate power supply setpoints