1
1
import abc
2
2
import asyncio
3
3
from dataclasses import dataclass
4
- from typing import Any , Generic , TypeVar
4
+ from typing import Any
5
5
6
6
import numpy as np
7
7
from bluesky .protocols import Movable
21
21
22
22
from dodal .log import LOGGER
23
23
24
- T = TypeVar ("T" )
25
-
26
24
27
25
class UndulatorGateStatus (StrictEnum ):
28
26
OPEN = "Open"
@@ -101,7 +99,7 @@ async def estimate_motor_timeout(
101
99
return abs ((target_pos - cur_pos ) * 2.0 / vel ) + 1
102
100
103
101
104
- class SafeUndulatorMover (StandardReadable , Movable [ T ], Generic [ T ] ):
102
+ class SafeUndulatorMover (StandardReadable , Movable ):
105
103
"""A device that will check it's safe to move the undulator before moving it and
106
104
wait for the undulator to be safe again before calling the move complete.
107
105
"""
@@ -117,7 +115,7 @@ def __init__(self, set_move: SignalW, prefix: str, name: str = ""):
117
115
super ().__init__ (name )
118
116
119
117
@AsyncStatus .wrap
120
- async def set (self , value : T ) -> None :
118
+ async def set (self , value ) -> None :
121
119
LOGGER .info (f"Setting { self .name } to { value } " )
122
120
await self .raise_if_cannot_move ()
123
121
await self ._set_demand_positions (value )
@@ -127,7 +125,7 @@ async def set(self, value: T) -> None:
127
125
await wait_for_value (self .gate , UndulatorGateStatus .CLOSE , timeout = timeout )
128
126
129
127
@abc .abstractmethod
130
- async def _set_demand_positions (self , value : T ) -> None :
128
+ async def _set_demand_positions (self , value ) -> None :
131
129
"""Set the demand positions on the device without actually hitting move."""
132
130
133
131
@abc .abstractmethod
@@ -141,7 +139,7 @@ async def raise_if_cannot_move(self) -> None:
141
139
raise RuntimeError (f"{ self .name } is already in motion." )
142
140
143
141
144
- class UndulatorGap (SafeUndulatorMover [ float ] ):
142
+ class UndulatorGap (SafeUndulatorMover ):
145
143
"""A device with a collection of epics signals to set Apple 2 undulator gap motion.
146
144
Only PV used by beamline are added the full list is here:
147
145
/dls_sw/work/R3.14.12.7/support/insertionDevice/db/IDGapVelocityControl.template
@@ -187,7 +185,7 @@ def __init__(self, prefix: str, name: str = ""):
187
185
self .user_readback = epics_signal_r (float , prefix + "CURRGAPD" )
188
186
super ().__init__ (self .set_move , prefix , name )
189
187
190
- async def _set_demand_positions (self , value : float ) -> None :
188
+ async def _set_demand_positions (self , value ) -> None :
191
189
await self .user_setpoint .set (str (value ))
192
190
193
191
async def get_timeout (self ) -> float :
@@ -236,7 +234,7 @@ def __init__(self, prefix: str, infix: str, name: str = ""):
236
234
super ().__init__ (name = name )
237
235
238
236
239
- class UndulatorPhaseAxes (SafeUndulatorMover [ Apple2PhasesVal ] ):
237
+ class UndulatorPhaseAxes (SafeUndulatorMover ):
240
238
"""
241
239
A collection of 4 phase Motor to make up the full id phase motion. We are using the diamond pv convention.
242
240
e.g. top_outer == Q1
@@ -292,7 +290,7 @@ async def get_timeout(self) -> float:
292
290
return np .max (timeouts )
293
291
294
292
295
- class UndulatorJawPhase (SafeUndulatorMover [ float ] ):
293
+ class UndulatorJawPhase (SafeUndulatorMover ):
296
294
"""
297
295
A JawPhase movable, this is use for moving the jaw phase which is use to control the
298
296
linear arbitrary polarisation but only one some of the beamline.
0 commit comments