dls-dodal 1.39.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 (48) hide show
  1. {dls_dodal-1.39.0.dist-info → dls_dodal-1.40.0.dist-info}/METADATA +2 -2
  2. {dls_dodal-1.39.0.dist-info → dls_dodal-1.40.0.dist-info}/RECORD +48 -39
  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 +141 -292
  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 +3 -2
  24. dodal/devices/fast_grid_scan.py +16 -18
  25. dodal/devices/hutch_shutter.py +25 -12
  26. dodal/devices/i10/rasor/rasor_scaler_cards.py +4 -4
  27. dodal/devices/i13_1/merlin.py +4 -3
  28. dodal/devices/i13_1/merlin_controller.py +2 -7
  29. dodal/devices/i18/KBMirror.py +19 -0
  30. dodal/devices/i18/diode.py +17 -0
  31. dodal/devices/i18/table.py +14 -0
  32. dodal/devices/i18/thor_labs_stage.py +12 -0
  33. dodal/devices/i19/__init__.py +0 -0
  34. dodal/devices/i19/shutter.py +57 -0
  35. dodal/devices/i22/nxsas.py +4 -4
  36. dodal/devices/motors.py +2 -2
  37. dodal/devices/oav/oav_detector.py +10 -19
  38. dodal/devices/pressure_jump_cell.py +33 -16
  39. dodal/devices/robot.py +30 -11
  40. dodal/devices/tetramm.py +8 -3
  41. dodal/devices/turbo_slit.py +7 -6
  42. dodal/devices/zocalo/zocalo_results.py +21 -4
  43. dodal/plans/save_panda.py +30 -14
  44. dodal/utils.py +54 -15
  45. {dls_dodal-1.39.0.dist-info → dls_dodal-1.40.0.dist-info}/LICENSE +0 -0
  46. {dls_dodal-1.39.0.dist-info → dls_dodal-1.40.0.dist-info}/WHEEL +0 -0
  47. {dls_dodal-1.39.0.dist-info → dls_dodal-1.40.0.dist-info}/entry_points.txt +0 -0
  48. {dls_dodal-1.39.0.dist-info → dls_dodal-1.40.0.dist-info}/top_level.txt +0 -0
dodal/beamlines/i04.py CHANGED
@@ -1,5 +1,7 @@
1
+ import os
2
+
1
3
  from dodal.common.beamlines.beamline_parameters import get_beamline_parameters
2
- from dodal.common.beamlines.beamline_utils import device_instantiation
4
+ from dodal.common.beamlines.beamline_utils import device_factory, device_instantiation
3
5
  from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
4
6
  from dodal.devices.aperturescatterguard import (
5
7
  AperturePosition,
@@ -36,7 +38,7 @@ from dodal.devices.zebra.zebra_constants_mapping import (
36
38
  )
37
39
  from dodal.devices.zebra.zebra_controlled_shutter import ZebraShutter
38
40
  from dodal.log import set_beamline as set_log_beamline
39
- from dodal.utils import BeamlinePrefix, get_beamline_name, skip_device
41
+ from dodal.utils import BeamlinePrefix, get_beamline_name
40
42
 
41
43
  ZOOM_PARAMS_FILE = (
42
44
  "/dls_sw/i04/software/gda/configurations/i04-config/xml/jCameraManZoomLevels.xml"
@@ -44,8 +46,8 @@ ZOOM_PARAMS_FILE = (
44
46
  DISPLAY_CONFIG = "/dls_sw/i04/software/gda_versions/var/display.configuration"
45
47
  DAQ_CONFIGURATION_PATH = "/dls_sw/i04/software/daq_configuration"
46
48
 
47
- REDIS_HOST = "i04-control.diamond.ac.uk"
48
- REDIS_PASSWORD = "not_telling"
49
+ REDIS_HOST = os.environ.get("VALKEY_PROD_SVC_SERVICE_HOST", "test_redis")
50
+ REDIS_PASSWORD = os.environ.get("VALKEY_PASSWORD", "test_redis_password")
49
51
  MURKO_REDIS_DB = 7
50
52
 
51
53
  BL = get_beamline_name("s04")
@@ -57,141 +59,110 @@ I04_ZEBRA_MAPPING = ZebraMapping(
57
59
  sources=ZebraSources(),
58
60
  )
59
61
 
62
+ PREFIX = BeamlinePrefix(BL)
63
+
60
64
 
61
- def smargon(
62
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
63
- ) -> Smargon:
65
+ @device_factory()
66
+ def smargon() -> Smargon:
64
67
  """Get the i04 Smargon device, instantiate it if it hasn't already been.
65
68
  If this is called when already instantiated in i04, it will return the existing object.
66
69
  """
67
- return device_instantiation(
68
- Smargon,
70
+ return Smargon(
71
+ f"{PREFIX.beamline_prefix}-MO-SGON-01:",
69
72
  "smargon",
70
- "-MO-SGON-01:",
71
- wait_for_connection,
72
- fake_with_ophyd_sim,
73
73
  )
74
74
 
75
75
 
76
- def gonio_positioner(
77
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
78
- ) -> XYZPositioner:
76
+ @device_factory()
77
+ def gonio_positioner() -> XYZPositioner:
79
78
  """Get the i04 lower_gonio_stages device, instantiate it if it hasn't already been.
80
79
  If this is called when already instantiated in i04, it will return the existing object.
81
80
  """
82
- return device_instantiation(
83
- XYZPositioner,
81
+ return XYZPositioner(
82
+ f"{PREFIX.beamline_prefix}-MO-GONIO-01:",
84
83
  "lower_gonio_stages",
85
- "-MO-GONIO-01:",
86
- wait_for_connection,
87
- fake_with_ophyd_sim,
88
84
  )
89
85
 
90
86
 
91
- def sample_delivery_system(
92
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
93
- ) -> XYZPositioner:
87
+ @device_factory()
88
+ def sample_delivery_system() -> XYZPositioner:
94
89
  """Get the i04 sample_delivery_system device, instantiate it if it hasn't already been.
95
90
  If this is called when already instantiated in i04, it will return the existing object.
96
91
  """
97
- return device_instantiation(
98
- XYZPositioner,
92
+ return XYZPositioner(
93
+ f"{PREFIX.beamline_prefix}-MO-SDE-01:",
99
94
  "sample_delivery_system",
100
- "-MO-SDE-01:",
101
- wait_for_connection,
102
- fake_with_ophyd_sim,
103
95
  )
104
96
 
105
97
 
106
- def ipin(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) -> IPin:
98
+ @device_factory()
99
+ def ipin() -> IPin:
107
100
  """Get the i04 ipin device, instantiate it if it hasn't already been.
108
101
  If this is called when already instantiated in i04, it will return the existing object.
109
102
  """
110
- return device_instantiation(
111
- IPin,
103
+ return IPin(
104
+ f"{PREFIX.beamline_prefix}-EA-PIN-01:",
112
105
  "ipin",
113
- "-EA-PIN-01:",
114
- wait_for_connection,
115
- fake_with_ophyd_sim,
116
106
  )
117
107
 
118
108
 
119
- def beamstop(
120
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
121
- ) -> XYZPositioner:
109
+ @device_factory()
110
+ def beamstop() -> XYZPositioner:
122
111
  """Get the i04 beamstop device, instantiate it if it hasn't already been.
123
112
  If this is called when already instantiated in i04, it will return the existing object.
124
113
  """
125
- return device_instantiation(
126
- XYZPositioner,
114
+ return XYZPositioner(
115
+ f"{PREFIX.beamline_prefix}-MO-BS-01:",
127
116
  "beamstop",
128
- "-MO-BS-01:",
129
- wait_for_connection,
130
- fake_with_ophyd_sim,
131
117
  )
132
118
 
133
119
 
134
- def sample_shutter(
135
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
136
- ) -> ZebraShutter:
120
+ @device_factory()
121
+ def sample_shutter() -> ZebraShutter:
137
122
  """Get the i04 sample shutter device, instantiate it if it hasn't already been.
138
123
  If this is called when already instantiated in i04, it will return the existing object.
139
124
  """
140
- return device_instantiation(
141
- ZebraShutter,
125
+ return ZebraShutter(
126
+ f"{PREFIX.beamline_prefix}-EA-SHTR-01:",
142
127
  "sample_shutter",
143
- "-EA-SHTR-01:",
144
- wait_for_connection,
145
- fake_with_ophyd_sim,
146
128
  )
147
129
 
148
130
 
149
- def attenuator(
150
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
151
- ) -> BinaryFilterAttenuator:
131
+ @device_factory()
132
+ def attenuator() -> BinaryFilterAttenuator:
152
133
  """Get the i04 attenuator device, instantiate it if it hasn't already been.
153
134
  If this is called when already instantiated in i04, it will return the existing object.
154
135
  """
155
- return device_instantiation(
156
- BinaryFilterAttenuator,
136
+ return BinaryFilterAttenuator(
137
+ f"{PREFIX.beamline_prefix}-EA-ATTN-01:",
157
138
  "attenuator",
158
- "-EA-ATTN-01:",
159
- wait_for_connection,
160
- fake_with_ophyd_sim,
161
139
  )
162
140
 
163
141
 
164
- def transfocator(
165
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
166
- ) -> Transfocator:
142
+ @device_factory()
143
+ def transfocator() -> Transfocator:
167
144
  """Get the i04 transfocator device, instantiate it if it hasn't already been.
168
145
  If this is called when already instantiated in i04, it will return the existing object.
169
146
  """
170
- return device_instantiation(
171
- Transfocator,
147
+ return Transfocator(
148
+ f"{PREFIX.beamline_prefix}-MO-FSWT-01:",
172
149
  "transfocator",
173
- "-MO-FSWT-01:",
174
- wait_for_connection,
175
- fake_with_ophyd_sim,
176
150
  )
177
151
 
178
152
 
179
- def xbpm_feedback(
180
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
181
- ) -> XBPMFeedback:
153
+ @device_factory()
154
+ def xbpm_feedback() -> XBPMFeedback:
182
155
  """Get the i04 xbpm_feedback device, instantiate it if it hasn't already been.
183
156
  If this is called when already instantiated in i04, it will return the existing object.
184
157
  """
185
- return device_instantiation(
186
- XBPMFeedback,
158
+ return XBPMFeedback(
159
+ PREFIX.beamline_prefix,
187
160
  "xbpm_feedback",
188
- "",
189
- wait_for_connection,
190
- fake_with_ophyd_sim,
191
161
  )
192
162
 
193
163
 
194
- def flux(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) -> Flux:
164
+ @device_factory()
165
+ def flux(mock: bool = False) -> Flux:
195
166
  """Get the i04 flux device, instantiate it if it hasn't already been.
196
167
  If this is called when already instantiated in i04, it will return the existing object.
197
168
  """
@@ -199,65 +170,50 @@ def flux(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) ->
199
170
  Flux,
200
171
  "flux",
201
172
  "-MO-FLUX-01:",
202
- wait_for_connection,
203
- fake_with_ophyd_sim,
173
+ wait=False,
174
+ fake=mock,
204
175
  )
205
176
 
206
177
 
207
- def dcm(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) -> DCM:
178
+ @device_factory()
179
+ def dcm() -> DCM:
208
180
  """Get the i04 DCM device, instantiate it if it hasn't already been.
209
181
  If this is called when already instantiated in i04, it will return the existing object.
210
182
  """
211
- return device_instantiation(
212
- DCM,
183
+ return DCM(
184
+ f"{PREFIX.beamline_prefix}-MO-DCM-01:",
213
185
  "dcm",
214
- "-MO-DCM-01:",
215
- wait_for_connection,
216
- fake_with_ophyd_sim,
217
186
  )
218
187
 
219
188
 
220
- def backlight(
221
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
222
- ) -> Backlight:
189
+ @device_factory()
190
+ def backlight() -> Backlight:
223
191
  """Get the i04 backlight device, instantiate it if it hasn't already been.
224
192
  If this is called when already instantiated in i04, it will return the existing object.
225
193
  """
226
- return device_instantiation(
227
- Backlight,
194
+ return Backlight(
195
+ PREFIX.beamline_prefix,
228
196
  "backlight",
229
- "",
230
- wait_for_connection,
231
- fake_with_ophyd_sim,
232
197
  )
233
198
 
234
199
 
235
- def aperture_scatterguard(
236
- wait_for_connection: bool = True,
237
- fake_with_ophyd_sim: bool = False,
238
- ) -> ApertureScatterguard:
200
+ @device_factory()
201
+ def aperture_scatterguard() -> ApertureScatterguard:
239
202
  """Get the i04 aperture and scatterguard device, instantiate it if it hasn't already
240
203
  been. If this is called when already instantiated in i04, it will return the existing
241
204
  object.
242
205
  """
243
206
  params = get_beamline_parameters()
244
- return device_instantiation(
245
- device_factory=ApertureScatterguard,
207
+ return ApertureScatterguard(
208
+ prefix=PREFIX.beamline_prefix,
246
209
  name="aperture_scatterguard",
247
- prefix="",
248
- wait=wait_for_connection,
249
- fake=fake_with_ophyd_sim,
250
210
  loaded_positions=load_positions_from_beamline_parameters(params),
251
211
  tolerances=AperturePosition.tolerances_from_gda_params(params),
252
212
  )
253
213
 
254
214
 
255
- @skip_device(lambda: BL == "s04")
256
- def eiger(
257
- wait_for_connection: bool = True,
258
- fake_with_ophyd_sim: bool = False,
259
- params: DetectorParams | None = None,
260
- ) -> EigerDetector:
215
+ @device_factory(skip=BL == "s04")
216
+ def eiger(mock: bool = False, params: DetectorParams | None = None) -> EigerDetector:
261
217
  """Get the i04 Eiger device, instantiate it if it hasn't already been.
262
218
  If this is called when already instantiated in i04, it will return the existing object.
263
219
  If called with params, will update those params to the Eiger object.
@@ -271,30 +227,25 @@ def eiger(
271
227
  device_factory=EigerDetector,
272
228
  name="eiger",
273
229
  prefix="-EA-EIGER-01:",
274
- wait=wait_for_connection,
275
- fake=fake_with_ophyd_sim,
230
+ wait=False,
231
+ fake=mock,
276
232
  post_create=set_params,
277
233
  )
278
234
 
279
235
 
280
- def zebra_fast_grid_scan(
281
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
282
- ) -> ZebraFastGridScan:
236
+ @device_factory()
237
+ def zebra_fast_grid_scan() -> ZebraFastGridScan:
283
238
  """Get the i04 zebra_fast_grid_scan device, instantiate it if it hasn't already been.
284
239
  If this is called when already instantiated in i04, it will return the existing object.
285
240
  """
286
- return device_instantiation(
287
- device_factory=ZebraFastGridScan,
241
+ return ZebraFastGridScan(
288
242
  name="zebra_fast_grid_scan",
289
- prefix="-MO-SGON-01:",
290
- wait=wait_for_connection,
291
- fake=fake_with_ophyd_sim,
243
+ prefix=f"{PREFIX.beamline_prefix}-MO-SGON-01:",
292
244
  )
293
245
 
294
246
 
295
- def s4_slit_gaps(
296
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
297
- ) -> S4SlitGaps:
247
+ @device_factory()
248
+ def s4_slit_gaps(mock: bool = False) -> S4SlitGaps:
298
249
  """Get the i04 s4_slit_gaps device, instantiate it if it hasn't already been.
299
250
  If this is called when already instantiated in i04, it will return the existing object.
300
251
  """
@@ -302,60 +253,47 @@ def s4_slit_gaps(
302
253
  S4SlitGaps,
303
254
  "s4_slit_gaps",
304
255
  "-AL-SLITS-04:",
305
- wait_for_connection,
306
- fake_with_ophyd_sim,
256
+ wait=False,
257
+ fake=mock,
307
258
  )
308
259
 
309
260
 
310
- def undulator(
311
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
312
- ) -> Undulator:
261
+ @device_factory()
262
+ def undulator() -> Undulator:
313
263
  """Get the i04 undulator device, instantiate it if it hasn't already been.
314
264
  If this is called when already instantiated in i04, it will return the existing object.
315
265
  """
316
- return device_instantiation(
317
- Undulator,
318
- "undulator",
319
- f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-01:",
320
- wait_for_connection,
321
- fake_with_ophyd_sim,
322
- bl_prefix=False,
266
+ return Undulator(
267
+ name="undulator",
268
+ prefix=f"{PREFIX.insertion_prefix}-MO-SERVC-01:",
323
269
  id_gap_lookup_table_path="/dls_sw/i04/software/gda/config/lookupTables/BeamLine_Undulator_toGap.txt",
324
270
  )
325
271
 
326
272
 
327
- @skip_device(lambda: BL == "s04")
328
- def synchrotron(
329
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
330
- ) -> Synchrotron:
273
+ @device_factory(skip=BL == "s04")
274
+ def synchrotron() -> Synchrotron:
331
275
  """Get the i04 synchrotron device, instantiate it if it hasn't already been.
332
276
  If this is called when already instantiated in i04, it will return the existing object.
333
277
  """
334
- return device_instantiation(
335
- Synchrotron,
336
- "synchrotron",
278
+ return Synchrotron(
337
279
  "",
338
- wait_for_connection,
339
- fake_with_ophyd_sim,
340
- bl_prefix=False,
280
+ "synchrotron",
341
281
  )
342
282
 
343
283
 
344
- def zebra(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) -> Zebra:
284
+ @device_factory()
285
+ def zebra() -> Zebra:
345
286
  """Get the i04 zebra device, instantiate it if it hasn't already been.
346
287
  If this is called when already instantiated in i04, it will return the existing object.
347
288
  """
348
- return device_instantiation(
349
- Zebra,
350
- "zebra",
351
- "-EA-ZEBRA-01:",
352
- wait_for_connection,
353
- fake_with_ophyd_sim,
289
+ return Zebra(
290
+ name="zebra",
291
+ prefix=f"{PREFIX.beamline_prefix}-EA-ZEBRA-01:",
354
292
  mapping=I04_ZEBRA_MAPPING,
355
293
  )
356
294
 
357
295
 
358
- @skip_device(lambda: BL == "s04")
296
+ @device_factory(skip=BL == "s04")
359
297
  def oav(
360
298
  wait_for_connection: bool = True,
361
299
  fake_with_ophyd_sim: bool = False,
@@ -364,91 +302,67 @@ def oav(
364
302
  """Get the i04 OAV device, instantiate it if it hasn't already been.
365
303
  If this is called when already instantiated in i04, it will return the existing object.
366
304
  """
367
- return device_instantiation(
368
- OAV,
369
- "oav",
370
- "-DI-OAV-01:",
371
- wait_for_connection,
372
- fake_with_ophyd_sim,
305
+ return OAV(
306
+ prefix=f"{PREFIX.beamline_prefix}-DI-OAV-01:",
307
+ name="oav",
373
308
  config=params or OAVConfig(ZOOM_PARAMS_FILE, DISPLAY_CONFIG),
374
309
  )
375
310
 
376
311
 
377
- @skip_device(lambda: BL == "s04")
378
- def detector_motion(
379
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
380
- ) -> DetectorMotion:
312
+ @device_factory(skip=BL == "s04")
313
+ def detector_motion() -> DetectorMotion:
381
314
  """Get the i04 detector motion device, instantiate it if it hasn't already been.
382
315
  If this is called when already instantiated in i04, it will return the existing object.
383
316
  """
384
- return device_instantiation(
385
- device_factory=DetectorMotion,
317
+ return DetectorMotion(
386
318
  name="detector_motion",
387
- prefix="",
388
- wait=wait_for_connection,
389
- fake=fake_with_ophyd_sim,
319
+ prefix=PREFIX.beamline_prefix,
390
320
  )
391
321
 
392
322
 
393
- def thawer(
394
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
395
- ) -> Thawer:
323
+ @device_factory()
324
+ def thawer() -> Thawer:
396
325
  """Get the i04 thawer, instantiate it if it hasn't already been.
397
326
  If this is called when already instantiated in i04, it will return the existing object.
398
327
  """
399
- return device_instantiation(
400
- Thawer,
328
+ return Thawer(
329
+ f"{PREFIX.beamline_prefix}-EA-THAW-01",
401
330
  "thawer",
402
- "-EA-THAW-01",
403
- wait_for_connection,
404
- fake_with_ophyd_sim,
405
331
  )
406
332
 
407
333
 
408
- def robot(
409
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
410
- ) -> BartRobot:
334
+ @device_factory()
335
+ def robot() -> BartRobot:
411
336
  """Get the i04 robot device, instantiate it if it hasn't already been.
412
337
  If this is called when already instantiated in i04, it will return the existing object.
413
338
  """
414
- return device_instantiation(
415
- BartRobot,
339
+ return BartRobot(
416
340
  "robot",
417
- "-MO-ROBOT-01:",
418
- wait_for_connection,
419
- fake_with_ophyd_sim,
341
+ f"{PREFIX.beamline_prefix}-MO-ROBOT-01:",
420
342
  )
421
343
 
422
344
 
423
- def oav_to_redis_forwarder(
424
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
425
- ) -> OAVToRedisForwarder:
345
+ @device_factory()
346
+ def oav_to_redis_forwarder() -> OAVToRedisForwarder:
426
347
  """Get the i04 OAV to redis forwarder, instantiate it if it hasn't already been.
427
348
  If this is called when already instantiated in i04, it will return the existing object.
428
349
  """
429
- return device_instantiation(
430
- OAVToRedisForwarder,
431
- "oav_to_redis_forwarder",
432
- "-DI-OAV-01:",
433
- wait_for_connection,
434
- fake_with_ophyd_sim,
350
+ return OAVToRedisForwarder(
351
+ f"{PREFIX.beamline_prefix}-DI-OAV-01:",
352
+ name="oav_to_redis_forwarder",
435
353
  redis_host=REDIS_HOST,
436
354
  redis_password=REDIS_PASSWORD,
437
355
  redis_db=7,
438
356
  )
439
357
 
440
358
 
441
- def diamond_filter(
442
- wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
443
- ) -> DiamondFilter[I04Filters]:
359
+ @device_factory()
360
+ def diamond_filter() -> DiamondFilter[I04Filters]:
444
361
  """Get the i04 diamond filter device, instantiate it if it hasn't already been.
445
362
  If this is called when already instantiated in i03, it will return the existing object.
446
363
  """
447
- return device_instantiation(
448
- DiamondFilter[I04Filters],
449
- "diamond_filter",
450
- "-MO-FLTR-01:",
451
- wait_for_connection,
452
- fake_with_ophyd_sim,
364
+ return DiamondFilter[I04Filters](
365
+ prefix=f"{PREFIX.beamline_prefix}-MO-FLTR-01:",
366
+ name="diamond_filter",
453
367
  data_type=I04Filters,
454
368
  )
dodal/beamlines/i13_1.py CHANGED
@@ -8,6 +8,7 @@ from dodal.common.beamlines.beamline_utils import (
8
8
  set_path_provider,
9
9
  )
10
10
  from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
11
+ from dodal.common.beamlines.device_helpers import CAM_SUFFIX, HDF5_SUFFIX
11
12
  from dodal.common.visit import LocalDirectoryServiceClient, StaticVisitPathProvider
12
13
  from dodal.devices.i13_1.merlin import Merlin
13
14
  from dodal.devices.motors import XYZPositioner
@@ -60,8 +61,8 @@ def side_camera(
60
61
  prefix="BL13J-OP-FLOAT-03:",
61
62
  name="side_camera",
62
63
  bl_prefix=False,
63
- drv_suffix="CAM:",
64
- hdf_suffix="HDF5:",
64
+ drv_suffix=CAM_SUFFIX,
65
+ fileio_suffix=HDF5_SUFFIX,
65
66
  path_provider=get_path_provider(),
66
67
  wait=wait_for_connection,
67
68
  fake=fake_with_ophyd_sim,
@@ -76,8 +77,8 @@ def merlin(
76
77
  prefix="BL13J-EA-DET-04:",
77
78
  name="merlin",
78
79
  bl_prefix=False,
79
- drv_suffix="CAM:",
80
- hdf_suffix="HDF5:",
80
+ drv_suffix=CAM_SUFFIX,
81
+ fileio_suffix=HDF5_SUFFIX,
81
82
  path_provider=get_path_provider(),
82
83
  wait=wait_for_connection,
83
84
  fake=fake_with_ophyd_sim,
dodal/beamlines/i18.py ADDED
@@ -0,0 +1,124 @@
1
+ from pathlib import Path
2
+
3
+ from ophyd_async.fastcs.panda import HDFPanda
4
+
5
+ from dodal.common.beamlines.beamline_utils import (
6
+ device_factory,
7
+ get_path_provider,
8
+ set_path_provider,
9
+ )
10
+ from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
11
+ from dodal.common.visit import (
12
+ LocalDirectoryServiceClient,
13
+ StaticVisitPathProvider,
14
+ )
15
+ from dodal.devices.dcm import DCM
16
+ from dodal.devices.i18.diode import Diode
17
+ from dodal.devices.i18.KBMirror import KBMirror
18
+ from dodal.devices.i18.table import Table
19
+ from dodal.devices.i18.thor_labs_stage import ThorLabsStage
20
+ from dodal.devices.slits import Slits
21
+ from dodal.devices.synchrotron import Synchrotron
22
+ from dodal.devices.tetramm import TetrammDetector
23
+ from dodal.devices.undulator import Undulator
24
+ from dodal.log import set_beamline as set_log_beamline
25
+ from dodal.utils import BeamlinePrefix, get_beamline_name
26
+
27
+ BL = get_beamline_name("i18")
28
+ PREFIX = BeamlinePrefix(BL)
29
+ set_log_beamline(BL)
30
+ set_utils_beamline(BL)
31
+
32
+
33
+ # Currently we must hard-code the visit, determining the visit at runtime requires
34
+ # infrastructure that is still WIP.
35
+ # Communication with GDA is also WIP so for now we determine an arbitrary scan number
36
+ # locally and write the commissioning directory. The scan number is not guaranteed to
37
+ # be unique and the data is at risk - this configuration is for testing only.
38
+ set_path_provider(
39
+ StaticVisitPathProvider(
40
+ BL,
41
+ Path("/dls/i18/data/2024/cm37264-2/bluesky"),
42
+ client=LocalDirectoryServiceClient(),
43
+ )
44
+ )
45
+
46
+
47
+ @device_factory()
48
+ def synchrotron() -> Synchrotron:
49
+ return Synchrotron()
50
+
51
+
52
+ @device_factory()
53
+ def undulator() -> Undulator:
54
+ return Undulator(f"{PREFIX.insertion_prefix}-MO-SERVC-01:")
55
+
56
+
57
+ @device_factory()
58
+ def dcm() -> DCM:
59
+ # once spacing is added Si111 d-spacing is 3.135 angsterm , and Si311 is 1.637
60
+ # calculations are in gda/config/lookupTables/Si111/eV_Deg_converter.xml
61
+ return DCM(
62
+ prefix=f"{PREFIX.beamline_prefix}-MO-DCM-01:",
63
+ )
64
+
65
+
66
+ @device_factory()
67
+ def slits_1() -> Slits:
68
+ return Slits(
69
+ f"{PREFIX.beamline_prefix}-AL-SLITS-01:",
70
+ x_centre="X:CENTER",
71
+ y_centre="Y:CENTER",
72
+ )
73
+
74
+
75
+ # PandA IOC needs to be updated to support PVI
76
+ @device_factory(skip=True)
77
+ def panda1() -> HDFPanda:
78
+ return HDFPanda(
79
+ f"{PREFIX.beamline_prefix}-MO-PANDA-01:",
80
+ path_provider=get_path_provider(),
81
+ )
82
+
83
+
84
+ @device_factory()
85
+ def i0() -> TetrammDetector:
86
+ return TetrammDetector(
87
+ f"{PREFIX.beamline_prefix}-DI-XBPM-02:",
88
+ path_provider=get_path_provider(),
89
+ type="Cividec Diamond XBPM",
90
+ )
91
+
92
+
93
+ @device_factory()
94
+ def it() -> TetrammDetector:
95
+ return TetrammDetector(
96
+ f"{PREFIX.beamline_prefix}-DI-XBPM-01:",
97
+ path_provider=get_path_provider(),
98
+ )
99
+
100
+
101
+ @device_factory(skip=True)
102
+ # VFM uses different IOC than HFM https://github.com/DiamondLightSource/dodal/issues/1009
103
+ def vfm() -> KBMirror:
104
+ return KBMirror(f"{PREFIX.beamline_prefix}-OP-VFM-01:")
105
+
106
+
107
+ @device_factory()
108
+ def hfm() -> KBMirror:
109
+ return KBMirror(f"{PREFIX.beamline_prefix}-OP-HFM-01:")
110
+
111
+
112
+ @device_factory()
113
+ def d7diode() -> Diode:
114
+ return Diode(f"{PREFIX.beamline_prefix}-DI-PHDGN-07:")
115
+
116
+
117
+ @device_factory()
118
+ def main_table() -> Table:
119
+ return Table(f"{PREFIX.beamline_prefix}-MO-TABLE-01:")
120
+
121
+
122
+ @device_factory()
123
+ def thor_labs_stage() -> ThorLabsStage:
124
+ return ThorLabsStage(f"{PREFIX.beamline_prefix}-MO-TABLE-02:")