This commit is contained in:
gac-x05la
2024-12-10 13:19:13 +01:00
committed by wakonig_k
parent 7969d99135
commit 278800da7e

View File

@ -15,6 +15,7 @@ from ophyd.utils.epics_pvs import AlarmSeverity
class SpmgStates: class SpmgStates:
"""Enum for the EPICS MotorRecord's SPMG state""" """Enum for the EPICS MotorRecord's SPMG state"""
# pylint: disable=too-few-public-methods # pylint: disable=too-few-public-methods
STOP = 0 STOP = 0
PAUSE = 1 PAUSE = 1
@ -29,16 +30,15 @@ class EpicsMotorMR(EpicsMotor):
It extends EpicsMotor base class to provide some simple status checks It extends EpicsMotor base class to provide some simple status checks
before movement. Usage is the same as EpicsMotor. before movement. Usage is the same as EpicsMotor.
""" """
tolerated_alarm = AlarmSeverity.INVALID tolerated_alarm = AlarmSeverity.INVALID
motor_deadband = Component( motor_deadband = Component(EpicsSignalRO, ".RDBD", auto_monitor=True, kind=Kind.config)
EpicsSignalRO, ".RDBD", auto_monitor=True, kind=Kind.config)
motor_mode = Component( motor_mode = Component(
EpicsSignal, ".SPMG", auto_monitor=True, put_complete=True, kind=Kind.omitted) EpicsSignal, ".SPMG", auto_monitor=True, put_complete=True, kind=Kind.omitted
motor_status = Component( )
EpicsSignal, ".STAT", auto_monitor=True, kind=Kind.omitted) motor_status = Component(EpicsSignal, ".STAT", auto_monitor=True, kind=Kind.omitted)
motor_enable = Component( motor_enable = Component(EpicsSignal, ".CNEN", auto_monitor=True, kind=Kind.omitted)
EpicsSignal, ".CNEN", auto_monitor=True, kind=Kind.omitted)
def move(self, position, wait=True, **kwargs) -> MoveStatus: def move(self, position, wait=True, **kwargs) -> MoveStatus:
"""Extended move function with a few sanity checks """Extended move function with a few sanity checks
@ -54,8 +54,7 @@ class EpicsMotorMR(EpicsMotor):
status = self.motor_status.get() status = self.motor_status.get()
if status: if status:
warnings.warn( warnings.warn(
f"EPICS MotorRecord is in alarm state {status}, ophyd will raise", f"EPICS MotorRecord is in alarm state {status}, ophyd will raise", RuntimeWarning
RuntimeWarning
) )
# Warni if trying to move beyond an active limit # Warni if trying to move beyond an active limit
# if self.high_limit_switch and position > self.position: # if self.high_limit_switch and position > self.position:
@ -81,10 +80,12 @@ class EpicsMotorEC(EpicsMotorMR):
It exposes additional diagnostic fields and includes basic error management. It exposes additional diagnostic fields and includes basic error management.
Usage is the same as EpicsMotor. Usage is the same as EpicsMotor.
""" """
USER_ACCESS = ['reset']
USER_ACCESS = ["reset"]
motor_enable_readback = Component(EpicsSignalRO, "-EnaAct", auto_monitor=True, kind=Kind.normal) motor_enable_readback = Component(EpicsSignalRO, "-EnaAct", auto_monitor=True, kind=Kind.normal)
motor_enable = Component( motor_enable = Component(
EpicsSignal, "-EnaCmd-RB", write_pv="-EnaCmd", auto_monitor=True, kind=Kind.normal) EpicsSignal, "-EnaCmd-RB", write_pv="-EnaCmd", auto_monitor=True, kind=Kind.normal
)
homed = Component(EpicsSignalRO, "-Homed", auto_monitor=True, kind=Kind.normal) homed = Component(EpicsSignalRO, "-Homed", auto_monitor=True, kind=Kind.normal)
velocity_readback = Component(EpicsSignalRO, "-VelAct", auto_monitor=True, kind=Kind.normal) velocity_readback = Component(EpicsSignalRO, "-VelAct", auto_monitor=True, kind=Kind.normal)
position_readback = Component(EpicsSignalRO, "-PosAct", auto_monitor=True, kind=Kind.normal) position_readback = Component(EpicsSignalRO, "-PosAct", auto_monitor=True, kind=Kind.normal)