identity_model#

class ConfigModel(*, powerconverter=None, physics=None, unit)[source]#

Bases: BaseModel

Configuration model for identity magnet model

Parameters:
  • powerconverter (DeviceAccess, optional) – Power converter device to apply current

  • physics (DeviceAccess, optional) – Magnet device to apply strength

  • unit (str) – Unit of the strength (i.e. 1/m or m-1)

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.

physics: DeviceAccess | None#
powerconverter: DeviceAccess | None#
unit: str#
class IdentityMagnetModel(cfg)[source]#

Bases: MagnetModel

Class that map value to underlying device 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