spline_model#
- class ConfigModel(*, curve, powerconverter, calibration_factor=1.0, calibration_offset=0.0, crosstalk=1.0, unit, alpha=0.0)[source]#
Bases:
BaseModelConfiguration model for spline magnet model
- Parameters:
curve (Curve) – Curve object used for interpolation
powerconverter (DeviceAccess, optional) – Power converter device to apply current
calibration_factor (float, optional) – Correction factor applied to the curve. Default: 1.0
calibration_offset (float, optional) – Correction offset applied to the curve. Default: 0.0
crosstalk (float, optional) – Crosstalk factor. Default: 1.0
unit (str) – Unit of the strength (i.e. 1/m or m-1)
alpha (float, optional) – Regularization parameter (alpha >= 0). alpha = 0 means the interpolation passes through all the points of the curve. Default: 0.0
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 | None#
- class SplineMagnetModel(cfg)[source]#
Bases:
MagnetModelClass that handle manget current/strength conversion using spline interpolation for a single function magnet
- 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