linear_cfm_model#
- class ConfigModel(*, multipoles, curves, calibration_factors=None, calibration_offsets=None, pseudo_factors=None, pseudo_offsets=None, powerconverters, matrix=None, units)[source]#
Bases:
BaseModelConfiguration model for linear combined function magnet model
- Parameters:
multipoles (list[str]) – List of supported functions: A0, B0, A1, B1, etc (i.e. [B0, A1, B2])
curves (list[Curve]) – Excitation curves, 1 curve per function
calibration_factors (list[float], optional) – Correction factor applied to curves, 1 factor per function. Default: ones
calibration_offsets (list[float], optional) – Correction offset applied to curves, 1 offset per function. Default: zeros
pseudo_factors (list[float], optional) – Factors applied to ‘pseudo currents’, 1 factor per function. Default: ones
pseudo_offsets (list[float], optional) – Offsets applied to ‘pseudo currents’, 1 offset per function. Default: zeros
powerconverters (list[DeviceAccess]) – List of power converter devices to apply currents (can be different from number of functions)
matrix (Matrix, optional) – n x m matrix (n rows for n functions, m columns for m currents) to handle multipoles separation. Default: Identity
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.
- powerconverters: list[DeviceAccess | None]#
- class LinearCFMagnetModel(cfg)[source]#
Bases:
MagnetModelClass providing a simple linear model for combined function magnets. A matrix can handle separation of multipoles. A pseudo current is a linear combination of power supply currents associated to a single function.
- 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_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