pyaml.magnet.identity_model#
Identity conversion model for magnets without calibration curves.
This model passes physical values through to hardware values, subject to the configured units and magnetic-rigidity scaling.
Classes
|
Identity magnet model. |
- class pyaml.magnet.identity_model.IdentityMagnetModel(powerconverter=None, physics=None, unit=None)#
Bases:
MagnetModel,DynamicValidationIdentity magnet model.
This model maps magnet strengths directly to hardware values without applying any conversion. It is intended for cases where the physics value and the hardware value are identical, so the model behaves as an identity transform.
- Parameters:
powerconverter (str | None, optional) – Name of the power converter device used to apply current.
physics (str | None, optional) – Name of the physics device used to apply strength.
unit (str | None, optional) – Unit of the magnet strength and hardware value, for example
"1/m"or"m-1".
Methods
Convert magnet strengths to hardware values.
Convert hardware values to magnet strengths.
Return the units of magnet strengths.
Return the units of hardware values.
Return the associated device names.
Set the magnetic rigidity used for conversion.
Return whether the model provides physics strengths.
Return whether the model provides hardware values.
- Raises:
PyAMLException – If both
physicsandpowerconverterare missing, or if both are provided at the same time.
Notes
The model does not perform any numerical conversion: strengths are returned as hardware values and hardware values are returned as strengths.
Configuration
type: pyaml.magnet.identity_model unit: 1/m physics: DEVICE/MAGNET_STRENGTH
- compute_hardware_values(strengths)#
Convert magnet strengths to hardware values.
- Parameters:
strengths (np.array) – Magnet strengths to convert, in the unit reported by
get_strength_unit().- Returns:
np.array – Hardware values corresponding to
strengths.- Return type:
array
- compute_strengths(currents)#
Convert hardware values to magnet strengths.
- Parameters:
currents (np.array) – Hardware values to convert, in the unit reported by
get_hardware_unit().- Returns:
np.array – Strengths corresponding to
currents.- Return type:
array
- get_device_names()#
Return the associated device names.
- get_hardware_units()#
Return the units of hardware values.
- get_strength_units()#
Return the units of magnet strengths.
- has_hardware()#
Return whether the model provides hardware values.
- has_physics()#
Return whether the model provides physics strengths.
- set_magnet_rigidity(brho)#
Set the magnetic rigidity used for conversion.
- Parameters:
brho (np.double) – Magnetic rigidity in tesla metres. Ignored: an identity model applies no rigidity scaling.