mx-bluesky 1.5.9__py3-none-any.whl → 1.5.11__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 (87) hide show
  1. mx_bluesky/_version.py +2 -2
  2. mx_bluesky/beamlines/aithre_lasershaping/goniometer_controls.py +2 -2
  3. mx_bluesky/beamlines/i02_1/parameters/gridscan.py +1 -1
  4. mx_bluesky/beamlines/i04/experiment_plans/i04_grid_detect_then_xray_centre_plan.py +9 -9
  5. mx_bluesky/beamlines/i04/thawing_plan.py +9 -9
  6. mx_bluesky/beamlines/i24/jungfrau_commissioning/experiment_plans/do_darks.py +123 -0
  7. mx_bluesky/beamlines/i24/jungfrau_commissioning/plan_stubs/__init__.py +1 -0
  8. mx_bluesky/beamlines/i24/jungfrau_commissioning/{do_external_acquisition.py → plan_stubs/do_external_acquisition.py} +8 -7
  9. mx_bluesky/beamlines/i24/jungfrau_commissioning/{do_internal_acquisition.py → plan_stubs/do_internal_acquisition.py} +4 -3
  10. mx_bluesky/beamlines/i24/jungfrau_commissioning/{plan_utils.py → plan_stubs/plan_utils.py} +21 -28
  11. mx_bluesky/beamlines/i24/serial/__init__.py +7 -5
  12. mx_bluesky/beamlines/i24/serial/dcid.py +3 -3
  13. mx_bluesky/beamlines/i24/serial/extruder/{i24ssx_Extruder_Collect_py3v2.py → i24ssx_extruder_collect_py3v2.py} +65 -35
  14. mx_bluesky/beamlines/i24/serial/fixed_target/{i24ssx_Chip_Collect_py3v1.py → i24ssx_chip_collect_py3v1.py} +5 -5
  15. mx_bluesky/beamlines/i24/serial/fixed_target/{i24ssx_Chip_Manager_py3v1.py → i24ssx_chip_manager_py3v1.py} +46 -46
  16. mx_bluesky/beamlines/i24/serial/fixed_target/{i24ssx_Chip_StartUp_py3v1.py → i24ssx_chip_startup_py3v1.py} +3 -3
  17. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py +33 -33
  18. mx_bluesky/beamlines/i24/serial/log.py +11 -11
  19. mx_bluesky/beamlines/i24/serial/parameters/fixed_target/cs/cs_maker.json +3 -3
  20. mx_bluesky/beamlines/i24/serial/setup_beamline/ca.py +0 -12
  21. mx_bluesky/beamlines/i24/serial/setup_beamline/pv.py +13 -32
  22. mx_bluesky/beamlines/i24/serial/setup_beamline/pv_abstract.py +5 -5
  23. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +22 -249
  24. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +2 -2
  25. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +4 -4
  26. mx_bluesky/beamlines/i24/serial/web_gui_plans/general_plans.py +102 -15
  27. mx_bluesky/beamlines/i24/serial/write_nexus.py +4 -4
  28. mx_bluesky/common/device_setup_plans/robot_load_unload.py +2 -2
  29. mx_bluesky/common/device_setup_plans/setup_oav.py +1 -1
  30. mx_bluesky/common/device_setup_plans/xbpm_feedback.py +4 -4
  31. mx_bluesky/common/experiment_plans/common_flyscan_xray_centre_plan.py +9 -9
  32. mx_bluesky/common/experiment_plans/common_grid_detect_then_xray_centre_plan.py +2 -2
  33. mx_bluesky/common/experiment_plans/inner_plans/do_fgs.py +2 -2
  34. mx_bluesky/common/experiment_plans/inner_plans/read_hardware.py +5 -5
  35. mx_bluesky/common/experiment_plans/inner_plans/udc_default_state.py +22 -1
  36. mx_bluesky/common/experiment_plans/inner_plans/write_sample_status.py +2 -2
  37. mx_bluesky/common/experiment_plans/oav_grid_detection_plan.py +2 -2
  38. mx_bluesky/common/experiment_plans/oav_snapshot_plan.py +1 -1
  39. mx_bluesky/common/external_interaction/callbacks/common/ispyb_callback_base.py +3 -3
  40. mx_bluesky/common/external_interaction/callbacks/common/plan_reactive_callback.py +1 -1
  41. mx_bluesky/common/external_interaction/callbacks/common/zocalo_callback.py +2 -2
  42. mx_bluesky/common/external_interaction/callbacks/sample_handling/sample_handling_callback.py +3 -3
  43. mx_bluesky/common/external_interaction/callbacks/xray_centre/ispyb_callback.py +7 -5
  44. mx_bluesky/common/external_interaction/callbacks/xray_centre/nexus_callback.py +2 -2
  45. mx_bluesky/common/external_interaction/config_server.py +2 -2
  46. mx_bluesky/common/external_interaction/ispyb/exp_eye_store.py +4 -2
  47. mx_bluesky/common/external_interaction/ispyb/ispyb_store.py +0 -1
  48. mx_bluesky/common/external_interaction/nexus/nexus_utils.py +2 -2
  49. mx_bluesky/common/external_interaction/nexus/write_nexus.py +3 -3
  50. mx_bluesky/common/parameters/constants.py +1 -1
  51. mx_bluesky/common/parameters/device_composites.py +2 -2
  52. mx_bluesky/common/parameters/gridscan.py +2 -2
  53. mx_bluesky/common/utils/exceptions.py +9 -7
  54. mx_bluesky/common/utils/log.py +4 -4
  55. mx_bluesky/common/utils/tracing.py +5 -5
  56. mx_bluesky/common/utils/utils.py +8 -8
  57. mx_bluesky/hyperion/__main__.py +5 -5
  58. mx_bluesky/hyperion/baton_handler.py +15 -8
  59. mx_bluesky/hyperion/device_setup_plans/smargon.py +5 -5
  60. mx_bluesky/hyperion/device_setup_plans/utils.py +1 -1
  61. mx_bluesky/hyperion/experiment_plans/experiment_registry.py +1 -1
  62. mx_bluesky/hyperion/experiment_plans/hyperion_flyscan_xray_centre_plan.py +19 -18
  63. mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +54 -40
  64. mx_bluesky/hyperion/experiment_plans/optimise_attenuation_plan.py +9 -9
  65. mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +2 -2
  66. mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +5 -5
  67. mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +3 -3
  68. mx_bluesky/hyperion/external_interaction/agamemnon.py +2 -2
  69. mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +2 -2
  70. mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_callback.py +1 -1
  71. mx_bluesky/hyperion/external_interaction/callbacks/rotation/nexus_callback.py +2 -2
  72. mx_bluesky/hyperion/external_interaction/config_server.py +2 -2
  73. mx_bluesky/hyperion/parameters/constants.py +2 -2
  74. mx_bluesky/hyperion/parameters/device_composites.py +2 -2
  75. mx_bluesky/hyperion/parameters/gridscan.py +4 -4
  76. mx_bluesky/hyperion/parameters/rotation.py +4 -6
  77. mx_bluesky/hyperion/plan_runner.py +6 -6
  78. mx_bluesky/hyperion/runner.py +10 -8
  79. mx_bluesky/hyperion/utils/context.py +6 -1
  80. mx_bluesky/jupyter_example.ipynb +3 -3
  81. {mx_bluesky-1.5.9.dist-info → mx_bluesky-1.5.11.dist-info}/METADATA +7 -6
  82. {mx_bluesky-1.5.9.dist-info → mx_bluesky-1.5.11.dist-info}/RECORD +87 -85
  83. /mx_bluesky/beamlines/i24/jungfrau_commissioning/{__init__.py → experiment_plans/__init__.py} +0 -0
  84. {mx_bluesky-1.5.9.dist-info → mx_bluesky-1.5.11.dist-info}/WHEEL +0 -0
  85. {mx_bluesky-1.5.9.dist-info → mx_bluesky-1.5.11.dist-info}/entry_points.txt +0 -0
  86. {mx_bluesky-1.5.9.dist-info → mx_bluesky-1.5.11.dist-info}/licenses/LICENSE +0 -0
  87. {mx_bluesky-1.5.9.dist-info → mx_bluesky-1.5.11.dist-info}/top_level.txt +0 -0
mx_bluesky/_version.py CHANGED
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '1.5.9'
32
- __version_tuple__ = version_tuple = (1, 5, 9)
31
+ __version__ = version = '1.5.11'
32
+ __version_tuple__ = version_tuple = (1, 5, 11)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -53,9 +53,9 @@ def go_to_furthest_maximum(
53
53
  ) -> MsgGenerator:
54
54
  """Rotate to positive or negative maximum, whichever is further away"""
55
55
 
56
- LIMIT_OF_TRAVEL = 3600
56
+ limit_of_travel = 3600
57
57
  current_value: float = yield from bps.rd(goniometer.omega.user_readback)
58
58
 
59
59
  yield from bps.mv(
60
- goniometer.omega, -LIMIT_OF_TRAVEL if current_value > 0 else LIMIT_OF_TRAVEL
60
+ goniometer.omega, -limit_of_travel if current_value > 0 else limit_of_travel
61
61
  )
@@ -20,7 +20,7 @@ class SpecifiedTwoDGridScan(
20
20
  return self.grid_1_spec
21
21
 
22
22
  @property
23
- def FGS_params(self) -> ZebraGridScanParamsTwoD:
23
+ def fast_gridscan_params(self) -> ZebraGridScanParamsTwoD:
24
24
  return ZebraGridScanParamsTwoD(
25
25
  x_steps=self.x_steps,
26
26
  y_steps=self.y_steps,
@@ -9,7 +9,7 @@ from dodal.common import inject
9
9
  from dodal.devices.aperturescatterguard import ApertureScatterguard, ApertureValue
10
10
  from dodal.devices.attenuator.attenuator import BinaryFilterAttenuator
11
11
  from dodal.devices.backlight import Backlight
12
- from dodal.devices.common_dcm import BaseDCM
12
+ from dodal.devices.common_dcm import DoubleCrystalMonochromator
13
13
  from dodal.devices.detector.detector_motion import DetectorMotion
14
14
  from dodal.devices.eiger import EigerDetector
15
15
  from dodal.devices.fast_grid_scan import (
@@ -40,13 +40,13 @@ from mx_bluesky.common.device_setup_plans.setup_zebra_and_shutter import (
40
40
  )
41
41
  from mx_bluesky.common.experiment_plans.common_flyscan_xray_centre_plan import (
42
42
  BeamlineSpecificFGSFeatures,
43
- construct_beamline_specific_FGS_features,
43
+ construct_beamline_specific_fast_gridscan_features,
44
44
  )
45
45
  from mx_bluesky.common.experiment_plans.common_grid_detect_then_xray_centre_plan import (
46
46
  grid_detect_then_xray_centre,
47
47
  )
48
48
  from mx_bluesky.common.experiment_plans.oav_snapshot_plan import (
49
- setup_beamline_for_OAV,
49
+ setup_beamline_for_oav,
50
50
  )
51
51
  from mx_bluesky.common.external_interaction.callbacks.common.zocalo_callback import (
52
52
  ZocaloCallback,
@@ -97,7 +97,7 @@ def i04_grid_detect_then_xray_centre(
97
97
  attenuator: BinaryFilterAttenuator = inject("attenuator"),
98
98
  backlight: Backlight = inject("backlight"),
99
99
  beamstop: Beamstop = inject("beamstop"),
100
- dcm: BaseDCM = inject("dcm"),
100
+ dcm: DoubleCrystalMonochromator = inject("dcm"),
101
101
  zebra_fast_grid_scan: ZebraFastGridScanThreeD = inject("zebra_fast_grid_scan"),
102
102
  flux: Flux = inject("flux"),
103
103
  oav: OAV = inject("oav"),
@@ -200,7 +200,7 @@ def get_ready_for_oav_and_close_shutter(
200
200
  yield from bps.wait(PlanGroupCheckpointConstants.GRID_READY_FOR_DC)
201
201
  group = "get_ready_for_oav_and_close_shutter"
202
202
  LOGGER.info("Non-udc tidy: Setting up beamline for OAV")
203
- yield from setup_beamline_for_OAV(
203
+ yield from setup_beamline_for_oav(
204
204
  smargon, backlight, aperture_scatterguard, group=group
205
205
  )
206
206
  LOGGER.info("Non-udc tidy: Closing detector shutter")
@@ -243,14 +243,14 @@ def construct_i04_specific_features(
243
243
  xrc_composite.smargon.x,
244
244
  xrc_composite.smargon.y,
245
245
  xrc_composite.smargon.z,
246
- xrc_composite.dcm.energy_in_kev,
246
+ xrc_composite.dcm.energy_in_keV,
247
247
  ]
248
248
 
249
249
  signals_to_read_during_collection = [
250
250
  xrc_composite.aperture_scatterguard,
251
251
  xrc_composite.attenuator.actual_transmission,
252
252
  xrc_composite.flux.flux_reading,
253
- xrc_composite.dcm.energy_in_kev,
253
+ xrc_composite.dcm.energy_in_keV,
254
254
  xrc_composite.eiger.bit_depth,
255
255
  ]
256
256
 
@@ -264,10 +264,10 @@ def construct_i04_specific_features(
264
264
  set_flyscan_params_plan = partial(
265
265
  set_fast_grid_scan_params,
266
266
  xrc_composite.zebra_fast_grid_scan,
267
- xrc_parameters.FGS_params,
267
+ xrc_parameters.fast_gridscan_params,
268
268
  )
269
269
  fgs_motors = xrc_composite.zebra_fast_grid_scan
270
- return construct_beamline_specific_FGS_features(
270
+ return construct_beamline_specific_fast_gridscan_features(
271
271
  partial(
272
272
  setup_zebra_for_gridscan,
273
273
  ),
@@ -62,7 +62,7 @@ def thaw_and_stream_to_redis(
62
62
  defaults are always correct
63
63
  """
64
64
 
65
- def switch_forwarder_to_ROI() -> MsgGenerator:
65
+ def switch_forwarder_to_roi() -> MsgGenerator:
66
66
  yield from bps.complete(oav_to_redis_forwarder, wait=True)
67
67
  yield from bps.mv(oav_to_redis_forwarder.selected_source, Source.ROI.value)
68
68
  yield from bps.kickoff(oav_to_redis_forwarder, wait=True)
@@ -75,7 +75,7 @@ def thaw_and_stream_to_redis(
75
75
  smargon,
76
76
  oav,
77
77
  oav_to_redis_forwarder,
78
- switch_forwarder_to_ROI,
78
+ switch_forwarder_to_roi,
79
79
  )
80
80
 
81
81
 
@@ -110,14 +110,14 @@ def thaw_and_murko_centre(
110
110
  defaults are always correct
111
111
  """
112
112
 
113
- MURKO_RESULTS_GROUP = "get_results"
113
+ murko_results_group = "get_results"
114
114
 
115
- def centre_then_switch_forwarder_to_ROI() -> MsgGenerator:
115
+ def centre_then_switch_forwarder_to_roi() -> MsgGenerator:
116
116
  yield from bps.complete(oav_to_redis_forwarder, wait=True)
117
117
 
118
118
  yield from bps.mv(oav_to_redis_forwarder.selected_source, Source.ROI.value)
119
119
 
120
- yield from bps.wait(MURKO_RESULTS_GROUP)
120
+ yield from bps.wait(murko_results_group)
121
121
  x_predict = yield from bps.rd(murko_results.x_mm)
122
122
  y_predict = yield from bps.rd(murko_results.y_mm)
123
123
  z_predict = yield from bps.rd(murko_results.z_mm)
@@ -132,7 +132,7 @@ def thaw_and_murko_centre(
132
132
  yield from bps.mv(murko_results.sample_id, str(sample_id))
133
133
 
134
134
  yield from bps.stage(murko_results, wait=True)
135
- yield from bps.trigger(murko_results, group=MURKO_RESULTS_GROUP)
135
+ yield from bps.trigger(murko_results, group=murko_results_group)
136
136
 
137
137
  yield from bpp.contingency_wrapper(
138
138
  _thaw_and_stream_to_redis(
@@ -143,7 +143,7 @@ def thaw_and_murko_centre(
143
143
  smargon,
144
144
  oav,
145
145
  oav_to_redis_forwarder,
146
- centre_then_switch_forwarder_to_ROI,
146
+ centre_then_switch_forwarder_to_roi,
147
147
  ),
148
148
  final_plan=partial(bps.unstage, murko_results, wait=True),
149
149
  )
@@ -168,7 +168,7 @@ def _thaw(
168
168
  plan_between_rotations (MsgGenerator, optional): A plan to run between rotations
169
169
  of the smargon. Defaults to no plan.
170
170
  """
171
- inital_velocity = yield from bps.rd(smargon.omega.velocity)
171
+ initial_velocity = yield from bps.rd(smargon.omega.velocity)
172
172
  new_velocity = abs(rotation / time_to_thaw) * 2.0
173
173
 
174
174
  def do_thaw():
@@ -180,7 +180,7 @@ def _thaw(
180
180
  yield from bps.rel_set(smargon.omega, -rotation, wait=True)
181
181
 
182
182
  def cleanup():
183
- yield from bps.abs_set(smargon.omega.velocity, inital_velocity, wait=True)
183
+ yield from bps.abs_set(smargon.omega.velocity, initial_velocity, wait=True)
184
184
  yield from bps.abs_set(thawer.control, OnOff.OFF, wait=True)
185
185
 
186
186
  # Always cleanup even if there is a failure
@@ -0,0 +1,123 @@
1
+ import bluesky.preprocessors as bpp
2
+ from bluesky import plan_stubs as bps
3
+ from bluesky.utils import MsgGenerator
4
+ from dodal.common import inject
5
+ from dodal.devices.i24.commissioning_jungfrau import CommissioningJungfrau
6
+ from ophyd_async.fastcs.jungfrau import (
7
+ AcquisitionType,
8
+ GainMode,
9
+ create_jungfrau_internal_triggering_info,
10
+ create_jungfrau_pedestal_triggering_info,
11
+ )
12
+ from pydantic import PositiveInt
13
+
14
+ from mx_bluesky.beamlines.i24.jungfrau_commissioning.plan_stubs.plan_utils import (
15
+ fly_jungfrau,
16
+ override_file_path,
17
+ )
18
+ from mx_bluesky.common.utils.log import LOGGER
19
+
20
+ PEDESTAL_DARKS_RUN = "PEDESTAL DARKS RUN"
21
+ STANDARD_DARKS_RUN = "STANDARD DARKS RUN"
22
+
23
+
24
+ def do_pedestal_darks(
25
+ exp_time_s: float = 0.001,
26
+ pedestal_frames: PositiveInt = 20,
27
+ pedestal_loops: PositiveInt = 200,
28
+ jungfrau: CommissioningJungfrau = inject("jungfrau"),
29
+ path_of_output_file: str | None = None,
30
+ ) -> MsgGenerator:
31
+ """Acquire darks in pedestal mode, using dynamic gain mode. This calibrates the offsets
32
+ for the jungfrau, and must be performed before acquiring real data in dynamic gain mode.
33
+
34
+ When Bluesky triggers the detector in pedestal mode, with pedestal frames F and pedestal loops L,
35
+ the acquisition is managed at the driver level to:
36
+ 1. Acquire F-1 frames in dynamic gain mode
37
+ 2. Acquire 1 frame in ForceSwitchG1 gain mode
38
+ 3. Repeat steps 1-2 L times
39
+ 4. Do the first three steps a second time, except use ForceSwitchG2 instead of ForceSwitchG1
40
+ during step 2.
41
+
42
+ A pedestal scan should be acquired when detector configuration and environmental conditions change, but due to small
43
+ in instabilities in beamline conditions, it is recommended to run a pedestal scan on roughly an hourly basis.
44
+
45
+ Args:
46
+ exp_time_s: Length of detector exposure for each frame.
47
+ pedestal_frames: Number of frames acquired per pedestal loop.
48
+ pedestal_loops: Number of times to acquire a set of pedestal_frames
49
+ jungfrau: Jungfrau device
50
+ path_of_output_file: Absolute path of the detector file output, including file name. If None, then use the PathProvider
51
+ set during Jungfrau device instantiation
52
+ """
53
+
54
+ @bpp.set_run_key_decorator(PEDESTAL_DARKS_RUN)
55
+ @bpp.run_decorator(md={"subplan_name": PEDESTAL_DARKS_RUN})
56
+ @bpp.stage_decorator([jungfrau])
57
+ def _do_decorated_plan():
58
+ if path_of_output_file:
59
+ override_file_path(jungfrau, path_of_output_file)
60
+
61
+ trigger_info = create_jungfrau_pedestal_triggering_info(
62
+ exp_time_s, pedestal_frames, pedestal_loops
63
+ )
64
+ LOGGER.info(
65
+ "Jungfrau will be triggered in pedestal mode and in dynamic gain mode"
66
+ )
67
+ yield from bps.mv(
68
+ jungfrau.drv.acquisition_type,
69
+ AcquisitionType.PEDESTAL,
70
+ jungfrau.drv.gain_mode,
71
+ GainMode.DYNAMIC,
72
+ )
73
+ yield from fly_jungfrau(
74
+ jungfrau,
75
+ trigger_info,
76
+ wait=True,
77
+ log_on_percentage_prefix="Jungfrau pedestal dynamic gain mode darks triggers received",
78
+ )
79
+
80
+ yield from _do_decorated_plan()
81
+
82
+
83
+ def do_non_pedestal_darks(
84
+ gain_mode: GainMode,
85
+ exp_time_s: float = 0.001,
86
+ total_triggers: PositiveInt = 1000,
87
+ jungfrau: CommissioningJungfrau = inject("jungfrau"),
88
+ path_of_output_file: str | None = None,
89
+ ) -> MsgGenerator:
90
+ """Internally take a set of images at a given gain mode.
91
+
92
+ Non-pedestal darks are useful for detector panel cross-checks and for calculating masks.
93
+
94
+ Args:
95
+ gain_mode: Which gain mode to put the Jungfrau into before starting the acquisition.
96
+ exp_time_s: Length of detector exposure for each trigger.
97
+ total_triggers: Total triggers for the dark scan.
98
+ jungfrau: Jungfrau device
99
+ path_of_output_file: Absolute path of the detector file output, including file name. If None, then use the PathProvider
100
+ set during Jungfrau device instantiation
101
+ """
102
+
103
+ @bpp.set_run_key_decorator(STANDARD_DARKS_RUN)
104
+ @bpp.run_decorator(md={"subplan_name": STANDARD_DARKS_RUN})
105
+ @bpp.stage_decorator([jungfrau])
106
+ def _do_decorated_plan():
107
+ if path_of_output_file:
108
+ override_file_path(jungfrau, path_of_output_file)
109
+
110
+ trigger_info = create_jungfrau_internal_triggering_info(
111
+ total_triggers, exp_time_s
112
+ )
113
+
114
+ yield from bps.mv(jungfrau.drv.gain_mode, gain_mode)
115
+
116
+ yield from fly_jungfrau(
117
+ jungfrau,
118
+ trigger_info,
119
+ wait=True,
120
+ log_on_percentage_prefix=f"Jungfrau {gain_mode} gain mode darks triggers received",
121
+ )
122
+
123
+ yield from _do_decorated_plan()
@@ -0,0 +1 @@
1
+ """Jungfrau plan stubs should be used as part of Jungfrau experiment plans, and should not be run in isolation."""
@@ -9,7 +9,7 @@ from ophyd_async.fastcs.jungfrau import (
9
9
  )
10
10
  from pydantic import PositiveInt
11
11
 
12
- from mx_bluesky.beamlines.i24.jungfrau_commissioning.plan_utils import (
12
+ from mx_bluesky.beamlines.i24.jungfrau_commissioning.plan_stubs.plan_utils import (
13
13
  fly_jungfrau,
14
14
  override_file_path,
15
15
  )
@@ -18,27 +18,28 @@ from mx_bluesky.beamlines.i24.jungfrau_commissioning.plan_utils import (
18
18
  def do_external_acquisition(
19
19
  exp_time_s: float,
20
20
  total_triggers: PositiveInt = 1,
21
- output_file_name: str | None = None,
21
+ output_file_path: str | None = None,
22
22
  wait: bool = False,
23
23
  jungfrau: CommissioningJungfrau = inject("commissioning_jungfrau"),
24
24
  ) -> MsgGenerator[WatchableAsyncStatus]:
25
25
  """
26
26
  Kickoff external triggering on the Jungfrau, and optionally wait for completion.
27
27
 
28
- Must be used within an open Bluesky run.
28
+ Any plan using this stub MUST stage the Jungfrau with the stage_decorator and open a run,
29
+ ideally using the run_decorator.
29
30
 
30
31
  Args:
31
32
  exp_time_s: Length of detector exposure for each frame.
32
- total_triggers: Number of external triggers recieved before acquisition is marked as complete.
33
+ total_triggers: Number of external triggers received before acquisition is marked as complete.
33
34
  jungfrau: Jungfrau device
34
35
  output_file_name: Absolute path of the detector file output, including file name. If None, then use the PathProvider
35
36
  set during jungfrau device instantiation
36
37
  wait: Optionally block until data collection is complete.
37
38
  """
38
39
 
39
- if output_file_name:
40
- override_file_path(jungfrau, output_file_name)
40
+ if output_file_path:
41
+ override_file_path(jungfrau, output_file_path)
41
42
 
42
43
  trigger_info = create_jungfrau_external_triggering_info(total_triggers, exp_time_s)
43
- status = yield from fly_jungfrau(jungfrau, trigger_info, wait)
44
+ status = yield from fly_jungfrau(jungfrau, trigger_info, wait=wait)
44
45
  return status
@@ -9,7 +9,7 @@ from ophyd_async.fastcs.jungfrau import (
9
9
  )
10
10
  from pydantic import PositiveInt
11
11
 
12
- from mx_bluesky.beamlines.i24.jungfrau_commissioning.plan_utils import (
12
+ from mx_bluesky.beamlines.i24.jungfrau_commissioning.plan_stubs.plan_utils import (
13
13
  fly_jungfrau,
14
14
  override_file_path,
15
15
  )
@@ -26,7 +26,8 @@ def do_internal_acquisition(
26
26
  Kickoff internal triggering on the Jungfrau, and optionally wait for completion. Frames
27
27
  per trigger will trigger as rapidly as possible according to the Jungfrau deadtime.
28
28
 
29
- Must be used within an open Bluesky run.
29
+ Any plan using this stub MUST stage the Jungfrau with the stage_decorator and open a run,
30
+ ideally using the run_decorator.
30
31
 
31
32
  Args:
32
33
  exp_time_s: Length of detector exposure for each frame.
@@ -42,5 +43,5 @@ def do_internal_acquisition(
42
43
  override_file_path(jungfrau, path_of_output_file)
43
44
 
44
45
  trigger_info = create_jungfrau_internal_triggering_info(total_frames, exp_time_s)
45
- status = yield from fly_jungfrau(jungfrau, trigger_info, wait)
46
+ status = yield from fly_jungfrau(jungfrau, trigger_info, wait=wait)
46
47
  return status
@@ -2,7 +2,6 @@ from pathlib import PurePath
2
2
  from typing import cast
3
3
 
4
4
  import bluesky.plan_stubs as bps
5
- import bluesky.preprocessors as bpp
6
5
  from bluesky.utils import MsgGenerator
7
6
  from dodal.common.watcher_utils import log_on_percentage_complete
8
7
  from dodal.devices.i24.commissioning_jungfrau import CommissioningJungfrau
@@ -19,44 +18,38 @@ JF_COMPLETE_GROUP = "JF complete"
19
18
 
20
19
 
21
20
  def fly_jungfrau(
22
- jungfrau: CommissioningJungfrau, trigger_info: TriggerInfo, wait: bool = False
21
+ jungfrau: CommissioningJungfrau,
22
+ trigger_info: TriggerInfo,
23
+ wait: bool = False,
24
+ log_on_percentage_prefix="Jungfrau data collection triggers received",
23
25
  ) -> MsgGenerator[WatchableAsyncStatus]:
24
26
  """Stage, prepare, and kickoff Jungfrau with a configured TriggerInfo. Optionally wait
25
27
  for completion.
26
28
 
27
- Note that this plan doesn't include unstaging of the Jungfrau, and a run must be open
28
- before this plan is called.
29
+ Any plan using this stub MUST stage the Jungfrau with the stage_decorator and open a run,
30
+ ideally using the run_decorator.
29
31
 
30
32
  Args:
31
33
  jungfrau: Jungfrau device.
32
- trigger_info: TriggerInfo which should be acquired using jungfrau util functions create_jungfrau_internal_triggering_info
33
- or create_jungfrau_external_triggering_info.
34
+ trigger_info: TriggerInfo which should be acquired using jungfrau util functions.
34
35
  wait: Optionally block until data collection is complete.
36
+ log_on_percentage_prefix: String that will be appended to the "percentage completion" logging message.
35
37
  """
36
38
 
37
- @bpp.contingency_decorator(
38
- except_plan=lambda _: (yield from bps.unstage(jungfrau, wait=True))
39
- )
40
- def _fly_with_unstage_contingency():
41
- yield from bps.stage(jungfrau)
42
- LOGGER.info("Setting up detector...")
43
- yield from bps.prepare(jungfrau, trigger_info, wait=True)
44
- LOGGER.info("Detector prepared. Starting acquisition")
45
- yield from bps.kickoff(jungfrau, wait=True)
46
- LOGGER.info("Waiting for acquisition to complete...")
47
- status = yield from bps.complete(jungfrau, group=JF_COMPLETE_GROUP)
48
-
49
- # StandardDetector.complete converts regular status to watchable status,
50
- # but bluesky plan stubs can't see this currently
51
- status = cast(WatchableAsyncStatus, status)
52
- log_on_percentage_complete(
53
- status, "Jungfrau data collection triggers recieved", 10
54
- )
55
- if wait:
56
- yield from bps.wait(JF_COMPLETE_GROUP)
57
- return status
39
+ LOGGER.info("Preparing detector...")
40
+ yield from bps.prepare(jungfrau, trigger_info, wait=True)
41
+ LOGGER.info("Detector prepared. Starting acquisition")
42
+ yield from bps.kickoff(jungfrau, wait=True)
43
+ LOGGER.info("Waiting for acquisition to complete...")
44
+ status = yield from bps.complete(jungfrau, group=JF_COMPLETE_GROUP)
58
45
 
59
- return (yield from _fly_with_unstage_contingency())
46
+ # StandardDetector.complete converts regular status to watchable status,
47
+ # but bluesky plan stubs can't see this currently
48
+ status = cast(WatchableAsyncStatus, status)
49
+ log_on_percentage_complete(status, log_on_percentage_prefix, 10)
50
+ if wait:
51
+ yield from bps.wait(JF_COMPLETE_GROUP)
52
+ return status
60
53
 
61
54
 
62
55
  def override_file_path(jungfrau: CommissioningJungfrau, path_of_output_file: str):
@@ -3,19 +3,20 @@ from mx_bluesky.beamlines.i24.serial.web_gui_plans.general_plans import (
3
3
  gui_move_backlight,
4
4
  gui_move_detector,
5
5
  gui_run_chip_collection,
6
+ gui_run_extruder_collection,
7
+ gui_set_fiducial_0,
6
8
  gui_set_zoom_level,
7
- gui_sleep,
8
9
  gui_stage_move_on_click,
9
10
  )
10
11
 
11
- from .extruder.i24ssx_Extruder_Collect_py3v2 import (
12
+ from .extruder.i24ssx_extruder_collect_py3v2 import (
12
13
  enter_hutch,
13
14
  initialise_extruder,
14
15
  laser_check,
15
16
  run_extruder_plan,
16
17
  )
17
- from .fixed_target.i24ssx_Chip_Collect_py3v1 import run_fixed_target_plan
18
- from .fixed_target.i24ssx_Chip_Manager_py3v1 import (
18
+ from .fixed_target.i24ssx_chip_collect_py3v1 import run_fixed_target_plan
19
+ from .fixed_target.i24ssx_chip_manager_py3v1 import (
19
20
  block_check,
20
21
  cs_maker,
21
22
  cs_reset,
@@ -56,9 +57,10 @@ __all__ = [
56
57
  # GUI plans
57
58
  "gui_stage_move_on_click",
58
59
  "gui_gonio_move_on_click",
59
- "gui_sleep",
60
60
  "gui_move_detector",
61
61
  "gui_run_chip_collection",
62
62
  "gui_move_backlight",
63
63
  "gui_set_zoom_level",
64
+ "gui_set_fiducial_0",
65
+ "gui_run_extruder_collection",
64
66
  ]
@@ -95,7 +95,7 @@ class DCID:
95
95
 
96
96
  Attributes:
97
97
  error:
98
- If an error has occured. This will be set, even if emit_errors = True
98
+ If an error has occurred. This will be set, even if emit_errors = True
99
99
  """
100
100
 
101
101
  def __init__(
@@ -157,7 +157,7 @@ class DCID:
157
157
  xbeam, ybeam = beam_settings.beam_center_in_mm
158
158
 
159
159
  if isinstance(self.detector, Eiger):
160
- startImageNumber = 1
160
+ start_image_number = 1
161
161
  else:
162
162
  raise ValueError("Unknown detector:", self.detector)
163
163
 
@@ -201,7 +201,7 @@ class DCID:
201
201
  "imageDirectory": image_dir,
202
202
  "numberOfImages": num_images,
203
203
  "resolution": resolution,
204
- "startImageNumber": startImageNumber,
204
+ "startImageNumber": start_image_number,
205
205
  "startTime": start_time.isoformat(),
206
206
  "transmission": transmission,
207
207
  "visit": self.parameters.visit.name,