mx-bluesky 1.4.6__py3-none-any.whl → 1.4.8__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 (95) hide show
  1. mx_bluesky/_version.py +2 -2
  2. mx_bluesky/beamlines/aithre_lasershaping/__init__.py +13 -0
  3. mx_bluesky/beamlines/aithre_lasershaping/check_goniometer_performance.py +29 -0
  4. mx_bluesky/beamlines/aithre_lasershaping/goniometer_controls.py +18 -0
  5. mx_bluesky/beamlines/i04/redis_to_murko_forwarder.py +35 -29
  6. mx_bluesky/beamlines/i04/thawing_plan.py +18 -3
  7. mx_bluesky/beamlines/i23/__init__.py +3 -0
  8. mx_bluesky/beamlines/i23/serial.py +71 -0
  9. mx_bluesky/beamlines/i24/serial/__init__.py +2 -0
  10. mx_bluesky/beamlines/i24/serial/extruder/EX-gui-edm/DiamondExtruder-I24-py3v1.edl +12 -12
  11. mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +36 -30
  12. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/pumpprobe-py3v1.edl +3 -3
  13. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +15 -66
  14. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +8 -10
  15. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py +10 -3
  16. mx_bluesky/beamlines/i24/serial/log.py +9 -9
  17. mx_bluesky/beamlines/i24/serial/parameters/utils.py +36 -7
  18. mx_bluesky/beamlines/i24/serial/set_visit_directory.sh +1 -1
  19. mx_bluesky/beamlines/i24/serial/setup_beamline/pv.py +16 -17
  20. mx_bluesky/beamlines/i24/serial/setup_beamline/pv_abstract.py +4 -4
  21. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +51 -52
  22. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +3 -2
  23. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +9 -7
  24. mx_bluesky/beamlines/i24/serial/web_gui_plans/general_plans.py +71 -11
  25. mx_bluesky/beamlines/i24/serial/write_nexus.py +6 -5
  26. mx_bluesky/{hyperion → common}/device_setup_plans/check_beamstop.py +1 -1
  27. mx_bluesky/{hyperion → common}/device_setup_plans/manipulate_sample.py +1 -1
  28. mx_bluesky/{hyperion → common}/device_setup_plans/setup_oav.py +12 -6
  29. mx_bluesky/common/device_setup_plans/xbpm_feedback.py +45 -0
  30. mx_bluesky/{hyperion → common}/experiment_plans/change_aperture_then_move_plan.py +13 -29
  31. mx_bluesky/{hyperion → common}/experiment_plans/oav_grid_detection_plan.py +6 -6
  32. mx_bluesky/common/external_interaction/callbacks/common/ispyb_callback_base.py +8 -9
  33. mx_bluesky/common/external_interaction/callbacks/common/ispyb_mapping.py +1 -1
  34. mx_bluesky/common/external_interaction/callbacks/common/zocalo_callback.py +18 -15
  35. mx_bluesky/{hyperion → common}/external_interaction/callbacks/sample_handling/sample_handling_callback.py +16 -4
  36. mx_bluesky/common/external_interaction/callbacks/xray_centre/ispyb_callback.py +50 -45
  37. mx_bluesky/common/external_interaction/callbacks/xray_centre/nexus_callback.py +2 -1
  38. mx_bluesky/common/external_interaction/ispyb/data_model.py +1 -0
  39. mx_bluesky/common/external_interaction/ispyb/ispyb_store.py +18 -2
  40. mx_bluesky/common/external_interaction/ispyb/ispyb_utils.py +4 -4
  41. mx_bluesky/common/external_interaction/nexus/nexus_utils.py +1 -1
  42. mx_bluesky/common/parameters/components.py +22 -2
  43. mx_bluesky/common/parameters/constants.py +6 -16
  44. mx_bluesky/common/parameters/gridscan.py +36 -32
  45. mx_bluesky/common/plans/common_flyscan_xray_centre_plan.py +316 -0
  46. mx_bluesky/common/plans/inner_plans/__init__ .py +0 -0
  47. mx_bluesky/common/plans/read_hardware.py +3 -3
  48. mx_bluesky/common/plans/write_sample_status.py +46 -0
  49. mx_bluesky/common/preprocessors/__init__.py +0 -0
  50. mx_bluesky/common/preprocessors/preprocessors.py +105 -0
  51. mx_bluesky/common/protocols/__init__.py +0 -0
  52. mx_bluesky/common/protocols/protocols.py +10 -0
  53. mx_bluesky/common/utils/log.py +15 -12
  54. mx_bluesky/hyperion/__main__.py +5 -24
  55. mx_bluesky/hyperion/baton_handler.py +84 -0
  56. mx_bluesky/hyperion/device_setup_plans/dcm_pitch_roll_mirror_adjuster.py +4 -4
  57. mx_bluesky/hyperion/device_setup_plans/setup_panda.py +5 -1
  58. mx_bluesky/hyperion/device_setup_plans/setup_zebra.py +0 -33
  59. mx_bluesky/hyperion/device_setup_plans/utils.py +4 -4
  60. mx_bluesky/hyperion/experiment_plans/__init__.py +0 -10
  61. mx_bluesky/hyperion/experiment_plans/experiment_registry.py +0 -16
  62. mx_bluesky/hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py +71 -88
  63. mx_bluesky/hyperion/experiment_plans/hyperion_flyscan_xray_centre_plan.py +183 -0
  64. mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +17 -8
  65. mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +29 -8
  66. mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +4 -4
  67. mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +6 -4
  68. mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +11 -3
  69. mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +9 -34
  70. mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +35 -68
  71. mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +27 -8
  72. mx_bluesky/hyperion/external_interaction/agamemnon.py +140 -10
  73. mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +17 -9
  74. mx_bluesky/hyperion/external_interaction/callbacks/snapshot_callback.py +259 -0
  75. mx_bluesky/hyperion/parameters/cli.py +2 -10
  76. mx_bluesky/hyperion/parameters/constants.py +0 -5
  77. mx_bluesky/hyperion/parameters/device_composites.py +40 -5
  78. mx_bluesky/hyperion/parameters/gridscan.py +9 -58
  79. mx_bluesky/hyperion/parameters/rotation.py +1 -5
  80. mx_bluesky/hyperion/utils/context.py +2 -5
  81. mx_bluesky/hyperion/utils/validation.py +13 -10
  82. {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info}/METADATA +10 -9
  83. {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info}/RECORD +92 -79
  84. {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info}/WHEEL +1 -1
  85. mx_bluesky/common/external_interaction/callbacks/common/aperture_change_callback.py +0 -22
  86. mx_bluesky/hyperion/device_setup_plans/xbpm_feedback.py +0 -103
  87. mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py +0 -466
  88. /mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/{short1-laser.png → s1l.png} +0 -0
  89. /mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/{short2-laser.png → s2l.png} +0 -0
  90. /mx_bluesky/{hyperion → common}/device_setup_plans/position_detector.py +0 -0
  91. /mx_bluesky/{hyperion → common}/external_interaction/callbacks/sample_handling/__init__.py +0 -0
  92. /mx_bluesky/common/plans/{do_fgs.py → inner_plans/do_fgs.py} +0 -0
  93. {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info}/entry_points.txt +0 -0
  94. {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info/licenses}/LICENSE +0 -0
  95. {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,4 @@
1
1
  from pathlib import Path
2
- from time import sleep
3
2
 
4
3
  import bluesky.plan_stubs as bps
5
4
  from dodal.beamlines import i24
@@ -7,6 +6,7 @@ from dodal.devices.detector.det_dim_constants import DetectorSizeConstants
7
6
  from dodal.devices.i24.aperture import Aperture, AperturePositions
8
7
  from dodal.devices.i24.beam_center import DetectorBeamCenter
9
8
  from dodal.devices.i24.beamstop import Beamstop, BeamstopPositions
9
+ from dodal.devices.i24.dcm import DCM
10
10
  from dodal.devices.i24.dual_backlight import BacklightPositions, DualBacklight
11
11
  from dodal.devices.i24.i24_detector_motion import DetectorMotion
12
12
  from dodal.devices.util.lookup_tables import (
@@ -149,9 +149,9 @@ def modechange(action):
149
149
  caput(pv.vgon_pinzs, 0)
150
150
  caput(pv.fluo_trans, "OUT")
151
151
  caput(pv.bs_roty, 0)
152
- sleep(0.5)
152
+ yield from bps.sleep(0.5)
153
153
  caput(pv.bs_mp_select, "Data Collection")
154
- sleep(2.3)
154
+ yield from bps.sleep(2.3)
155
155
  caput(pv.bl_mp_select, "In")
156
156
  SSX_LOGGER.debug("Pin Data Collection Done")
157
157
 
@@ -168,9 +168,9 @@ def modechange(action):
168
168
  caput(pv.vgon_pinyh, 0)
169
169
  caput(pv.vgon_pinzs, 0)
170
170
  caput(pv.fluo_trans, "OUT")
171
- sleep(0.1)
171
+ yield from bps.sleep(0.1)
172
172
  caput(pv.bs_roty, 0)
173
- sleep(2.6)
173
+ yield from bps.sleep(2.6)
174
174
  caput(pv.bl_mp_select, "In")
175
175
  caput(pv.bs_mp_select, "Data Collection")
176
176
  SSX_LOGGER.debug("RT Data Collection Done")
@@ -182,11 +182,11 @@ def modechange(action):
182
182
  caput(pv.hgon_omega, 0.0)
183
183
  caput(pv.fluo_trans, "OUT")
184
184
  caput(pv.bl_mp_select, "Out")
185
- sleep(1)
185
+ yield from bps.sleep(1)
186
186
  caput(pv.aptr1_mp_select, "Manual Mounting")
187
187
  caput(pv.bs_mp_select, "Tray Mount")
188
188
  while float(caget(pv.ttab_x + ".RBV")) > 3:
189
- sleep(1)
189
+ yield from bps.sleep(1)
190
190
  SSX_LOGGER.debug("Tray Hand Mount Done")
191
191
 
192
192
  # Tray Robot Load. This action needs to be reviewed and revised
@@ -199,15 +199,15 @@ def modechange(action):
199
199
  caput(pv.fluo_trans, "OUT")
200
200
  caput(pv.aptr1_mp_select, "In")
201
201
  caput(pv.bl_mp_select, "Out")
202
- sleep(1)
202
+ yield from bps.sleep(1)
203
203
  caput(pv.bs_roty, 0)
204
- sleep(1)
204
+ yield from bps.sleep(1)
205
205
  caput(pv.bs_mp_select, "Robot")
206
- sleep(1)
206
+ yield from bps.sleep(1)
207
207
  caput(pv.bs_mp_select, "Data Collection Far")
208
- sleep(1)
208
+ yield from bps.sleep(1)
209
209
  caput(pv.bs_roty, 0)
210
- sleep(4)
210
+ yield from bps.sleep(4)
211
211
  caput(pv.bl_mp_select, "In")
212
212
  SSX_LOGGER.debug("Tray Robot Mount Done")
213
213
 
@@ -220,15 +220,15 @@ def modechange(action):
220
220
  caput(pv.aptr1_mp_select, "In")
221
221
  caput(pv.fluo_trans, "OUT")
222
222
  caput(pv.bl_mp_select, "Out")
223
- sleep(1)
223
+ yield from bps.sleep(1)
224
224
  caput(pv.bs_roty, 0)
225
- sleep(1)
225
+ yield from bps.sleep(1)
226
226
  caput(pv.bs_mp_select, "Robot")
227
- sleep(1)
227
+ yield from bps.sleep(1)
228
228
  caput(pv.bs_mp_select, "Data Collection")
229
- sleep(1)
229
+ yield from bps.sleep(1)
230
230
  caput(pv.bs_roty, 0)
231
- sleep(4)
231
+ yield from bps.sleep(4)
232
232
  caput(pv.bl_mp_select, "In")
233
233
  SSX_LOGGER.debug("Tray Data Collection Done")
234
234
 
@@ -252,17 +252,17 @@ def modechange(action):
252
252
  caput(pv.vgon_pinzs, 0)
253
253
  while float(caget(pv.ttab_x + ".RBV")) > 1:
254
254
  SSX_LOGGER.debug(f"moving ttab_x {caget(pv.ttab_x)}")
255
- sleep(0.1)
255
+ yield from bps.sleep(0.1)
256
256
  while caget(pv.fluo_out_limit) == "OFF":
257
257
  SSX_LOGGER.debug("waiting on fluorescence detector")
258
- sleep(0.1)
258
+ yield from bps.sleep(0.1)
259
259
  while caget(pv.bl_mp_select) != "Out":
260
260
  SSX_LOGGER.debug("waiting on back light to move to out")
261
- sleep(0.1)
261
+ yield from bps.sleep(0.1)
262
262
  caput(pv.bs_mp_select, "Robot")
263
263
  caput(pv.bs_roty, 0)
264
264
  while float(caget(pv.ptab_y + ".RBV")) > -89.0:
265
- sleep(1)
265
+ yield from bps.sleep(1)
266
266
  SSX_LOGGER.debug("Switch To Tray Done")
267
267
 
268
268
  # Tray Switch to Pin
@@ -272,11 +272,11 @@ def modechange(action):
272
272
  caput(pv.hgon_trayys, 0.0)
273
273
  caput(pv.hgon_trayzs, 0.0)
274
274
  while float(caget(pv.ttab_x + ".RBV")) > 1.0:
275
- sleep(1)
275
+ yield from bps.sleep(1)
276
276
  caput(pv.ptab_y, 0)
277
277
  while float(caget(pv.ptab_y + ".RBV")) < -1.0:
278
- sleep(1)
279
- modechange("Pin_data_collection")
278
+ yield from bps.sleep(1)
279
+ yield from modechange("Pin_data_collection")
280
280
  SSX_LOGGER.debug("Switch To Pin Done")
281
281
  else:
282
282
  SSX_LOGGER.debug(f"Unknown action: {action}")
@@ -290,7 +290,6 @@ def pilatus(action, args_list):
290
290
  for arg in args_list:
291
291
  SSX_LOGGER.debug(f"Argument: {arg}")
292
292
 
293
- # caput(pv.pilat_wavelength, caget(pv.dcm_lambda))
294
293
  caput(pv.pilat_detdist, caget(pv.det_z))
295
294
  caput(pv.pilat_filtertrasm, caget(pv.attn_match))
296
295
 
@@ -323,9 +322,9 @@ def pilatus(action, args_list):
323
322
  [filepath, filename, num_imgs, exptime] = args_list
324
323
  rampath = filepath.replace("dls/i24/data", "ramdisk")
325
324
  caput(pv.pilat_filepath, rampath)
326
- sleep(0.1)
325
+ yield from bps.sleep(0.1)
327
326
  caput(pv.pilat_filename, filename)
328
- sleep(0.1)
327
+ yield from bps.sleep(0.1)
329
328
  acqtime = float(exptime) - 0.001
330
329
  caput(pv.pilat_acquiretime, str(acqtime))
331
330
  caput(pv.pilat_acquireperiod, str(exptime))
@@ -336,21 +335,21 @@ def pilatus(action, args_list):
336
335
  SSX_LOGGER.debug(f"Exposure time set as {exptime} s")
337
336
  SSX_LOGGER.debug(f"Acquire time set as {acqtime} s")
338
337
  SSX_LOGGER.debug("Pilatus takes time apprx 2sec")
339
- sleep(2)
338
+ yield from bps.sleep(2)
340
339
  caput(pv.pilat_delaytime, 0.00)
341
340
  caput(pv.pilat_numimages, str(num_imgs))
342
341
  caput(pv.pilat_imagemode, "Continuous")
343
342
  caput(pv.pilat_triggermode, "Ext. Trigger")
344
- sleep(0.2)
343
+ yield from bps.sleep(0.2)
345
344
 
346
345
  elif action == "quickshot-internaltrig":
347
346
  SSX_LOGGER.debug("quickshot-internaltrig")
348
347
  [filepath, filename, num_imgs, exptime] = args_list
349
348
  rampath = filepath.replace("dls/i24/data", "ramdisk")
350
349
  caput(pv.pilat_filepath, rampath)
351
- sleep(0.1)
350
+ yield from bps.sleep(0.1)
352
351
  caput(pv.pilat_filename, filename)
353
- sleep(0.1)
352
+ yield from bps.sleep(0.1)
354
353
  acqtime = float(exptime) - 0.001
355
354
  caput(pv.pilat_acquiretime, str(acqtime))
356
355
  caput(pv.pilat_acquireperiod, str(exptime))
@@ -361,12 +360,12 @@ def pilatus(action, args_list):
361
360
  SSX_LOGGER.debug(f"Exposure time set as {exptime} s")
362
361
  SSX_LOGGER.debug(f"Acquire time set as {acqtime} s")
363
362
  SSX_LOGGER.debug("Pilatus takes time apprx 2sec")
364
- sleep(2)
363
+ yield from bps.sleep(2)
365
364
  caput(pv.pilat_delaytime, 0.00)
366
365
  caput(pv.pilat_numimages, str(num_imgs))
367
366
  caput(pv.pilat_imagemode, "Continuous")
368
367
  caput(pv.pilat_triggermode, "Internal")
369
- sleep(0.2)
368
+ yield from bps.sleep(0.2)
370
369
 
371
370
  # Put it all back to GDA acceptable defaults
372
371
  elif action == "return to normal":
@@ -374,21 +373,21 @@ def pilatus(action, args_list):
374
373
  caput(pv.pilat_triggermode, "Ext. Trigger")
375
374
  caput(pv.pilat_numexpimage, 1)
376
375
  SSX_LOGGER.debug("***** leaving pilatus")
377
- sleep(0.1)
376
+ yield from bps.sleep(0.1)
378
377
  return 0
379
378
 
380
379
 
381
- def eiger(action, args_list):
380
+ def eiger(action, args_list, dcm: DCM):
382
381
  SSX_LOGGER.debug("***** Entering Eiger")
383
382
  SSX_LOGGER.info(f"Setup eiger - {action}")
384
383
  if args_list:
385
384
  for arg in args_list:
386
385
  SSX_LOGGER.debug(f"Argument: {arg}")
387
- # caput(pv.eiger_wavelength, caget(pv.dcm_lambda))
388
386
  caput(pv.eiger_detdist, str(float(caget(pv.det_z)) / 1000))
389
- caput(pv.eiger_wavelength, caget(pv.dcm_lambda))
387
+ dcm_wavelength_a = yield from bps.rd(dcm.wavelength_in_a.user_readback)
388
+ caput(pv.eiger_wavelength, dcm_wavelength_a)
390
389
  caput(pv.eiger_omegaincr, 0.0)
391
- sleep(0.1)
390
+ yield from bps.sleep(0.1)
392
391
  # Setup common to all collections ###
393
392
  caput(pv.eiger_filewriter, "No")
394
393
  caput(pv.eiger_stream, "Yes")
@@ -409,9 +408,9 @@ def eiger(action, args_list):
409
408
  [filepath, filename, num_imgs, exptime] = args_list
410
409
  filename = filename + "_" + str(caget(pv.eiger_seqID))
411
410
  caput(pv.eiger_ODfilepath, filepath)
412
- sleep(0.1)
411
+ yield from bps.sleep(0.1)
413
412
  caput(pv.eiger_ODfilename, filename)
414
- sleep(0.1)
413
+ yield from bps.sleep(0.1)
415
414
  acqtime = float(exptime) - 0.0000001
416
415
  caput(pv.eiger_acquiretime, str(acqtime))
417
416
  SSX_LOGGER.debug(f"Filepath was set as {filepath}")
@@ -425,7 +424,7 @@ def eiger(action, args_list):
425
424
  caput(pv.eiger_triggermode, "Internal Series")
426
425
  caput(pv.eiger_numtriggers, 1)
427
426
  caput(pv.eiger_manualtrigger, "Yes")
428
- sleep(1.0)
427
+ yield from bps.sleep(1.0)
429
428
  # ODIN setup
430
429
  SSX_LOGGER.info("Setting up Odin")
431
430
  caput(pv.eiger_ODfilename, filename)
@@ -435,7 +434,7 @@ def eiger(action, args_list):
435
434
  eigerbdrbv = "UInt" + str(caget(pv.eiger_bitdepthrbv))
436
435
  caput(pv.eiger_ODdatatype, eigerbdrbv)
437
436
  caput(pv.eiger_ODcompress, "BSL24")
438
- sleep(1.0)
437
+ yield from bps.sleep(1.0)
439
438
  # All done. Now get Odin to wait for data and start Eiger
440
439
  SSX_LOGGER.info("Done: Odin waiting for data")
441
440
  caput(pv.eiger_ODcapture, "Capture")
@@ -451,9 +450,9 @@ def eiger(action, args_list):
451
450
  [filepath, filename, num_imgs, exptime] = args_list
452
451
  filename = filename + "_" + str(caget(pv.eiger_seqID))
453
452
  caput(pv.eiger_ODfilepath, filepath)
454
- sleep(0.1)
453
+ yield from bps.sleep(0.1)
455
454
  caput(pv.eiger_ODfilename, filename)
456
- sleep(0.1)
455
+ yield from bps.sleep(0.1)
457
456
  acqtime = float(exptime) - 0.0000001
458
457
  caput(pv.eiger_acquiretime, str(acqtime))
459
458
  SSX_LOGGER.debug(f"Filepath was set as {filepath}")
@@ -467,7 +466,7 @@ def eiger(action, args_list):
467
466
  caput(pv.eiger_triggermode, "External Enable")
468
467
  caput(pv.eiger_numtriggers, str(num_imgs))
469
468
  caput(pv.eiger_manualtrigger, "Yes")
470
- sleep(1.0)
469
+ yield from bps.sleep(1.0)
471
470
  # ODIN setup #
472
471
  SSX_LOGGER.info("Setting up Odin")
473
472
  caput(pv.eiger_ODfilename, filename)
@@ -477,7 +476,7 @@ def eiger(action, args_list):
477
476
  eigerbdrbv = "UInt" + str(caget(pv.eiger_bitdepthrbv))
478
477
  caput(pv.eiger_ODdatatype, eigerbdrbv)
479
478
  caput(pv.eiger_ODcompress, "BSL24")
480
- sleep(1.0)
479
+ yield from bps.sleep(1.0)
481
480
  # All done. Now get Odin to wait for data and start Eiger
482
481
  SSX_LOGGER.info("Done: Odin waiting for data")
483
482
  caput(pv.eiger_ODcapture, "Capture")
@@ -492,7 +491,7 @@ def eiger(action, args_list):
492
491
  caput(pv.eiger_manualtrigger, "No")
493
492
  # caput(pv.eiger_seqID, int(caget(pv.eiger_seqID))+1)
494
493
  SSX_LOGGER.debug("***** leaving Eiger")
495
- sleep(0.1)
494
+ yield from bps.sleep(0.1)
496
495
  return 0
497
496
 
498
497
 
@@ -510,10 +509,10 @@ def xspress3(action, args_list):
510
509
  caput(pv.xsp3_acquiretime, exp_time)
511
510
  caput(pv.xsp3_c1_mca_roi1_llm, lo)
512
511
  caput(pv.xsp3_c1_mca_roi1_hlm, hi)
513
- sleep(0.2)
512
+ yield from bps.sleep(0.2)
514
513
  caput(pv.xsp3_c1_mca_roi1_llm, lo)
515
514
  caput(pv.xsp3_c1_mca_roi1_hlm, hi)
516
- sleep(0.2)
515
+ yield from bps.sleep(0.2)
517
516
  caput(pv.xsp3_erase, 0)
518
517
 
519
518
  elif action == "on-the-fly":
@@ -522,10 +521,10 @@ def xspress3(action, args_list):
522
521
  caput(pv.xsp3_numimages, num_frms)
523
522
  caput(pv.xsp3_c1_mca_roi1_llm, lo)
524
523
  caput(pv.xsp3_c1_mca_roi1_hlm, hi)
525
- sleep(0.2)
524
+ yield from bps.sleep(0.2)
526
525
  caput(pv.xsp3_c1_mca_roi1_llm, lo)
527
526
  caput(pv.xsp3_c1_mca_roi1_hlm, hi)
528
- sleep(0.2)
527
+ yield from bps.sleep(0.2)
529
528
  caput(pv.xsp3_erase, 0)
530
529
 
531
530
  elif action == "return-to-normal":
@@ -539,6 +538,6 @@ def xspress3(action, args_list):
539
538
  else:
540
539
  SSX_LOGGER.error("Unknown action for xspress3 method:", action)
541
540
 
542
- sleep(0.1)
541
+ yield from bps.sleep(0.1)
543
542
  SSX_LOGGER.debug("***** leaving xspress3")
544
543
  return 1
@@ -13,7 +13,7 @@ from dodal.devices.i24.i24_detector_motion import DetectorMotion
13
13
  from mx_bluesky.beamlines.i24.serial.log import SSX_LOGGER
14
14
  from mx_bluesky.beamlines.i24.serial.parameters import SSXType
15
15
  from mx_bluesky.beamlines.i24.serial.setup_beamline import pv
16
- from mx_bluesky.beamlines.i24.serial.setup_beamline.ca import caget
16
+ from mx_bluesky.beamlines.i24.serial.setup_beamline.ca import caget, caput
17
17
  from mx_bluesky.beamlines.i24.serial.setup_beamline.pv_abstract import (
18
18
  Detector,
19
19
  Eiger,
@@ -22,7 +22,7 @@ from mx_bluesky.beamlines.i24.serial.setup_beamline.pv_abstract import (
22
22
 
23
23
  EXPT_TYPE_DETECTOR_PVS = {
24
24
  SSXType.FIXED: pv.me14e_gp101,
25
- SSXType.EXTRUDER: pv.ioc12_gp15,
25
+ SSXType.EXTRUDER: pv.ioc13_gp15,
26
26
  }
27
27
 
28
28
 
@@ -93,4 +93,5 @@ def setup_detector_stage(
93
93
  Eiger.det_y_target if requested_detector == "eiger" else Pilatus.det_y_target
94
94
  )
95
95
  yield from _move_detector_stage(detector_stage, det_y_target)
96
+ caput(det_type_pv, requested_detector)
96
97
  SSX_LOGGER.info("Detector setup done.")
@@ -272,7 +272,7 @@ def setup_zebra_for_fastchip_plan(
272
272
  det_type: str,
273
273
  num_gates: int,
274
274
  num_exposures: int,
275
- exposure_time: float,
275
+ exposure_time_s: float,
276
276
  start_time_offset: float = 0.0,
277
277
  group: str = "setup_zebra_for_fastchip",
278
278
  wait: bool = True,
@@ -303,7 +303,7 @@ def setup_zebra_for_fastchip_plan(
303
303
  det_type (str): Detector in use, current choices are Eiger or Pilatus.
304
304
  num_gates (int): Number of apertures to visit in a chip.
305
305
  num_exposures (int): Number of times data is collected in each aperture.
306
- exposure_time (float): Exposure time for each shot.
306
+ exposure_time_s (float): Exposure time for each shot.
307
307
  start_time_offset (float): Delay on the start of the position compare. \
308
308
  Defaults to 0.0 (standard chip collection).
309
309
  """
@@ -341,10 +341,12 @@ def setup_zebra_for_fastchip_plan(
341
341
  )
342
342
 
343
343
  # Square wave - needs a small drop to make it work for eiger
344
- pulse_width = exposure_time - 0.0001 if det_type == "eiger" else exposure_time / 2
344
+ pulse_width = (
345
+ exposure_time_s - 0.0001 if det_type == "eiger" else exposure_time_s / 2
346
+ )
345
347
 
346
348
  # 100us buffer needed to avoid missing some of the triggers
347
- exptime_buffer = exposure_time + 0.0001
349
+ exptime_buffer = exposure_time_s + 0.0001
348
350
 
349
351
  # Number of gates is the number of windows collected
350
352
  yield from bps.abs_set(zebra.pc.num_gates, num_gates, group=group)
@@ -362,7 +364,7 @@ def setup_zebra_for_fastchip_plan(
362
364
  def open_fast_shutter_at_each_position_plan(
363
365
  zebra: Zebra,
364
366
  num_exposures: int,
365
- exposure_time: float,
367
+ exposure_time_s: float,
366
368
  group: str = "fast_shutter_control",
367
369
  wait: bool = True,
368
370
  ):
@@ -384,7 +386,7 @@ def open_fast_shutter_at_each_position_plan(
384
386
  Args:
385
387
  zebra (Zebra): The zebra ophyd device.
386
388
  num_exposures (int): Number of times data is collected in each aperture.
387
- exposure_time (float): Exposure time for each shot.
389
+ exposure_time_s (float): Exposure time for each shot.
388
390
  """
389
391
  SSX_LOGGER.info(
390
392
  "ZEBRA setup for fastchip collection with long delays between exposures."
@@ -395,7 +397,7 @@ def open_fast_shutter_at_each_position_plan(
395
397
  zebra.output.pulse_2.input, zebra.mapping.sources.PC_GATE, group=group
396
398
  )
397
399
  yield from bps.abs_set(zebra.output.pulse_2.delay, 0.0, group=group)
398
- pulse2_width = num_exposures * exposure_time + SHUTTER_OPEN_TIME
400
+ pulse2_width = num_exposures * exposure_time_s + SHUTTER_OPEN_TIME
399
401
  yield from bps.abs_set(zebra.output.pulse_2.width, pulse2_width, group=group)
400
402
 
401
403
  # Fast shutter
@@ -5,6 +5,11 @@ import bluesky.plan_stubs as bps
5
5
  import bluesky.preprocessors as bpp
6
6
  from blueapi.core import MsgGenerator
7
7
  from dodal.beamlines import i24
8
+ from dodal.common import inject
9
+ from dodal.devices.i24.dual_backlight import BacklightPositions, DualBacklight
10
+ from dodal.devices.i24.i24_detector_motion import DetectorMotion
11
+ from dodal.devices.i24.pmac import PMAC
12
+ from dodal.devices.oav.oav_detector import OAV
8
13
 
9
14
  from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import (
10
15
  ChipType,
@@ -14,11 +19,15 @@ from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import (
14
19
  from mx_bluesky.beamlines.i24.serial.fixed_target.i24ssx_moveonclick import (
15
20
  _move_on_mouse_click_plan,
16
21
  )
17
- from mx_bluesky.beamlines.i24.serial.log import _read_visit_directory_from_file
22
+ from mx_bluesky.beamlines.i24.serial.log import (
23
+ SSX_LOGGER,
24
+ _read_visit_directory_from_file,
25
+ )
18
26
  from mx_bluesky.beamlines.i24.serial.parameters import (
19
27
  FixedTargetParameters,
20
28
  get_chip_format,
21
29
  )
30
+ from mx_bluesky.beamlines.i24.serial.parameters.utils import EmptyMapError
22
31
  from mx_bluesky.beamlines.i24.serial.setup_beamline import pv
23
32
  from mx_bluesky.beamlines.i24.serial.setup_beamline.ca import caput
24
33
  from mx_bluesky.beamlines.i24.serial.setup_beamline.pv_abstract import Eiger, Pilatus
@@ -29,9 +38,18 @@ from mx_bluesky.beamlines.i24.serial.setup_beamline.setup_detector import (
29
38
 
30
39
 
31
40
  @bpp.run_decorator()
32
- def gui_stage_move_on_click(position_px: tuple[int, int]) -> MsgGenerator:
33
- oav = i24.oav()
34
- pmac = i24.pmac()
41
+ def gui_move_backlight(
42
+ position: str, backlight: DualBacklight = inject("backlight")
43
+ ) -> MsgGenerator:
44
+ bl_pos = BacklightPositions(position)
45
+ yield from bps.abs_set(backlight, bl_pos, wait=True)
46
+ SSX_LOGGER.debug(f"Backlight moved to {bl_pos.value}")
47
+
48
+
49
+ @bpp.run_decorator()
50
+ def gui_stage_move_on_click(
51
+ position_px: tuple[int, int], oav: OAV = inject("oav"), pmac: PMAC = inject("pmac")
52
+ ) -> MsgGenerator:
35
53
  yield from _move_on_mouse_click_plan(oav, pmac, position_px)
36
54
 
37
55
 
@@ -58,11 +76,14 @@ def gui_sleep(sec: int) -> MsgGenerator:
58
76
 
59
77
 
60
78
  @bpp.run_decorator()
61
- def gui_move_detector(det: Literal["eiger", "pilatus"]) -> MsgGenerator:
62
- detector_stage = i24.detector_motion()
79
+ def gui_move_detector(
80
+ det: Literal["eiger", "pilatus"],
81
+ detector_stage: DetectorMotion = inject("detector_motion"),
82
+ ) -> MsgGenerator:
63
83
  det_y_target = Eiger.det_y_target if det == "eiger" else Pilatus.det_y_target
64
84
  yield from _move_detector_stage(detector_stage, det_y_target)
65
85
  # Make the output readable
86
+ SSX_LOGGER.debug(f"Detector move done, resetting general PV to {det}")
66
87
  caput(pv.me14e_gp101, det)
67
88
 
68
89
 
@@ -75,16 +96,55 @@ def gui_set_parameters(
75
96
  transmission: float,
76
97
  n_shots: int,
77
98
  chip_type: str,
99
+ map_type: str,
100
+ chip_format: list[int | float], # for Lite Oxford it's the chipmap
78
101
  checker_pattern: bool,
79
102
  pump_probe: str,
80
103
  laser_dwell: float,
81
104
  laser_delay: float,
82
105
  pre_pump: float,
83
106
  ) -> MsgGenerator:
107
+ """Set the parameter model for the data collection.
108
+
109
+ Args:
110
+ sub_dir (str): subdirectory of the visit to write data in.
111
+ chip_name (str): a name identifying the current chip collection, will be used
112
+ as filename.
113
+ exp_time (float): exposure time of each window shot, in s.
114
+ det_dist (float): sample-detector distance, in mm.
115
+ transmission (float): requested beam intensity transmission, expressed as
116
+ a fraction, e.g. 0.3.
117
+ n_shots (int): number of times each window should be collected.
118
+ chip_type (str): type of chip in use.
119
+ map_type (str): if an Oxford chip is used, define whether it's a full chip
120
+ collection or lite mapping is in use. For all other chip, this will be None.
121
+ chip_format (list[int|float]): for a custom chip, a list of the number of x,y
122
+ steps and the x,y step size. For an Oxford chip, the list should be empty
123
+ if collecting a full chip and a list of the block numbers to scan for a
124
+ lite collection.
125
+ checker_pattern (bool): whether checker_pattern is turned on, ie. only every
126
+ other window in a block gets collected
127
+ pump_probe (str): pump probe setting.
128
+ laser_dwell (float): laser exposure time for pump probe collections, in s.
129
+ laser_delay (float): delay between laser exposure and collection, in s.
130
+ pre_pump (float): pre-pump exposure time for a pump probe short2 collection,
131
+ ie a pump-in-probe where the collection starts during the pump.
132
+ """
84
133
  # NOTE still a work in progress, adding to it as the ui grows
134
+ # See progression of https://github.com/DiamondLightSource/mx-daq-ui/issues/3
85
135
  detector_stage = i24.detector_motion()
86
136
  det_type = yield from get_detector_type(detector_stage)
87
- chip_params = get_chip_format(ChipType[chip_type])
137
+ _format = chip_format if ChipType[chip_type] is ChipType.Custom else None
138
+ chip_params = get_chip_format(ChipType[chip_type], _format)
139
+ if ChipType[chip_type] in [ChipType.Oxford, ChipType.OxfordInner]:
140
+ mapping = MappingType.Lite if map_type == "Lite" else MappingType.NoMap
141
+ if mapping is MappingType.Lite and len(chip_format) == 0:
142
+ # this logic should go in the gui with error message.
143
+ raise EmptyMapError("No blocks chosen")
144
+ chip_map = chip_format
145
+ else:
146
+ mapping = MappingType.NoMap
147
+ chip_map = []
88
148
 
89
149
  params = {
90
150
  "visit": _read_visit_directory_from_file().as_posix(), # noqa
@@ -96,14 +156,14 @@ def gui_set_parameters(
96
156
  "num_exposures": n_shots,
97
157
  "transmission": transmission,
98
158
  "chip": chip_params,
99
- "map_type": MappingType.NoMap,
100
- "chip_map": [],
159
+ "map_type": mapping,
160
+ "chip_map": chip_map,
101
161
  "pump_repeat": PumpProbeSetting[pump_probe], # pump_repeat,
102
162
  "laser_dwell_s": laser_dwell,
103
163
  "laser_delay_s": laser_delay,
104
164
  "checker_pattern": checker_pattern,
105
165
  "pre_pump_exposure_s": pre_pump,
106
166
  }
107
- print(FixedTargetParameters(**params))
108
- # This will then run the run_fixed_target plan
167
+ # TODO run the run_fixed_target plan once params are set (GUI not ready yet)
109
168
  yield from bps.sleep(0.5)
169
+ return FixedTargetParameters(**params)
@@ -4,6 +4,7 @@ import pprint
4
4
  import time
5
5
  from datetime import datetime
6
6
 
7
+ import bluesky.plan_stubs as bps
7
8
  import requests
8
9
 
9
10
  from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import ChipType, MappingType
@@ -20,7 +21,7 @@ def call_nexgen(
20
21
  parameters: ExtruderParameters | FixedTargetParameters,
21
22
  wavelength_in_a: float,
22
23
  beam_center_in_pix: tuple[float, float],
23
- start_time: datetime | None = None,
24
+ start_time: datetime,
24
25
  ):
25
26
  """Call the nexus writer by sending a request to nexgen-server.
26
27
 
@@ -31,7 +32,7 @@ def call_nexgen(
31
32
  parameters (SerialAndLaserExperiment): Collection parameters.
32
33
  wavelength_in_a (float): Wavelength, in A.
33
34
  beam_center_in_pix (list[float]): Beam center position on detector, in pixels.
34
- start_time (datetime, optional): Collection start time.
35
+ start_time (datetime): Collection start time.
35
36
 
36
37
  Raises:
37
38
  ValueError: For a wrong experiment type passed (either unknwon or not matched \
@@ -61,10 +62,10 @@ def call_nexgen(
61
62
  while time.time() - t0 < max_wait:
62
63
  if meta_h5.exists():
63
64
  SSX_LOGGER.info(f"Found {meta_h5} after {time.time() - t0:.1f} seconds")
64
- time.sleep(5)
65
+ yield from bps.sleep(5)
65
66
  break
66
67
  SSX_LOGGER.debug(f"Waiting for {meta_h5}")
67
- time.sleep(1)
68
+ yield from bps.sleep(1)
68
69
  if not meta_h5.exists():
69
70
  SSX_LOGGER.warning(f"Giving up waiting for {meta_h5} after {max_wait} seconds")
70
71
  return
@@ -95,7 +96,7 @@ def call_nexgen(
95
96
  "visitpath": os.fspath(meta_h5.parent),
96
97
  "wavelength": wavelength_in_a,
97
98
  "bit_depth": bit_depth,
98
- "start_time": start_time,
99
+ "start_time": start_time.isoformat(),
99
100
  }
100
101
  SSX_LOGGER.info(f"Sending POST request to {url} with payload:")
101
102
  SSX_LOGGER.info(pprint.pformat(payload))
@@ -1,5 +1,5 @@
1
1
  import bluesky.plan_stubs as bps
2
- from dodal.devices.i03.beamstop import Beamstop, BeamstopPositions
2
+ from dodal.devices.mx_phase1.beamstop import Beamstop, BeamstopPositions
3
3
 
4
4
  from mx_bluesky.common.utils.log import LOGGER
5
5
 
@@ -47,7 +47,7 @@ def move_aperture_if_required(
47
47
  else:
48
48
  LOGGER.info(f"Setting aperture position to {aperture_value}")
49
49
  yield from bps.abs_set(
50
- aperture_scatterguard,
50
+ aperture_scatterguard.selected_aperture,
51
51
  aperture_value,
52
52
  group=group,
53
53
  )
@@ -6,15 +6,18 @@ from dodal.devices.oav.oav_detector import OAV
6
6
  from dodal.devices.oav.oav_parameters import OAVParameters
7
7
  from dodal.devices.oav.pin_image_recognition import PinTipDetection
8
8
 
9
- from mx_bluesky.hyperion.parameters.constants import CONST
10
-
11
- # Helper function to make sure we set the waiting groups correctly
12
- set_using_group = partial(bps.abs_set, group=CONST.WAIT.READY_FOR_OAV)
9
+ from mx_bluesky.common.parameters.constants import (
10
+ PlanGroupCheckpointConstants,
11
+ )
13
12
 
14
13
 
15
14
  def setup_pin_tip_detection_params(
16
- pin_tip_detect_device: PinTipDetection, parameters: OAVParameters
15
+ pin_tip_detect_device: PinTipDetection,
16
+ parameters: OAVParameters,
17
17
  ):
18
+ set_using_group = partial(
19
+ bps.abs_set, group=PlanGroupCheckpointConstants.READY_FOR_OAV
20
+ )
18
21
  # select which blur to apply to image
19
22
  yield from set_using_group(
20
23
  pin_tip_detect_device.preprocess_operation, parameters.preprocess
@@ -55,6 +58,9 @@ def setup_pin_tip_detection_params(
55
58
 
56
59
 
57
60
  def setup_general_oav_params(oav: OAV, parameters: OAVParameters):
61
+ set_using_group = partial(
62
+ bps.abs_set, group=PlanGroupCheckpointConstants.READY_FOR_OAV
63
+ )
58
64
  yield from set_using_group(oav.cam.color_mode, ColorMode.RGB1)
59
65
  yield from set_using_group(oav.cam.acquire_period, parameters.acquire_period)
60
66
  yield from set_using_group(oav.cam.acquire_time, parameters.exposure)
@@ -78,4 +84,4 @@ def pre_centring_setup_oav(
78
84
  """
79
85
  yield from setup_general_oav_params(oav, parameters)
80
86
  yield from setup_pin_tip_detection_params(pin_tip_detection_device, parameters)
81
- yield from bps.wait(CONST.WAIT.READY_FOR_OAV)
87
+ yield from bps.wait(PlanGroupCheckpointConstants.READY_FOR_OAV)