linear_serialized_model#
- class ConfigModel(*, curves, calibration_factors=None, calibration_offsets=None, crosstalk=1.0, powerconverter, unit)[source]#
Bases:
BaseModelConfiguration model for linear serialized magnet model
- Parameters:
curves (Curve or list[Curve]) – Excitation curves, 1 curve for all or 1 curve per magnet
calibration_factors (float or list[float], optional) – Correction factor applied to curves, 1 factor for all or 1 factor per magnet. Default: ones
calibration_offsets (float or list[float], optional) – Correction offset applied to curves, 1 offset for all or 1 offset per magnet. Default: zeros
crosstalk (float or list[float], optional) – Crosstalk factors. Default: 1.0
powerconverter (DeviceAccess) – The hardware can be a single power supply or a list of power supplies. If a list is provided, the same value will be affected to all of them
unit (str) – Strength unit: 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.
- powerconverter: DeviceAccess#
- class LinearSerializedMagnetModel(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