mx-bluesky 1.5.10__py3-none-any.whl → 1.5.12__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 (121) hide show
  1. mx_bluesky/_version.py +2 -2
  2. mx_bluesky/beamlines/aithre_lasershaping/experiment_plans/__init__.py +0 -0
  3. mx_bluesky/beamlines/aithre_lasershaping/experiment_plans/robot_load_plan.py +198 -0
  4. mx_bluesky/beamlines/aithre_lasershaping/goniometer_controls.py +2 -2
  5. mx_bluesky/beamlines/aithre_lasershaping/parameters/__init__.py +0 -0
  6. mx_bluesky/beamlines/aithre_lasershaping/parameters/constants.py +17 -0
  7. mx_bluesky/beamlines/aithre_lasershaping/parameters/robot_load_parameters.py +13 -0
  8. mx_bluesky/beamlines/aithre_lasershaping/pin_tip_centring.py +31 -0
  9. mx_bluesky/beamlines/aithre_lasershaping/robot_load.py +80 -0
  10. mx_bluesky/beamlines/i02_1/parameters/gridscan.py +1 -1
  11. mx_bluesky/beamlines/i04/__init__.py +6 -2
  12. mx_bluesky/beamlines/i04/callbacks/murko_callback.py +27 -12
  13. mx_bluesky/beamlines/i04/experiment_plans/i04_grid_detect_then_xray_centre_plan.py +94 -20
  14. mx_bluesky/beamlines/i04/external_interaction/__init__.py +0 -0
  15. mx_bluesky/beamlines/i04/external_interaction/config_server.py +15 -0
  16. mx_bluesky/beamlines/i04/oav_centering_plans/__init__.py +0 -0
  17. mx_bluesky/beamlines/i04/oav_centering_plans/oav_imaging.py +115 -0
  18. mx_bluesky/beamlines/i04/parameters/__init__.py +0 -0
  19. mx_bluesky/beamlines/i04/parameters/constants.py +21 -0
  20. mx_bluesky/beamlines/i04/redis_to_murko_forwarder.py +24 -1
  21. mx_bluesky/beamlines/i04/thawing_plan.py +149 -154
  22. mx_bluesky/beamlines/i24/jungfrau_commissioning/experiment_plans/do_darks.py +55 -10
  23. mx_bluesky/beamlines/i24/jungfrau_commissioning/plan_stubs/do_external_acquisition.py +1 -1
  24. mx_bluesky/beamlines/i24/jungfrau_commissioning/plan_stubs/plan_utils.py +1 -1
  25. mx_bluesky/beamlines/i24/serial/__init__.py +7 -5
  26. mx_bluesky/beamlines/i24/serial/dcid.py +6 -7
  27. mx_bluesky/beamlines/i24/serial/extruder/{i24ssx_Extruder_Collect_py3v2.py → i24ssx_extruder_collect_py3v2.py} +70 -37
  28. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/CustomChip_py3v1.edl +11 -11
  29. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/DetStage.edl +3 -3
  30. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/DiamondChipI24-py3v1.edl +142 -142
  31. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/MappingLite-oxford_py3v1.edl +135 -135
  32. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/PMAC_Command.edl +8 -8
  33. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/pumpprobe-py3v1.edl +13 -13
  34. mx_bluesky/beamlines/i24/serial/fixed_target/{i24ssx_Chip_Collect_py3v1.py → i24ssx_chip_collect_py3v1.py} +12 -9
  35. mx_bluesky/beamlines/i24/serial/fixed_target/{i24ssx_Chip_Manager_py3v1.py → i24ssx_chip_manager_py3v1.py} +81 -78
  36. mx_bluesky/beamlines/i24/serial/fixed_target/{i24ssx_Chip_StartUp_py3v1.py → i24ssx_chip_startup_py3v1.py} +3 -3
  37. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py +33 -33
  38. mx_bluesky/beamlines/i24/serial/log.py +11 -11
  39. mx_bluesky/beamlines/i24/serial/parameters/fixed_target/cs/cs_maker.json +3 -3
  40. mx_bluesky/beamlines/i24/serial/parameters/utils.py +5 -5
  41. mx_bluesky/beamlines/i24/serial/setup_beamline/ca.py +0 -12
  42. mx_bluesky/beamlines/i24/serial/setup_beamline/pv.py +122 -334
  43. mx_bluesky/beamlines/i24/serial/setup_beamline/pv_abstract.py +5 -5
  44. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +30 -251
  45. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +3 -3
  46. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +4 -4
  47. mx_bluesky/beamlines/i24/serial/web_gui_plans/general_plans.py +103 -16
  48. mx_bluesky/beamlines/i24/serial/web_gui_plans/oav_plans.py +64 -0
  49. mx_bluesky/beamlines/i24/serial/write_nexus.py +4 -4
  50. mx_bluesky/common/device_setup_plans/gonio.py +28 -0
  51. mx_bluesky/common/device_setup_plans/manipulate_sample.py +8 -1
  52. mx_bluesky/common/device_setup_plans/robot_load_unload.py +1 -1
  53. mx_bluesky/common/device_setup_plans/setup_oav.py +8 -0
  54. mx_bluesky/common/device_setup_plans/setup_zebra_and_shutter.py +0 -5
  55. mx_bluesky/common/device_setup_plans/xbpm_feedback.py +8 -1
  56. mx_bluesky/common/experiment_plans/beamstop_check.py +229 -0
  57. mx_bluesky/common/experiment_plans/common_flyscan_xray_centre_plan.py +8 -6
  58. mx_bluesky/common/experiment_plans/common_grid_detect_then_xray_centre_plan.py +2 -2
  59. mx_bluesky/common/experiment_plans/inner_plans/do_fgs.py +1 -1
  60. mx_bluesky/common/experiment_plans/inner_plans/read_hardware.py +7 -4
  61. mx_bluesky/common/experiment_plans/inner_plans/write_sample_status.py +2 -2
  62. mx_bluesky/common/experiment_plans/oav_snapshot_plan.py +1 -2
  63. mx_bluesky/{hyperion → common}/experiment_plans/pin_tip_centring_plan.py +23 -24
  64. mx_bluesky/common/external_interaction/callbacks/common/grid_detection_callback.py +5 -0
  65. mx_bluesky/common/external_interaction/callbacks/common/ispyb_callback_base.py +13 -15
  66. mx_bluesky/common/external_interaction/callbacks/common/ispyb_mapping.py +3 -5
  67. mx_bluesky/common/external_interaction/callbacks/common/plan_reactive_callback.py +1 -1
  68. mx_bluesky/common/external_interaction/callbacks/common/zocalo_callback.py +2 -2
  69. mx_bluesky/common/external_interaction/callbacks/sample_handling/sample_handling_callback.py +3 -3
  70. mx_bluesky/common/external_interaction/callbacks/xray_centre/ispyb_callback.py +12 -10
  71. mx_bluesky/common/external_interaction/callbacks/xray_centre/nexus_callback.py +2 -2
  72. mx_bluesky/common/external_interaction/config_server.py +4 -4
  73. mx_bluesky/common/external_interaction/ispyb/data_model.py +11 -4
  74. mx_bluesky/common/external_interaction/ispyb/exp_eye_store.py +163 -4
  75. mx_bluesky/common/external_interaction/ispyb/ispyb_store.py +76 -167
  76. mx_bluesky/common/external_interaction/ispyb/ispyb_utils.py +0 -14
  77. mx_bluesky/common/external_interaction/nexus/nexus_utils.py +2 -2
  78. mx_bluesky/common/external_interaction/nexus/write_nexus.py +3 -3
  79. mx_bluesky/common/parameters/components.py +1 -0
  80. mx_bluesky/common/parameters/constants.py +4 -3
  81. mx_bluesky/common/parameters/device_composites.py +4 -2
  82. mx_bluesky/common/parameters/gridscan.py +2 -2
  83. mx_bluesky/common/utils/exceptions.py +24 -7
  84. mx_bluesky/common/utils/log.py +13 -4
  85. mx_bluesky/common/utils/tracing.py +5 -5
  86. mx_bluesky/common/utils/utils.py +56 -8
  87. mx_bluesky/hyperion/__main__.py +6 -16
  88. mx_bluesky/hyperion/baton_handler.py +38 -14
  89. mx_bluesky/hyperion/device_setup_plans/utils.py +1 -1
  90. mx_bluesky/hyperion/experiment_plans/experiment_registry.py +1 -1
  91. mx_bluesky/hyperion/experiment_plans/hyperion_flyscan_xray_centre_plan.py +15 -13
  92. mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +2 -2
  93. mx_bluesky/hyperion/experiment_plans/optimise_attenuation_plan.py +9 -9
  94. mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +7 -8
  95. mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +3 -10
  96. mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +4 -2
  97. mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +10 -4
  98. mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +2 -2
  99. mx_bluesky/hyperion/experiment_plans/udc_default_state.py +160 -0
  100. mx_bluesky/hyperion/external_interaction/agamemnon.py +3 -3
  101. mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +2 -2
  102. mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_callback.py +3 -3
  103. mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_mapping.py +1 -0
  104. mx_bluesky/hyperion/external_interaction/callbacks/rotation/nexus_callback.py +3 -6
  105. mx_bluesky/hyperion/external_interaction/config_server.py +5 -5
  106. mx_bluesky/hyperion/parameters/constants.py +11 -4
  107. mx_bluesky/hyperion/parameters/device_composites.py +2 -2
  108. mx_bluesky/hyperion/parameters/gridscan.py +4 -4
  109. mx_bluesky/hyperion/parameters/robot_load.py +1 -9
  110. mx_bluesky/hyperion/plan_runner.py +6 -6
  111. mx_bluesky/hyperion/runner.py +10 -8
  112. mx_bluesky/jupyter_example.ipynb +3 -3
  113. {mx_bluesky-1.5.10.dist-info → mx_bluesky-1.5.12.dist-info}/METADATA +9 -7
  114. {mx_bluesky-1.5.10.dist-info → mx_bluesky-1.5.12.dist-info}/RECORD +118 -104
  115. mx_bluesky/common/experiment_plans/inner_plans/udc_default_state.py +0 -65
  116. mx_bluesky/common/external_interaction/callbacks/common/logging_callback.py +0 -29
  117. mx_bluesky/hyperion/device_setup_plans/smargon.py +0 -25
  118. {mx_bluesky-1.5.10.dist-info → mx_bluesky-1.5.12.dist-info}/WHEEL +0 -0
  119. {mx_bluesky-1.5.10.dist-info → mx_bluesky-1.5.12.dist-info}/entry_points.txt +0 -0
  120. {mx_bluesky-1.5.10.dist-info → mx_bluesky-1.5.12.dist-info}/licenses/LICENSE +0 -0
  121. {mx_bluesky-1.5.10.dist-info → mx_bluesky-1.5.12.dist-info}/top_level.txt +0 -0
@@ -10,6 +10,7 @@ from bluesky.utils import MsgGenerator
10
10
  from dodal.devices.aperturescatterguard import ApertureScatterguard
11
11
  from dodal.devices.attenuator.attenuator import BinaryFilterAttenuator
12
12
  from dodal.devices.backlight import Backlight
13
+ from dodal.devices.beamsize.beamsize import BeamsizeBase
13
14
  from dodal.devices.detector.detector_motion import DetectorMotion
14
15
  from dodal.devices.eiger import EigerDetector
15
16
  from dodal.devices.flux import Flux
@@ -21,7 +22,8 @@ from dodal.devices.robot import BartRobot
21
22
  from dodal.devices.s4_slit_gaps import S4SlitGaps
22
23
  from dodal.devices.smargon import CombinedMove, Smargon
23
24
  from dodal.devices.synchrotron import Synchrotron
24
- from dodal.devices.undulator import Undulator
25
+ from dodal.devices.thawer import Thawer
26
+ from dodal.devices.undulator import UndulatorInKeV
25
27
  from dodal.devices.xbpm_feedback import XBPMFeedback
26
28
  from dodal.devices.zebra.zebra import RotationDirection, Zebra
27
29
  from dodal.devices.zebra.zebra_controlled_shutter import ZebraShutter
@@ -49,7 +51,7 @@ from mx_bluesky.common.experiment_plans.inner_plans.read_hardware import (
49
51
  from mx_bluesky.common.experiment_plans.oav_snapshot_plan import (
50
52
  OavSnapshotComposite,
51
53
  oav_snapshot_plan,
52
- setup_beamline_for_OAV,
54
+ setup_beamline_for_oav,
53
55
  )
54
56
  from mx_bluesky.common.parameters.components import WithSnapshot
55
57
  from mx_bluesky.common.preprocessors.preprocessors import (
@@ -74,6 +76,7 @@ class RotationScanComposite(OavSnapshotComposite):
74
76
  aperture_scatterguard: ApertureScatterguard
75
77
  attenuator: BinaryFilterAttenuator
76
78
  backlight: Backlight
79
+ beamsize: BeamsizeBase
77
80
  beamstop: Beamstop
78
81
  dcm: DCM
79
82
  detector_motion: DetectorMotion
@@ -81,13 +84,14 @@ class RotationScanComposite(OavSnapshotComposite):
81
84
  flux: Flux
82
85
  robot: BartRobot
83
86
  smargon: Smargon
84
- undulator: Undulator
87
+ undulator: UndulatorInKeV
85
88
  synchrotron: Synchrotron
86
89
  s4_slit_gaps: S4SlitGaps
87
90
  sample_shutter: ZebraShutter
88
91
  zebra: Zebra
89
92
  oav: OAV
90
93
  xbpm_feedback: XBPMFeedback
94
+ thawer: Thawer
91
95
 
92
96
 
93
97
  def create_devices(context: BlueskyContext) -> RotationScanComposite:
@@ -258,6 +262,7 @@ def rotation_scan_plan(
258
262
  composite.aperture_scatterguard,
259
263
  params.selected_aperture,
260
264
  composite.backlight,
265
+ composite.thawer,
261
266
  group=CONST.WAIT.ROTATION_READY_FOR_DC,
262
267
  )
263
268
 
@@ -301,6 +306,7 @@ def rotation_scan_plan(
301
306
  composite.flux,
302
307
  composite.dcm,
303
308
  composite.eiger,
309
+ composite.beamsize,
304
310
  )
305
311
 
306
312
  yield from _rotation_scan_plan(motion_values, composite)
@@ -346,7 +352,7 @@ def _move_and_rotation(
346
352
  yield from bps.wait(CONST.WAIT.MOVE_GONIO_TO_START)
347
353
 
348
354
  if not params.use_grid_snapshots:
349
- yield from setup_beamline_for_OAV(
355
+ yield from setup_beamline_for_oav(
350
356
  composite.smargon,
351
357
  composite.backlight,
352
358
  composite.aperture_scatterguard,
@@ -12,7 +12,7 @@ from dodal.devices.attenuator.attenuator import BinaryFilterAttenuator
12
12
  from dodal.devices.focusing_mirror import FocusingMirrorWithStripes, MirrorVoltages
13
13
  from dodal.devices.i03.dcm import DCM
14
14
  from dodal.devices.i03.undulator_dcm import UndulatorDCM
15
- from dodal.devices.undulator import Undulator
15
+ from dodal.devices.undulator import UndulatorInKeV
16
16
  from dodal.devices.xbpm_feedback import XBPMFeedback
17
17
 
18
18
  from mx_bluesky.common.parameters.constants import PlanNameConstants
@@ -39,7 +39,7 @@ class SetEnergyComposite:
39
39
  # Remove composite after https://github.com/DiamondLightSource/dodal/issues/1092
40
40
  @pydantic.dataclasses.dataclass(config={"arbitrary_types_allowed": True})
41
41
  class XBPMWrapperComposite:
42
- undulator: Undulator
42
+ undulator: UndulatorInKeV
43
43
  xbpm_feedback: XBPMFeedback
44
44
  attenuator: BinaryFilterAttenuator
45
45
  dcm: DCM
@@ -0,0 +1,160 @@
1
+ import bluesky.plan_stubs as bps
2
+ import pydantic
3
+ from bluesky.utils import MsgGenerator
4
+ from dodal.common.beamlines.beamline_parameters import (
5
+ get_beamline_parameters,
6
+ )
7
+ from dodal.devices.aperturescatterguard import ApertureValue
8
+ from dodal.devices.collimation_table import CollimationTable
9
+ from dodal.devices.cryostream import CryoStream, CryoStreamGantry, CryoStreamSelection
10
+ from dodal.devices.cryostream import InOut as CryoInOut
11
+ from dodal.devices.fluorescence_detector_motion import FluorescenceDetector
12
+ from dodal.devices.fluorescence_detector_motion import InOut as FlouInOut
13
+ from dodal.devices.hutch_shutter import HutchShutter, ShutterDemand
14
+ from dodal.devices.mx_phase1.beamstop import BeamstopPositions
15
+ from dodal.devices.robot import BartRobot, PinMounted
16
+ from dodal.devices.scintillator import InOut as ScinInOut
17
+ from dodal.devices.scintillator import Scintillator
18
+ from dodal.devices.smargon import Smargon
19
+ from dodal.devices.zebra.zebra_controlled_shutter import ZebraShutterState
20
+
21
+ from mx_bluesky.common.experiment_plans.beamstop_check import (
22
+ BeamstopCheckDevices,
23
+ move_beamstop_in_and_verify_using_diode,
24
+ )
25
+ from mx_bluesky.common.utils.exceptions import BeamlineCheckFailureError
26
+ from mx_bluesky.common.utils.log import LOGGER
27
+ from mx_bluesky.hyperion.external_interaction.config_server import (
28
+ get_hyperion_config_client,
29
+ )
30
+ from mx_bluesky.hyperion.parameters.constants import HyperionFeatureSettings
31
+
32
+ _GROUP_PRE_BEAMSTOP_CHECK = "pre_beamstop_check"
33
+ _GROUP_POST_BEAMSTOP_CHECK = "post_beamstop_check"
34
+
35
+
36
+ @pydantic.dataclasses.dataclass(config={"arbitrary_types_allowed": True})
37
+ class UDCDefaultDevices(BeamstopCheckDevices):
38
+ collimation_table: CollimationTable
39
+ cryostream: CryoStream
40
+ cryostream_gantry: CryoStreamGantry
41
+ fluorescence_det_motion: FluorescenceDetector
42
+ hutch_shutter: HutchShutter
43
+ robot: BartRobot
44
+ scintillator: Scintillator
45
+ smargon: Smargon
46
+
47
+
48
+ class UnexpectedSampleError(BeamlineCheckFailureError): ...
49
+
50
+
51
+ class CryoStreamError(BeamlineCheckFailureError): ...
52
+
53
+
54
+ def move_to_udc_default_state(devices: UDCDefaultDevices):
55
+ """Moves beamline to known positions prior to UDC start"""
56
+ yield from _verify_correct_cryostream_selected(devices.cryostream_gantry)
57
+
58
+ cryostream_temp = yield from bps.rd(devices.cryostream.temperature_k)
59
+ cryostream_pressure = yield from bps.rd(devices.cryostream.back_pressure_bar)
60
+ if cryostream_temp > devices.cryostream.MAX_TEMP_K:
61
+ raise CryoStreamError("Cryostream temperature is too high, not starting UDC")
62
+ if cryostream_pressure > devices.cryostream.MAX_PRESSURE_BAR:
63
+ raise CryoStreamError("Cryostream back pressure is too high, not starting UDC")
64
+
65
+ yield from _verify_no_sample_present(devices.robot)
66
+
67
+ # Close fast shutter before opening hutch shutter
68
+ yield from bps.abs_set(devices.sample_shutter, ZebraShutterState.CLOSE, wait=True)
69
+
70
+ commissioning_mode_enabled = yield from bps.rd(devices.baton.commissioning)
71
+
72
+ if commissioning_mode_enabled:
73
+ LOGGER.warning("Not opening hutch shutter - commissioning mode is enabled.")
74
+ else:
75
+ yield from bps.abs_set(
76
+ devices.hutch_shutter, ShutterDemand.OPEN, group=_GROUP_PRE_BEAMSTOP_CHECK
77
+ )
78
+
79
+ yield from bps.abs_set(devices.scintillator.selected_pos, ScinInOut.OUT, wait=True)
80
+
81
+ yield from bps.abs_set(
82
+ devices.fluorescence_det_motion.pos,
83
+ FlouInOut.OUT,
84
+ group=_GROUP_PRE_BEAMSTOP_CHECK,
85
+ )
86
+
87
+ yield from bps.abs_set(
88
+ devices.collimation_table.inboard_y,
89
+ 0,
90
+ group=_GROUP_PRE_BEAMSTOP_CHECK,
91
+ )
92
+ yield from bps.abs_set(
93
+ devices.collimation_table.outboard_y, 0, group=_GROUP_PRE_BEAMSTOP_CHECK
94
+ )
95
+ yield from bps.abs_set(
96
+ devices.collimation_table.upstream_y, 0, group=_GROUP_PRE_BEAMSTOP_CHECK
97
+ )
98
+ yield from bps.abs_set(
99
+ devices.collimation_table.upstream_x, 0, group=_GROUP_PRE_BEAMSTOP_CHECK
100
+ )
101
+ yield from bps.abs_set(
102
+ devices.collimation_table.downstream_x, 0, group=_GROUP_PRE_BEAMSTOP_CHECK
103
+ )
104
+
105
+ # Wait for all of the above to complete
106
+ yield from bps.wait(group=_GROUP_PRE_BEAMSTOP_CHECK, timeout=0.1)
107
+
108
+ feature_flags: HyperionFeatureSettings = (
109
+ get_hyperion_config_client().get_feature_flags()
110
+ )
111
+ if feature_flags.BEAMSTOP_DIODE_CHECK:
112
+ beamline_parameters = get_beamline_parameters()
113
+ config_client = get_hyperion_config_client()
114
+ features_settings: HyperionFeatureSettings = config_client.get_feature_flags()
115
+ detector_min_z = features_settings.DETECTOR_DISTANCE_LIMIT_MIN_MM
116
+ detector_max_z = features_settings.DETECTOR_DISTANCE_LIMIT_MAX_MM
117
+ yield from move_beamstop_in_and_verify_using_diode(
118
+ devices, beamline_parameters, detector_min_z, detector_max_z
119
+ )
120
+ else:
121
+ yield from bps.abs_set(
122
+ devices.beamstop.selected_pos, BeamstopPositions.DATA_COLLECTION, wait=True
123
+ )
124
+
125
+ yield from bps.abs_set(
126
+ devices.aperture_scatterguard.selected_aperture,
127
+ ApertureValue.SMALL,
128
+ group=_GROUP_POST_BEAMSTOP_CHECK,
129
+ )
130
+
131
+ yield from bps.abs_set(
132
+ devices.cryostream.course, CryoInOut.IN, group=_GROUP_POST_BEAMSTOP_CHECK
133
+ )
134
+ yield from bps.abs_set(
135
+ devices.cryostream.fine, CryoInOut.IN, group=_GROUP_POST_BEAMSTOP_CHECK
136
+ )
137
+
138
+ yield from bps.wait(_GROUP_POST_BEAMSTOP_CHECK)
139
+
140
+
141
+ def _verify_correct_cryostream_selected(
142
+ cryostream_gantry: CryoStreamGantry,
143
+ ) -> MsgGenerator:
144
+ cryostream_selection = yield from bps.rd(cryostream_gantry.cryostream_selector)
145
+ cryostream_selected = yield from bps.rd(cryostream_gantry.cryostream_selected)
146
+ if cryostream_selection != CryoStreamSelection.CRYOJET or cryostream_selected != 1:
147
+ raise CryoStreamError(
148
+ f"Cryostream is not selected for use, control PV selection = {cryostream_selection}, "
149
+ f"current status {cryostream_selected}"
150
+ )
151
+
152
+
153
+ def _verify_no_sample_present(robot: BartRobot):
154
+ pin_mounted = yield from bps.rd(robot.gonio_pin_sensor)
155
+
156
+ if pin_mounted != PinMounted.NO_PIN_MOUNTED:
157
+ # Cannot unload this sample because we do not know the correct visit for it
158
+ raise UnexpectedSampleError(
159
+ "An unexpected sample was found, please unload the sample manually."
160
+ )
@@ -23,7 +23,7 @@ from mx_bluesky.common.parameters.constants import (
23
23
  GridscanParamConstants,
24
24
  )
25
25
  from mx_bluesky.common.utils.log import LOGGER
26
- from mx_bluesky.common.utils.utils import convert_angstrom_to_eV
26
+ from mx_bluesky.common.utils.utils import convert_angstrom_to_ev
27
27
  from mx_bluesky.hyperion.parameters.components import Wait
28
28
  from mx_bluesky.hyperion.parameters.load_centre_collect import LoadCentreCollect
29
29
 
@@ -220,9 +220,9 @@ def _get_withvisit_parameters_from_agamemnon(parameters: dict) -> tuple:
220
220
  def _get_withenergy_parameters_from_agamemnon(parameters: dict) -> dict[str, Any]:
221
221
  try:
222
222
  first_collection: dict = parameters["collection"][0]
223
- wavelength = first_collection.get("wavelength")
223
+ wavelength: float | None = first_collection.get("wavelength")
224
224
  assert isinstance(wavelength, float)
225
- demand_energy_ev = convert_angstrom_to_eV(wavelength)
225
+ demand_energy_ev = convert_angstrom_to_ev(wavelength)
226
226
  return {"demand_energy_ev": demand_energy_ev}
227
227
  except (KeyError, IndexError, AttributeError, TypeError):
228
228
  return {"demand_energy_ev": None}
@@ -5,7 +5,7 @@ from time import sleep # noqa
5
5
 
6
6
  from bluesky.callbacks import CallbackBase
7
7
  from bluesky.callbacks.zmq import Proxy, RemoteDispatcher
8
- from dodal.log import LOGGER as dodal_logger
8
+ from dodal.log import LOGGER as DODAL_LOGGER
9
9
  from dodal.log import set_up_all_logging_handlers
10
10
 
11
11
  from mx_bluesky.common.external_interaction.alerting import set_alerting_service
@@ -124,7 +124,7 @@ def setup_logging(dev_mode: bool):
124
124
  log_info(f"Loggers initialised with dev_mode={dev_mode}")
125
125
  nexgen_logger = logging.getLogger("nexgen")
126
126
  nexgen_logger.parent = NEXUS_LOGGER
127
- dodal_logger.parent = ISPYB_ZOCALO_CALLBACK_LOGGER
127
+ DODAL_LOGGER.parent = ISPYB_ZOCALO_CALLBACK_LOGGER
128
128
  log_debug("nexgen logger added to nexus logger")
129
129
 
130
130
 
@@ -1,7 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from collections.abc import Callable, Sequence
4
- from typing import TYPE_CHECKING, Any, cast
4
+ from typing import TYPE_CHECKING, Any
5
5
 
6
6
  from dodal.devices.zocalo import ZocaloStartInfo
7
7
 
@@ -46,7 +46,7 @@ class RotationISPyBCallback(BaseISPyBCallback):
46
46
  To use, subscribe the Bluesky RunEngine to an instance of this class.
47
47
  E.g.:
48
48
  ispyb_handler_callback = RotationISPyBCallback(parameters)
49
- RE.subscribe(ispyb_handler_callback)
49
+ run_engine.subscribe(ispyb_handler_callback)
50
50
  Or decorate a plan using bluesky.preprocessors.subs_decorator.
51
51
 
52
52
  See: https://blueskyproject.io/bluesky/callbacks.html#ways-to-invoke-callbacks
@@ -92,7 +92,7 @@ class RotationISPyBCallback(BaseISPyBCallback):
92
92
  ISPYB_ZOCALO_CALLBACK_LOGGER.info("Beginning ispyb deposition")
93
93
  data_collection_group_info = populate_data_collection_group(self.params)
94
94
  data_collection_info = populate_data_collection_info_for_rotation(
95
- cast(SingleRotationScan, self.params)
95
+ self.params
96
96
  )
97
97
  data_collection_info = populate_remaining_data_collection_info(
98
98
  self.params.comment,
@@ -6,6 +6,7 @@ from mx_bluesky.hyperion.parameters.rotation import SingleRotationScan
6
6
 
7
7
  def populate_data_collection_info_for_rotation(params: SingleRotationScan):
8
8
  info = DataCollectionInfo(
9
+ chi_start=params.chi_start_deg,
9
10
  omega_start=params.omega_start_deg,
10
11
  data_collection_number=params.detector_params.run_number, # type:ignore # the validator always makes this int
11
12
  n_images=params.num_images,
@@ -2,9 +2,6 @@ from __future__ import annotations
2
2
 
3
3
  from typing import TYPE_CHECKING
4
4
 
5
- from mx_bluesky.common.external_interaction.callbacks.common.logging_callback import (
6
- format_doc_for_log,
7
- )
8
5
  from mx_bluesky.common.external_interaction.callbacks.common.plan_reactive_callback import (
9
6
  PlanReactiveCallback,
10
7
  )
@@ -14,7 +11,7 @@ from mx_bluesky.common.external_interaction.nexus.nexus_utils import (
14
11
  vds_type_based_on_bit_depth,
15
12
  )
16
13
  from mx_bluesky.common.external_interaction.nexus.write_nexus import NexusWriter
17
- from mx_bluesky.common.utils.log import NEXUS_LOGGER
14
+ from mx_bluesky.common.utils.log import NEXUS_LOGGER, format_doc_for_log
18
15
  from mx_bluesky.hyperion.parameters.constants import CONST, I03Constants
19
16
  from mx_bluesky.hyperion.parameters.rotation import SingleRotationScan
20
17
 
@@ -29,7 +26,7 @@ class RotationNexusFileCallback(PlanReactiveCallback):
29
26
  To use, subscribe the Bluesky RunEngine to an instance of this class.
30
27
  E.g.:
31
28
  nexus_file_handler_callback = NexusFileCallback(parameters)
32
- RE.subscribe(nexus_file_handler_callback)
29
+ run_engine.subscribe(nexus_file_handler_callback)
33
30
  Or decorate a plan using bluesky.preprocessors.subs_decorator.
34
31
 
35
32
  See: https://blueskyproject.io/bluesky/callbacks.html#ways-to-invoke-callbacks
@@ -65,7 +62,7 @@ class RotationNexusFileCallback(PlanReactiveCallback):
65
62
  self.writer.beam,
66
63
  self.writer.attenuator,
67
64
  ) = create_beam_and_attenuator_parameters(
68
- data["dcm-energy_in_kev"],
65
+ data["dcm-energy_in_keV"],
69
66
  data["flux-flux_reading"],
70
67
  data["attenuator-actual_transmission"],
71
68
  )
@@ -2,15 +2,15 @@ from functools import cache
2
2
 
3
3
  from mx_bluesky.common.external_interaction.config_server import MXConfigClient
4
4
  from mx_bluesky.hyperion.parameters.constants import (
5
- HyperionFeatureSetting,
6
- HyperionFeatureSettingources,
5
+ HyperionFeatureSettings,
6
+ HyperionFeatureSettingsSources,
7
7
  )
8
8
 
9
9
 
10
10
  @cache
11
- def get_hyperion_config_client() -> MXConfigClient[HyperionFeatureSetting]:
11
+ def get_hyperion_config_client() -> MXConfigClient[HyperionFeatureSettings]:
12
12
  return MXConfigClient(
13
- feature_sources=HyperionFeatureSettingources,
14
- feature_dc=HyperionFeatureSetting,
13
+ feature_sources=HyperionFeatureSettingsSources,
14
+ feature_dc=HyperionFeatureSettings,
15
15
  url="https://daq-config.diamond.ac.uk",
16
16
  )
@@ -8,8 +8,8 @@ from mx_bluesky.common.parameters.constants import (
8
8
  DocDescriptorNames,
9
9
  EnvironmentConstants,
10
10
  ExperimentParamConstants,
11
- FeatureSetting,
12
- FeatureSettingources,
11
+ FeatureSettings,
12
+ FeatureSettingSources,
13
13
  HardwareConstants,
14
14
  OavConstants,
15
15
  PlanGroupCheckpointConstants,
@@ -32,20 +32,27 @@ class I03Constants:
32
32
 
33
33
 
34
34
  # These currently exist in GDA domain.properties
35
- class HyperionFeatureSettingources(FeatureSettingources):
35
+ class HyperionFeatureSettingsSources(FeatureSettingSources):
36
36
  USE_GPU_RESULTS = "gda.mx.hyperion.xrc.use_gpu_results"
37
37
  USE_PANDA_FOR_GRIDSCAN = "gda.mx.hyperion.use_panda_for_gridscans"
38
38
  SET_STUB_OFFSETS = "gda.mx.hyperion.do_stub_offsets"
39
39
  PANDA_RUNUP_DISTANCE_MM = "gda.mx.hyperion.panda_runup_distance_mm"
40
+ DETECTOR_DISTANCE_LIMIT_MAX_MM = "gda.detector.distance.limit.max"
41
+ DETECTOR_DISTANCE_LIMIT_MIN_MM = "gda.detector.distance.limit.min"
42
+ BEAMSTOP_DIODE_CHECK = "gda.mx.hyperion.enable_beamstop_diode_check"
40
43
 
41
44
 
42
45
  # Use these defaults if we can't read from the config server
43
46
  @dataclass
44
- class HyperionFeatureSetting(FeatureSetting):
47
+ class HyperionFeatureSettings(FeatureSettings):
45
48
  USE_GPU_RESULTS: bool = True
46
49
  USE_PANDA_FOR_GRIDSCAN: bool = False
47
50
  SET_STUB_OFFSETS: bool = False
48
51
  PANDA_RUNUP_DISTANCE_MM: float = 0.16
52
+ # From GDA mx-config hutch_utilities.py default values
53
+ DETECTOR_DISTANCE_LIMIT_MAX_MM: float = 700
54
+ DETECTOR_DISTANCE_LIMIT_MIN_MM: float = 250
55
+ BEAMSTOP_DIODE_CHECK: bool = False
49
56
 
50
57
 
51
58
  @dataclass(frozen=True)
@@ -16,7 +16,7 @@ from dodal.devices.flux import Flux
16
16
  from dodal.devices.robot import BartRobot
17
17
  from dodal.devices.s4_slit_gaps import S4SlitGaps
18
18
  from dodal.devices.synchrotron import Synchrotron
19
- from dodal.devices.undulator import Undulator
19
+ from dodal.devices.undulator import UndulatorInKeV
20
20
  from dodal.devices.xbpm_feedback import XBPMFeedback
21
21
  from dodal.devices.zebra.zebra import Zebra
22
22
  from dodal.devices.zebra.zebra_controlled_shutter import ZebraShutter
@@ -41,7 +41,7 @@ class HyperionFlyScanXRayCentreComposite(FlyScanEssentialDevices):
41
41
  eiger: EigerDetector
42
42
  flux: Flux
43
43
  s4_slit_gaps: S4SlitGaps
44
- undulator: Undulator
44
+ undulator: UndulatorInKeV
45
45
  synchrotron: Synchrotron
46
46
  zebra: Zebra
47
47
  zocalo: ZocaloResults
@@ -44,7 +44,7 @@ class HyperionSpecifiedThreeDGridScan(SpecifiedThreeDGridScan):
44
44
 
45
45
  # Relative to common grid scan, stub offsets are defined by config server
46
46
  @property
47
- def FGS_params(self) -> ZebraGridScanParamsThreeD:
47
+ def fast_gridscan_params(self) -> ZebraGridScanParamsThreeD:
48
48
  return ZebraGridScanParamsThreeD(
49
49
  x_steps=self.x_steps,
50
50
  y_steps=self.y_steps,
@@ -65,10 +65,10 @@ class HyperionSpecifiedThreeDGridScan(SpecifiedThreeDGridScan):
65
65
  )
66
66
 
67
67
  @property
68
- def panda_FGS_params(self) -> PandAGridScanParams:
68
+ def panda_fast_gridscan_params(self) -> PandAGridScanParams:
69
69
  if self.y_steps % 2 and self.z_steps > 0:
70
70
  # See https://github.com/DiamondLightSource/hyperion/issues/1118 for explanation
71
- raise OddYStepsException(
71
+ raise OddYStepsError(
72
72
  "The number of Y steps must be even for a PandA gridscan"
73
73
  )
74
74
  return PandAGridScanParams(
@@ -93,7 +93,7 @@ class HyperionSpecifiedThreeDGridScan(SpecifiedThreeDGridScan):
93
93
  )
94
94
 
95
95
 
96
- class OddYStepsException(Exception): ...
96
+ class OddYStepsError(Exception): ...
97
97
 
98
98
 
99
99
  class PinTipCentreThenXrayCentre(GridCommonWithHyperionDetectorParams):
@@ -1,5 +1,3 @@
1
- from pydantic import Field
2
-
3
1
  from mx_bluesky.common.parameters.components import (
4
2
  MxBlueskyParameters,
5
3
  WithOptionalEnergyChange,
@@ -7,9 +5,6 @@ from mx_bluesky.common.parameters.components import (
7
5
  WithSnapshot,
8
6
  WithVisit,
9
7
  )
10
- from mx_bluesky.common.parameters.constants import (
11
- HardwareConstants,
12
- )
13
8
  from mx_bluesky.hyperion.parameters.gridscan import (
14
9
  GridCommonWithHyperionDetectorParams,
15
10
  PinTipCentreThenXrayCentre,
@@ -19,12 +14,10 @@ from mx_bluesky.hyperion.parameters.gridscan import (
19
14
  class RobotLoadAndEnergyChange(
20
15
  MxBlueskyParameters, WithSample, WithSnapshot, WithOptionalEnergyChange, WithVisit
21
16
  ):
22
- thawing_time: float = Field(default=HardwareConstants.THAWING_TIME)
17
+ pass
23
18
 
24
19
 
25
20
  class RobotLoadThenCentre(GridCommonWithHyperionDetectorParams):
26
- thawing_time: float = Field(default=HardwareConstants.THAWING_TIME)
27
-
28
21
  @property
29
22
  def robot_load_params(self) -> RobotLoadAndEnergyChange:
30
23
  my_params = self.model_dump()
@@ -33,5 +26,4 @@ class RobotLoadThenCentre(GridCommonWithHyperionDetectorParams):
33
26
  @property
34
27
  def pin_centre_then_xray_centre_params(self) -> PinTipCentreThenXrayCentre:
35
28
  my_params = self.model_dump()
36
- del my_params["thawing_time"]
37
29
  return PinTipCentreThenXrayCentre(**my_params)
@@ -5,12 +5,12 @@ from blueapi.core import BlueskyContext
5
5
  from bluesky.utils import MsgGenerator, RequestAbort
6
6
 
7
7
  from mx_bluesky.common.parameters.constants import Status
8
- from mx_bluesky.common.utils.exceptions import WarningException
8
+ from mx_bluesky.common.utils.exceptions import WarningError
9
9
  from mx_bluesky.common.utils.log import LOGGER
10
10
  from mx_bluesky.hyperion.runner import BaseRunner
11
11
 
12
12
 
13
- class PlanException(Exception):
13
+ class PlanError(Exception):
14
14
  """Identifies an exception that was encountered during plan execution."""
15
15
 
16
16
  pass
@@ -32,7 +32,7 @@ class PlanRunner(BaseRunner):
32
32
  Args:
33
33
  experiment: The experiment to run
34
34
  Raises:
35
- PlanException: If the plan raised an exception
35
+ PlanError: If the plan raised an exception
36
36
  RequestAbort: If the RunEngine aborted during execution"""
37
37
 
38
38
  self.current_status = Status.BUSY
@@ -40,7 +40,7 @@ class PlanRunner(BaseRunner):
40
40
  try:
41
41
  yield from experiment()
42
42
  self.current_status = Status.IDLE
43
- except WarningException as e:
43
+ except WarningError as e:
44
44
  LOGGER.warning("Plan failed with warning", exc_info=e)
45
45
  self.current_status = Status.FAILED
46
46
  except RequestAbort:
@@ -50,7 +50,7 @@ class PlanRunner(BaseRunner):
50
50
  except Exception as e:
51
51
  LOGGER.error("Plan failed with exception", exc_info=e)
52
52
  self.current_status = Status.FAILED
53
- raise PlanException("Exception thrown in plan execution") from e
53
+ raise PlanError("Exception thrown in plan execution") from e
54
54
 
55
55
  def shutdown(self):
56
56
  """Performs a prompt shutdown. Aborts the run engine and terminates the loop
@@ -61,7 +61,7 @@ class PlanRunner(BaseRunner):
61
61
  # abort() causes the run engine to throw a RequestAbort exception
62
62
  # inside the plan, which will propagate through the contingency wrappers.
63
63
  # When the plan returns, the run engine will raise RunEngineInterrupted
64
- self.RE.abort()
64
+ self.run_engine.abort()
65
65
  except Exception as e:
66
66
  LOGGER.warning(
67
67
  "Exception encountered when issuing abort() to RunEngine:",
@@ -14,7 +14,7 @@ from mx_bluesky.common.external_interaction.callbacks.common.log_uid_tag_callbac
14
14
  )
15
15
  from mx_bluesky.common.parameters.components import MxBlueskyParameters
16
16
  from mx_bluesky.common.parameters.constants import Actions, Status
17
- from mx_bluesky.common.utils.exceptions import WarningException
17
+ from mx_bluesky.common.utils.exceptions import WarningError
18
18
  from mx_bluesky.common.utils.log import LOGGER
19
19
  from mx_bluesky.common.utils.tracing import TRACER
20
20
  from mx_bluesky.hyperion.experiment_plans.experiment_registry import PLAN_REGISTRY
@@ -65,15 +65,15 @@ class BaseRunner:
65
65
 
66
66
  def __init__(self, context: BlueskyContext):
67
67
  self.context: BlueskyContext = context
68
- self.RE = context.run_engine
69
- # These references are necessary to maintain liveness of callbacks because RE
68
+ self.run_engine = context.run_engine
69
+ # These references are necessary to maintain liveness of callbacks because run_engine
70
70
  # only keeps a weakref
71
71
  self._logging_uid_tag_callback = LogUidTaggingCallback()
72
72
  self._publisher = Publisher(f"localhost:{CONST.CALLBACK_0MQ_PROXY_PORTS[0]}")
73
73
 
74
- self.RE.subscribe(self._logging_uid_tag_callback)
74
+ self.run_engine.subscribe(self._logging_uid_tag_callback)
75
75
  LOGGER.info("Connecting to external callback ZMQ proxy...")
76
- self.RE.subscribe(self._publisher)
76
+ self.run_engine.subscribe(self._publisher)
77
77
 
78
78
 
79
79
  class GDARunner(BaseRunner):
@@ -145,7 +145,7 @@ class GDARunner(BaseRunner):
145
145
  # abort() causes the run engine to throw a RequestAbort exception
146
146
  # inside the plan, which will propagate through the contingency wrappers.
147
147
  # When the plan returns, the run engine will raise RunEngineInterrupted
148
- self.RE.abort()
148
+ self.run_engine.abort()
149
149
  self.current_status = StatusAndMessage(Status.IDLE)
150
150
  except Exception as e:
151
151
  self.current_status = make_error_status_and_message(e)
@@ -171,12 +171,14 @@ class GDARunner(BaseRunner):
171
171
  raise ValueError("No experiment provided for START")
172
172
  try:
173
173
  with TRACER.start_span("do_run"):
174
- self.RE(command.experiment(command.devices, command.parameters))
174
+ self.run_engine(
175
+ command.experiment(command.devices, command.parameters)
176
+ )
175
177
 
176
178
  self.current_status = StatusAndMessage(Status.IDLE)
177
179
 
178
180
  self._last_run_aborted = False
179
- except WarningException as exception:
181
+ except WarningError as exception:
180
182
  LOGGER.warning("Warning Exception", exc_info=True)
181
183
  self.current_status = make_error_status_and_message(exception)
182
184
  except Exception as exception:
@@ -18,12 +18,12 @@
18
18
  "from bluesky import RunEngine\n",
19
19
  "from bluesky.callbacks.best_effort import BestEffortCallback\n",
20
20
  "\n",
21
- "RE = RunEngine({})\n",
21
+ "run_engine = RunEngine({})\n",
22
22
  "\n",
23
23
  "bec = BestEffortCallback()\n",
24
24
  "\n",
25
25
  "# Send all metadata/data captured to the BestEffortCallback.\n",
26
- "RE.subscribe(bec)"
26
+ "run_engine.subscribe(bec)"
27
27
  ]
28
28
  },
29
29
  {
@@ -46,7 +46,7 @@
46
46
  "\n",
47
47
  "dets = [det] # just one in this case, but it could be more than one\n",
48
48
  "\n",
49
- "RE(scan(dets, motor, -1, 1, 10))"
49
+ "run_engine(scan(dets, motor, -1, 1, 10))"
50
50
  ]
51
51
  }
52
52
  ],