44
55from ophyd_async .core import StrictEnum
66
7- from dodal .common .beamlines .beamline_utils import (
8- device_factory ,
9- )
107from dodal .common .beamlines .beamline_utils import set_beamline as set_utils_beamline
8+ from dodal .device_manager import DeviceManager
119from dodal .devices .i17 .i17_apple2 import I17Apple2Controller
1210from dodal .devices .insertion_device import (
1311 Apple2 ,
3028set_log_beamline (BL )
3129set_utils_beamline (BL )
3230
31+ devices = DeviceManager ()
32+
3333
3434class I17Grating (StrictEnum ):
3535 AU_400 = "400 line/mm Au"
3636 SI_400 = "400 line/mm Si"
3737
3838
39- @device_factory ()
39+ @devices . factory
4040def synchrotron () -> Synchrotron :
4141 return Synchrotron ()
4242
4343
44- @device_factory (skip = True )
44+ @devices . factory (skip = True )
4545def pgm () -> PlaneGratingMonochromator :
4646 return PlaneGratingMonochromator (
4747 prefix = f"{ PREFIX .beamline_prefix } -OP-PGM-01:" ,
@@ -50,12 +50,12 @@ def pgm() -> PlaneGratingMonochromator:
5050 )
5151
5252
53- @device_factory ( )
53+ @devices . factory ( skip = True )
5454def id_gap () -> UndulatorGap :
5555 return UndulatorGap (prefix = f"{ PREFIX .insertion_prefix } -MO-SERVC-01:" )
5656
5757
58- @device_factory ( )
58+ @devices . factory ( skip = True )
5959def id_phase () -> UndulatorPhaseAxes :
6060 return UndulatorPhaseAxes (
6161 prefix = f"{ PREFIX .insertion_prefix } -MO-SERVC-01:" ,
@@ -66,36 +66,44 @@ def id_phase() -> UndulatorPhaseAxes:
6666 )
6767
6868
69- @device_factory (skip = True )
70- def id () -> Apple2 :
71- """I17 insertion device."""
72- return Apple2 (
73- id_gap = id_gap (),
74- id_phase = id_phase (),
69+ @devices .factory (skip = True )
70+ def id (
71+ id_gap : UndulatorGap , id_phase : UndulatorPhaseAxes
72+ ) -> Apple2 [UndulatorPhaseAxes ]:
73+ return Apple2 [UndulatorPhaseAxes ](
74+ id_gap = id_gap ,
75+ id_phase = id_phase ,
7576 )
7677
7778
78- @device_factory (skip = True )
79- def id_controller () -> Apple2Controller :
79+ @devices .factory (skip = True )
80+ def id_controller (
81+ id : Apple2 [UndulatorPhaseAxes ],
82+ ) -> Apple2Controller [Apple2 [UndulatorPhaseAxes ]]:
8083 """I17 insertion device controller with dummy energy to motor_converter."""
8184 return I17Apple2Controller (
82- apple2 = id () ,
85+ apple2 = id ,
8386 gap_energy_motor_lut = EnergyMotorLookup (lut = LookupTable ()),
8487 phase_energy_motor_lut = EnergyMotorLookup (lut = LookupTable ()),
8588 )
8689
8790
88- @device_factory (skip = True )
89- def id_energy () -> InsertionDeviceEnergy :
90- return InsertionDeviceEnergy (id_controller = id_controller ())
91+ @devices .factory (skip = True )
92+ def id_energy (
93+ id_controller : Apple2Controller [Apple2 [UndulatorPhaseAxes ]],
94+ ) -> InsertionDeviceEnergy :
95+ return InsertionDeviceEnergy (id_controller = id_controller )
9196
9297
93- @device_factory (skip = True )
94- def id_polarisation () -> InsertionDevicePolarisation :
95- return InsertionDevicePolarisation (id_controller = id_controller ())
98+ @devices .factory (skip = True )
99+ def id_polarisation (
100+ id_controller : Apple2Controller [Apple2 [UndulatorPhaseAxes ]],
101+ ) -> InsertionDevicePolarisation :
102+ return InsertionDevicePolarisation (id_controller = id_controller )
96103
97104
98- @device_factory (skip = True )
99- def energy () -> BeamEnergy :
100- """Beam energy."""
101- return BeamEnergy (id_energy = id_energy (), mono = pgm ().energy )
105+ @devices .factory (skip = True )
106+ def energy (
107+ id_energy : InsertionDeviceEnergy , pgm : PlaneGratingMonochromator
108+ ) -> BeamEnergy :
109+ return BeamEnergy (id_energy = id_energy , mono = pgm .energy )
0 commit comments