dls-dodal 1.38.0__py3-none-any.whl → 1.40.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. {dls_dodal-1.38.0.dist-info → dls_dodal-1.40.0.dist-info}/METADATA +2 -2
  2. {dls_dodal-1.38.0.dist-info → dls_dodal-1.40.0.dist-info}/RECORD +49 -40
  3. dodal/_version.py +2 -2
  4. dodal/beamlines/__init__.py +2 -0
  5. dodal/beamlines/adsim.py +3 -2
  6. dodal/beamlines/b01_1.py +3 -3
  7. dodal/beamlines/i03.py +144 -285
  8. dodal/beamlines/i04.py +112 -198
  9. dodal/beamlines/i13_1.py +5 -4
  10. dodal/beamlines/i18.py +124 -0
  11. dodal/beamlines/i19_1.py +74 -0
  12. dodal/beamlines/i19_2.py +61 -0
  13. dodal/beamlines/i20_1.py +37 -22
  14. dodal/beamlines/i22.py +7 -7
  15. dodal/beamlines/i24.py +100 -145
  16. dodal/beamlines/p38.py +12 -8
  17. dodal/beamlines/p45.py +5 -4
  18. dodal/beamlines/training_rig.py +4 -4
  19. dodal/common/beamlines/beamline_utils.py +2 -3
  20. dodal/common/beamlines/device_helpers.py +3 -1
  21. dodal/devices/aperturescatterguard.py +150 -64
  22. dodal/devices/apple2_undulator.py +86 -113
  23. dodal/devices/eiger.py +24 -14
  24. dodal/devices/fast_grid_scan.py +29 -20
  25. dodal/devices/hutch_shutter.py +25 -12
  26. dodal/devices/i04/transfocator.py +22 -29
  27. dodal/devices/i10/rasor/rasor_scaler_cards.py +4 -4
  28. dodal/devices/i13_1/merlin.py +4 -3
  29. dodal/devices/i13_1/merlin_controller.py +2 -7
  30. dodal/devices/i18/KBMirror.py +19 -0
  31. dodal/devices/i18/diode.py +17 -0
  32. dodal/devices/i18/table.py +14 -0
  33. dodal/devices/i18/thor_labs_stage.py +12 -0
  34. dodal/devices/i19/__init__.py +0 -0
  35. dodal/devices/i19/shutter.py +57 -0
  36. dodal/devices/i22/nxsas.py +4 -4
  37. dodal/devices/motors.py +2 -2
  38. dodal/devices/oav/oav_detector.py +10 -19
  39. dodal/devices/pressure_jump_cell.py +33 -16
  40. dodal/devices/robot.py +30 -11
  41. dodal/devices/tetramm.py +8 -3
  42. dodal/devices/turbo_slit.py +7 -6
  43. dodal/devices/zocalo/zocalo_results.py +21 -4
  44. dodal/plans/save_panda.py +30 -14
  45. dodal/utils.py +54 -15
  46. {dls_dodal-1.38.0.dist-info → dls_dodal-1.40.0.dist-info}/LICENSE +0 -0
  47. {dls_dodal-1.38.0.dist-info → dls_dodal-1.40.0.dist-info}/WHEEL +0 -0
  48. {dls_dodal-1.38.0.dist-info → dls_dodal-1.40.0.dist-info}/entry_points.txt +0 -0
  49. {dls_dodal-1.38.0.dist-info → dls_dodal-1.40.0.dist-info}/top_level.txt +0 -0
dodal/beamlines/i03.py CHANGED
@@ -2,6 +2,7 @@ from ophyd_async.fastcs.panda import HDFPanda
2
2
 
3
3
  from dodal.common.beamlines.beamline_parameters import get_beamline_parameters
4
4
  from dodal.common.beamlines.beamline_utils import (
5
+ device_factory,
5
6
  device_instantiation,
6
7
  get_path_provider,
7
8
  set_path_provider,
@@ -17,7 +18,6 @@ from dodal.devices.attenuator.attenuator import BinaryFilterAttenuator
17
18
  from dodal.devices.backlight import Backlight
18
19
  from dodal.devices.cryostream import CryoStream
19
20
  from dodal.devices.dcm import DCM
20
- from dodal.devices.detector import DetectorParams
21
21
  from dodal.devices.detector.detector_motion import DetectorMotion
22
22
  from dodal.devices.diamond_filter import DiamondFilter, I03Filters
23
23
  from dodal.devices.eiger import EigerDetector
@@ -49,7 +49,7 @@ from dodal.devices.zebra.zebra_constants_mapping import (
49
49
  from dodal.devices.zebra.zebra_controlled_shutter import ZebraShutter
50
50
  from dodal.devices.zocalo import ZocaloResults
51
51
  from dodal.log import set_beamline as set_log_beamline
52
- from dodal.utils import BeamlinePrefix, get_beamline_name, skip_device
52
+ from dodal.utils import BeamlinePrefix, get_beamline_name
53
53
 
54
54
  ZOOM_PARAMS_FILE = (
55
55
  "/dls_sw/i03/software/gda/configurations/i03-config/xml/jCameraManZoomLevels.xml"
@@ -69,81 +69,59 @@ I03_ZEBRA_MAPPING = ZebraMapping(
69
69
  AND_GATE_FOR_AUTO_SHUTTER=2,
70
70
  )
71
71
 
72
+ PREFIX = BeamlinePrefix(BL)
72
73
 
73
- def aperture_scatterguard(
74
- wait_for_connection: bool = True,
75
- fake_with_ophyd_sim: bool = False,
76
- ) -> ApertureScatterguard:
74
+
75
+ @device_factory()
76
+ def aperture_scatterguard() -> ApertureScatterguard:
77
77
  """Get the i03 aperture and scatterguard device, instantiate it if it hasn't already
78
78
  been. If this is called when already instantiated in i03, it will return the existing
79
79
  object.
80
80
  """
81
81
  params = get_beamline_parameters()
82
- return device_instantiation(
83
- device_factory=ApertureScatterguard,
84
- name="aperture_scatterguard",
85
- prefix="",
86
- wait=wait_for_connection,
87
- fake=fake_with_ophyd_sim,
82
+ return ApertureScatterguard(
83
+ prefix=PREFIX.beamline_prefix,
88
84
  loaded_positions=load_positions_from_beamline_parameters(params),
89
85
  tolerances=AperturePosition.tolerances_from_gda_params(params),
90
86
  )
91
87
 
92
88
 
93
- def attenuator(
94
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
95
- ) -> BinaryFilterAttenuator:
89
+ @device_factory()
90
+ def attenuator() -> BinaryFilterAttenuator:
96
91
  """Get the i03 attenuator device, instantiate it if it hasn't already been.
97
92
  If this is called when already instantiated in i03, it will return the existing object.
98
93
  """
99
- return device_instantiation(
100
- BinaryFilterAttenuator,
101
- "attenuator",
102
- "-EA-ATTN-01:",
103
- wait_for_connection,
104
- fake_with_ophyd_sim,
105
- )
94
+ return BinaryFilterAttenuator(f"{PREFIX.beamline_prefix}-EA-ATTN-01:")
106
95
 
107
96
 
108
- def beamstop(
109
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
110
- ) -> Beamstop:
97
+ @device_factory()
98
+ def beamstop() -> Beamstop:
111
99
  """Get the i03 beamstop device, instantiate it if it hasn't already been.
112
100
  If this is called when already instantiated in i03, it will return the existing object.
113
101
  """
114
- return device_instantiation(
115
- Beamstop,
116
- "beamstop",
117
- "-MO-BS-01:",
118
- wait_for_connection,
119
- fake_with_ophyd_sim,
102
+ return Beamstop(
103
+ prefix=f"{PREFIX.beamline_prefix}-MO-BS-01:",
104
+ name="beamstop",
120
105
  beamline_parameters=get_beamline_parameters(),
121
106
  )
122
107
 
123
108
 
124
- def dcm(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) -> DCM:
109
+ @device_factory()
110
+ def dcm() -> DCM:
125
111
  """Get the i03 DCM device, instantiate it if it hasn't already been.
126
112
  If this is called when already instantiated in i03, it will return the existing object.
127
113
  """
128
- return device_instantiation(
129
- DCM,
114
+ return DCM(
115
+ f"{PREFIX.beamline_prefix}-MO-DCM-01:",
130
116
  "dcm",
131
- "-MO-DCM-01:",
132
- wait_for_connection,
133
- fake_with_ophyd_sim,
134
117
  )
135
118
 
136
119
 
137
- @skip_device(lambda: BL == "s03")
138
- def vfm(
139
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
140
- ) -> FocusingMirrorWithStripes:
141
- return device_instantiation(
142
- device_factory=FocusingMirrorWithStripes,
120
+ @device_factory(skip=BL == "s03")
121
+ def vfm() -> FocusingMirrorWithStripes:
122
+ return FocusingMirrorWithStripes(
123
+ prefix=f"{PREFIX.beamline_prefix}-OP-VFM-01:",
143
124
  name="vfm",
144
- prefix="-OP-VFM-01:",
145
- wait=wait_for_connection,
146
- fake=fake_with_ophyd_sim,
147
125
  bragg_to_lat_lut_path=DAQ_CONFIGURATION_PATH
148
126
  + "/lookup/BeamLineEnergy_DCM_VFM_x_converter.txt",
149
127
  x_suffix="LAT",
@@ -151,429 +129,310 @@ def vfm(
151
129
  )
152
130
 
153
131
 
154
- @skip_device(lambda: BL == "s03")
155
- def mirror_voltages(
156
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
157
- ) -> MirrorVoltages:
158
- return device_instantiation(
159
- device_factory=MirrorVoltages,
132
+ @device_factory(skip=BL == "s03")
133
+ def mirror_voltages() -> MirrorVoltages:
134
+ return MirrorVoltages(
160
135
  name="mirror_voltages",
161
- prefix="-MO-PSU-01:",
162
- wait=wait_for_connection,
163
- fake=fake_with_ophyd_sim,
136
+ prefix=f"{PREFIX.beamline_prefix}-MO-PSU-01:",
164
137
  daq_configuration_path=DAQ_CONFIGURATION_PATH,
165
138
  )
166
139
 
167
140
 
168
- def backlight(
169
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
170
- ) -> Backlight:
141
+ @device_factory()
142
+ def backlight() -> Backlight:
171
143
  """Get the i03 backlight device, instantiate it if it hasn't already been.
172
144
  If this is called when already instantiated in i03, it will return the existing object.
173
145
  """
174
- return device_instantiation(
175
- device_factory=Backlight,
176
- name="backlight",
177
- prefix="",
178
- wait=wait_for_connection,
179
- fake=fake_with_ophyd_sim,
180
- )
146
+ return Backlight(prefix=PREFIX.beamline_prefix, name="backlight")
181
147
 
182
148
 
183
- @skip_device(lambda: BL == "s03")
184
- def detector_motion(
185
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
186
- ) -> DetectorMotion:
149
+ @device_factory(skip=BL == "s03")
150
+ def detector_motion() -> DetectorMotion:
187
151
  """Get the i03 detector motion device, instantiate it if it hasn't already been.
188
152
  If this is called when already instantiated in i03, it will return the existing object.
189
153
  """
190
- return device_instantiation(
191
- device_factory=DetectorMotion,
154
+ return DetectorMotion(
155
+ prefix=PREFIX.beamline_prefix,
192
156
  name="detector_motion",
193
- prefix="",
194
- wait=wait_for_connection,
195
- fake=fake_with_ophyd_sim,
196
157
  )
197
158
 
198
159
 
199
- @skip_device(lambda: BL == "s03")
200
- def eiger(
201
- wait_for_connection: bool = True,
202
- fake_with_ophyd_sim: bool = False,
203
- params: DetectorParams | None = None,
204
- ) -> EigerDetector:
160
+ @device_factory(skip=BL == "s03")
161
+ def eiger(mock: bool = False) -> EigerDetector:
205
162
  """Get the i03 Eiger device, instantiate it if it hasn't already been.
206
163
  If this is called when already instantiated in i03, it will return the existing object.
207
- If called with params, will update those params to the Eiger object.
208
164
  """
209
165
 
210
- def set_params(eiger: EigerDetector):
211
- if params is not None:
212
- eiger.set_detector_parameters(params)
213
-
214
166
  return device_instantiation(
215
167
  device_factory=EigerDetector,
216
168
  name="eiger",
217
169
  prefix="-EA-EIGER-01:",
218
- wait=wait_for_connection,
219
- fake=fake_with_ophyd_sim,
220
- post_create=set_params,
170
+ wait=False,
171
+ fake=mock,
221
172
  )
222
173
 
223
174
 
224
- def zebra_fast_grid_scan(
225
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
226
- ) -> ZebraFastGridScan:
175
+ @device_factory()
176
+ def zebra_fast_grid_scan() -> ZebraFastGridScan:
227
177
  """Get the i03 zebra_fast_grid_scan device, instantiate it if it hasn't already been.
228
178
  If this is called when already instantiated in i03, it will return the existing object.
229
179
  """
230
- return device_instantiation(
231
- device_factory=ZebraFastGridScan,
180
+ return ZebraFastGridScan(
181
+ prefix=f"{PREFIX.beamline_prefix}-MO-SGON-01:",
232
182
  name="zebra_fast_grid_scan",
233
- prefix="-MO-SGON-01:",
234
- wait=wait_for_connection,
235
- fake=fake_with_ophyd_sim,
236
183
  )
237
184
 
238
185
 
239
- def panda_fast_grid_scan(
240
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
241
- ) -> PandAFastGridScan:
186
+ @device_factory()
187
+ def panda_fast_grid_scan() -> PandAFastGridScan:
242
188
  """Get the i03 panda_fast_grid_scan device, instantiate it if it hasn't already been.
243
189
  If this is called when already instantiated in i03, it will return the existing object.
244
190
  This is used instead of the zebra_fast_grid_scan device when using the PandA.
245
191
  """
246
- return device_instantiation(
247
- device_factory=PandAFastGridScan,
192
+ return PandAFastGridScan(
193
+ prefix=f"{PREFIX.beamline_prefix}-MO-SGON-01:",
248
194
  name="panda_fast_grid_scan",
249
- prefix="-MO-SGON-01:",
250
- wait=wait_for_connection,
251
- fake=fake_with_ophyd_sim,
252
195
  )
253
196
 
254
197
 
255
- @skip_device(lambda: BL == "s03")
198
+ @device_factory(skip=BL == "s03")
256
199
  def oav(
257
- wait_for_connection: bool = True,
258
- fake_with_ophyd_sim: bool = False,
259
200
  params: OAVConfig | None = None,
260
201
  ) -> OAV:
261
202
  """Get the i03 OAV device, instantiate it if it hasn't already been.
262
203
  If this is called when already instantiated in i03, it will return the existing object.
263
204
  """
264
- return device_instantiation(
265
- OAV,
266
- "oav",
267
- "-DI-OAV-01:",
268
- wait_for_connection,
269
- fake_with_ophyd_sim,
205
+ return OAV(
206
+ prefix=f"{PREFIX.beamline_prefix}-DI-OAV-01:",
207
+ name="oav",
270
208
  config=params or OAVConfig(ZOOM_PARAMS_FILE, DISPLAY_CONFIG),
271
209
  )
272
210
 
273
211
 
274
- @skip_device(lambda: BL == "s03")
275
- def pin_tip_detection(
276
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
277
- ) -> PinTipDetection:
212
+ @device_factory(skip=BL == "s03")
213
+ def pin_tip_detection() -> PinTipDetection:
278
214
  """Get the i03 pin tip detection device, instantiate it if it hasn't already been.
279
215
  If this is called when already instantiated in i03, it will return the existing object.
280
216
  """
281
- return device_instantiation(
282
- PinTipDetection,
217
+ return PinTipDetection(
218
+ f"{PREFIX.beamline_prefix}-DI-OAV-01:",
283
219
  "pin_tip_detection",
284
- "-DI-OAV-01:",
285
- wait_for_connection,
286
- fake_with_ophyd_sim,
287
220
  )
288
221
 
289
222
 
290
- def smargon(
291
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
292
- ) -> Smargon:
223
+ @device_factory()
224
+ def smargon() -> Smargon:
293
225
  """Get the i03 Smargon device, instantiate it if it hasn't already been.
294
226
  If this is called when already instantiated in i03, it will return the existing object.
295
227
  """
296
- return device_instantiation(
297
- Smargon,
298
- "smargon",
299
- "-MO-SGON-01:",
300
- wait_for_connection,
301
- fake_with_ophyd_sim,
302
- )
228
+ return Smargon(f"{PREFIX.beamline_prefix}-MO-SGON-01:", "smargon")
303
229
 
304
230
 
305
- def s4_slit_gaps(
306
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
307
- ) -> S4SlitGaps:
231
+ @device_factory()
232
+ def s4_slit_gaps() -> S4SlitGaps:
308
233
  """Get the i03 s4_slit_gaps device, instantiate it if it hasn't already been.
309
234
  If this is called when already instantiated in i03, it will return the existing object.
310
235
  """
311
- return device_instantiation(
312
- S4SlitGaps,
236
+ return S4SlitGaps(
237
+ f"{PREFIX.beamline_prefix}-AL-SLITS-04:",
313
238
  "s4_slit_gaps",
314
- "-AL-SLITS-04:",
315
- wait_for_connection,
316
- fake_with_ophyd_sim,
317
239
  )
318
240
 
319
241
 
320
- @skip_device(lambda: BL == "s03")
321
- def synchrotron(
322
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
323
- ) -> Synchrotron:
242
+ @device_factory(skip=BL == "s03")
243
+ def synchrotron() -> Synchrotron:
324
244
  """Get the i03 synchrotron device, instantiate it if it hasn't already been.
325
245
  If this is called when already instantiated in i03, it will return the existing object.
326
246
  """
327
- return device_instantiation(
328
- Synchrotron,
329
- "synchrotron",
330
- "",
331
- wait_for_connection,
332
- fake_with_ophyd_sim,
333
- bl_prefix=False,
334
- )
247
+ return Synchrotron("", "synchrotron")
335
248
 
336
249
 
337
- def undulator(
338
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
339
- ) -> Undulator:
250
+ @device_factory()
251
+ def undulator(daq_configuration_path: str | None = None) -> Undulator:
340
252
  """Get the i03 undulator device, instantiate it if it hasn't already been.
341
253
  If this is called when already instantiated in i03, it will return the existing object.
342
254
  """
343
- return device_instantiation(
344
- Undulator,
345
- "undulator",
255
+ return Undulator(
346
256
  f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-01:",
347
- wait_for_connection,
348
- fake_with_ophyd_sim,
349
- bl_prefix=False,
350
- id_gap_lookup_table_path="/dls_sw/i03/software/daq_configuration/lookup/BeamLine_Undulator_toGap.txt",
257
+ name="undulator",
258
+ # evaluate here not as parameter default to enable post-import mocking
259
+ id_gap_lookup_table_path=f"{daq_configuration_path or DAQ_CONFIGURATION_PATH}/lookup/BeamLine_Undulator_toGap.txt",
351
260
  )
352
261
 
353
262
 
354
- def undulator_dcm(
355
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
356
- ) -> UndulatorDCM:
263
+ @device_factory()
264
+ def undulator_dcm(daq_configuration_path: str | None = None) -> UndulatorDCM:
357
265
  """Get the i03 undulator DCM device, instantiate it if it hasn't already been.
358
266
  If this is called when already instantiated in i03, it will return the existing object.
359
267
  """
360
- return device_instantiation(
361
- UndulatorDCM,
268
+ # evaluate here not as parameter default to enable post-import mocking
269
+ undulator_singleton = (
270
+ undulator(daq_configuration_path=daq_configuration_path)
271
+ if daq_configuration_path and daq_configuration_path != DAQ_CONFIGURATION_PATH
272
+ else undulator()
273
+ )
274
+ return UndulatorDCM(
362
275
  name="undulator_dcm",
363
- prefix="",
364
- wait=wait_for_connection,
365
- fake=fake_with_ophyd_sim,
366
- undulator=undulator(wait_for_connection, fake_with_ophyd_sim),
367
- dcm=dcm(wait_for_connection, fake_with_ophyd_sim),
368
- daq_configuration_path=DAQ_CONFIGURATION_PATH,
276
+ prefix=PREFIX.beamline_prefix,
277
+ undulator=undulator_singleton,
278
+ dcm=dcm(),
279
+ daq_configuration_path=daq_configuration_path or DAQ_CONFIGURATION_PATH,
369
280
  )
370
281
 
371
282
 
372
- def zebra(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) -> Zebra:
283
+ @device_factory()
284
+ def zebra() -> Zebra:
373
285
  """Get the i03 zebra device, instantiate it if it hasn't already been.
374
286
  If this is called when already instantiated in i03, it will return the existing object.
375
287
  """
376
- return device_instantiation(
377
- Zebra,
378
- "zebra",
379
- "-EA-ZEBRA-01:",
380
- wait_for_connection,
381
- fake_with_ophyd_sim,
288
+ return Zebra(
289
+ name="zebra",
290
+ prefix=f"{PREFIX.beamline_prefix}-EA-ZEBRA-01:",
382
291
  mapping=I03_ZEBRA_MAPPING,
383
292
  )
384
293
 
385
294
 
386
- def xspress3mini(
387
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
388
- ) -> Xspress3:
295
+ @device_factory()
296
+ def xspress3mini() -> Xspress3:
389
297
  """Get the i03 Xspress3Mini device, instantiate it if it hasn't already been.
390
298
  If this is called when already instantiated in i03, it will return the existing object.
391
299
  """
392
- return device_instantiation(
393
- Xspress3,
300
+ return Xspress3(
301
+ f"{PREFIX.beamline_prefix}-EA-XSP3-01:",
394
302
  "xspress3mini",
395
- "-EA-XSP3-01:",
396
- wait_for_connection,
397
- fake_with_ophyd_sim,
398
303
  )
399
304
 
400
305
 
401
- def panda(
402
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
403
- ) -> HDFPanda:
306
+ @device_factory()
307
+ def panda() -> HDFPanda:
404
308
  """Get the i03 panda device, instantiate it if it hasn't already been.
405
309
  If this is called when already instantiated in i03, it will return the existing object.
406
310
  """
407
- return device_instantiation(
408
- HDFPanda,
409
- "panda",
410
- "-EA-PANDA-01:",
411
- wait_for_connection,
412
- fake_with_ophyd_sim,
311
+ return HDFPanda(
312
+ f"{PREFIX.beamline_prefix}-EA-PANDA-01:",
413
313
  path_provider=get_path_provider(),
314
+ name="panda",
414
315
  )
415
316
 
416
317
 
417
- @skip_device(lambda: BL == "s03")
418
- def sample_shutter(
419
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
420
- ) -> ZebraShutter:
318
+ @device_factory(skip=BL == "s03")
319
+ def sample_shutter() -> ZebraShutter:
421
320
  """Get the i03 sample shutter device, instantiate it if it hasn't already been.
422
321
  If this is called when already instantiated in i03, it will return the existing object.
423
322
  """
424
- return device_instantiation(
425
- ZebraShutter,
323
+ return ZebraShutter(
324
+ f"{PREFIX.beamline_prefix}-EA-SHTR-01:",
426
325
  "sample_shutter",
427
- "-EA-SHTR-01:",
428
- wait_for_connection,
429
- fake_with_ophyd_sim,
430
326
  )
431
327
 
432
328
 
433
- @skip_device(lambda: BL == "s03")
434
- def flux(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) -> Flux:
329
+ @device_factory(skip=BL == "s03")
330
+ def flux() -> Flux:
435
331
  """Get the i03 flux device, instantiate it if it hasn't already been.
436
332
  If this is called when already instantiated in i03, it will return the existing object.
437
333
  """
438
- return device_instantiation(
439
- Flux,
334
+ return Flux(
335
+ f"{PREFIX.beamline_prefix}-MO-FLUX-01:",
440
336
  "flux",
441
- "-MO-FLUX-01:",
442
- wait_for_connection,
443
- fake_with_ophyd_sim,
444
337
  )
445
338
 
446
339
 
447
- def xbpm_feedback(
448
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
449
- ) -> XBPMFeedback:
340
+ @device_factory()
341
+ def xbpm_feedback() -> XBPMFeedback:
450
342
  """Get the i03 XBPM feeback device, instantiate it if it hasn't already been.
451
343
  If this is called when already instantiated in i03, it will return the existing object.
452
344
  """
453
- return device_instantiation(
454
- XBPMFeedback,
345
+ return XBPMFeedback(
346
+ PREFIX.beamline_prefix,
455
347
  "xbpm_feedback",
456
- "",
457
- wait_for_connection,
458
- fake_with_ophyd_sim,
459
348
  )
460
349
 
461
350
 
462
- def zocalo(
463
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
464
- ) -> ZocaloResults:
351
+ @device_factory()
352
+ def zocalo() -> ZocaloResults:
465
353
  """Get the i03 ZocaloResults device, instantiate it if it hasn't already been.
466
354
  If this is called when already instantiated in i03, it will return the existing object.
467
355
  """
468
- return device_instantiation(
469
- ZocaloResults,
470
- "zocalo",
471
- "",
472
- wait_for_connection,
473
- fake_with_ophyd_sim,
356
+ return ZocaloResults(
357
+ name="zocalo",
358
+ prefix=PREFIX.beamline_prefix,
474
359
  )
475
360
 
476
361
 
477
- def robot(
478
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
479
- ) -> BartRobot:
362
+ @device_factory()
363
+ def robot() -> BartRobot:
480
364
  """Get the i03 robot device, instantiate it if it hasn't already been.
481
365
  If this is called when already instantiated in i03, it will return the existing object.
482
366
  """
483
- return device_instantiation(
484
- BartRobot,
367
+ return BartRobot(
485
368
  "robot",
486
- "-MO-ROBOT-01:",
487
- wait_for_connection,
488
- fake_with_ophyd_sim,
369
+ f"{PREFIX.beamline_prefix}-MO-ROBOT-01:",
489
370
  )
490
371
 
491
372
 
492
- def webcam(
493
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
494
- ) -> Webcam:
373
+ @device_factory()
374
+ def webcam() -> Webcam:
495
375
  """Get the i03 webcam, instantiate it if it hasn't already been.
496
376
  If this is called when already instantiated in i03, it will return the existing object.
497
377
  """
498
- return device_instantiation(
499
- Webcam,
378
+ return Webcam(
500
379
  "webcam",
501
- "",
502
- wait_for_connection,
503
- fake_with_ophyd_sim,
380
+ PREFIX.beamline_prefix,
504
381
  url="http://i03-webcam1/axis-cgi/jpg/image.cgi",
505
382
  )
506
383
 
507
384
 
508
- def thawer(
509
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
510
- ) -> Thawer:
385
+ @device_factory()
386
+ def thawer() -> Thawer:
511
387
  """Get the i03 thawer, instantiate it if it hasn't already been.
512
388
  If this is called when already instantiated in i03, it will return the existing object.
513
389
  """
514
- return device_instantiation(
515
- Thawer,
390
+ return Thawer(
391
+ f"{PREFIX.beamline_prefix}-EA-THAW-01",
516
392
  "thawer",
517
- "-EA-THAW-01",
518
- wait_for_connection,
519
- fake_with_ophyd_sim,
520
393
  )
521
394
 
522
395
 
523
- def lower_gonio(
524
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
525
- ) -> XYZPositioner:
396
+ @device_factory()
397
+ def lower_gonio() -> XYZPositioner:
526
398
  """Get the i03 lower gonio device, instantiate it if it hasn't already been.
527
399
  If this is called when already instantiated in i03, it will return the existing object.
528
400
  """
529
- return device_instantiation(
530
- XYZPositioner,
401
+ return XYZPositioner(
402
+ f"{PREFIX.beamline_prefix}-MO-GONP-01:",
531
403
  "lower_gonio",
532
- "-MO-GONP-01:",
533
- wait_for_connection,
534
- fake_with_ophyd_sim,
535
404
  )
536
405
 
537
406
 
538
- def cryo_stream(
539
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
540
- ) -> CryoStream:
407
+ @device_factory()
408
+ def cryo_stream() -> CryoStream:
541
409
  """Get the i03 cryostream device, instantiate it if it hasn't already been.
542
410
  If this is called when already instantiated in i03, it will return the existing object.
543
411
  """
544
- return device_instantiation(
545
- CryoStream,
412
+ return CryoStream(
413
+ PREFIX.beamline_prefix,
546
414
  "cryo_stream",
547
- "",
548
- wait_for_connection,
549
- fake_with_ophyd_sim,
550
415
  )
551
416
 
552
417
 
553
- def diamond_filter(
554
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
555
- ) -> DiamondFilter[I03Filters]:
418
+ @device_factory()
419
+ def diamond_filter() -> DiamondFilter[I03Filters]:
556
420
  """Get the i03 diamond filter device, instantiate it if it hasn't already been.
557
421
  If this is called when already instantiated in i03, it will return the existing object.
558
422
  """
559
- return device_instantiation(
560
- DiamondFilter[I03Filters],
561
- "diamond_filter",
562
- "-MO-FLTR-01:",
563
- wait_for_connection,
564
- fake_with_ophyd_sim,
423
+ return DiamondFilter[I03Filters](
424
+ prefix=f"{PREFIX.beamline_prefix}-MO-FLTR-01:",
425
+ name="diamond_filter",
565
426
  data_type=I03Filters,
566
427
  )
567
428
 
568
429
 
569
- def qbpm(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) -> QBPM:
430
+ @device_factory()
431
+ def qbpm() -> QBPM:
570
432
  """Get the i03 qbpm device, instantiate it if it hasn't already been.
571
433
  If this is called when already instantiated in i03, it will return the existing object.
572
434
  """
573
- return device_instantiation(
574
- QBPM,
435
+ return QBPM(
436
+ f"{PREFIX.beamline_prefix}-DI-QBPM-01:",
575
437
  "qbpm",
576
- "-DI-QBPM-01:",
577
- wait_for_connection,
578
- fake_with_ophyd_sim,
579
438
  )