mx-bluesky 1.4.9__py3-none-any.whl → 1.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. mx_bluesky/_version.py +2 -2
  2. mx_bluesky/beamlines/i24/serial/__init__.py +4 -2
  3. mx_bluesky/beamlines/i24/serial/blueapi_config.yaml +4 -0
  4. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +32 -0
  5. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +2 -1
  6. mx_bluesky/beamlines/i24/serial/web_gui_plans/general_plans.py +77 -8
  7. mx_bluesky/common/device_setup_plans/manipulate_sample.py +4 -1
  8. mx_bluesky/common/device_setup_plans/utils.py +49 -0
  9. mx_bluesky/common/{plans → experiment_plans}/common_flyscan_xray_centre_plan.py +11 -19
  10. mx_bluesky/{hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py → common/experiment_plans/common_grid_detect_then_xray_centre_plan.py} +108 -136
  11. mx_bluesky/common/{plans → experiment_plans}/inner_plans/do_fgs.py +1 -1
  12. mx_bluesky/common/experiment_plans/oav_grid_detection_plan.py +5 -13
  13. mx_bluesky/{hyperion → common}/experiment_plans/oav_snapshot_plan.py +5 -2
  14. mx_bluesky/common/parameters/components.py +1 -1
  15. mx_bluesky/common/parameters/device_composites.py +65 -0
  16. mx_bluesky/common/utils/__init__.py +0 -0
  17. mx_bluesky/hyperion/device_setup_plans/utils.py +0 -48
  18. mx_bluesky/hyperion/experiment_plans/__init__.py +3 -3
  19. mx_bluesky/hyperion/experiment_plans/experiment_registry.py +3 -3
  20. mx_bluesky/hyperion/experiment_plans/hyperion_flyscan_xray_centre_plan.py +40 -41
  21. mx_bluesky/hyperion/experiment_plans/hyperion_grid_detect_then_xray_centre_plan.py +60 -0
  22. mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +26 -15
  23. mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +8 -6
  24. mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +11 -11
  25. mx_bluesky/hyperion/parameters/constants.py +0 -1
  26. mx_bluesky/hyperion/parameters/device_composites.py +5 -27
  27. mx_bluesky/hyperion/utils/validation.py +1 -1
  28. {mx_bluesky-1.4.9.dist-info → mx_bluesky-1.5.0.dist-info}/METADATA +3 -3
  29. {mx_bluesky-1.4.9.dist-info → mx_bluesky-1.5.0.dist-info}/RECORD +37 -33
  30. /mx_bluesky/common/{plans → experiment_plans}/__init__.py +0 -0
  31. /mx_bluesky/common/{plans → experiment_plans}/inner_plans/__init__ .py +0 -0
  32. /mx_bluesky/common/{plans → experiment_plans}/read_hardware.py +0 -0
  33. /mx_bluesky/common/{plans → experiment_plans}/write_sample_status.py +0 -0
  34. {mx_bluesky-1.4.9.dist-info → mx_bluesky-1.5.0.dist-info}/WHEEL +0 -0
  35. {mx_bluesky-1.4.9.dist-info → mx_bluesky-1.5.0.dist-info}/entry_points.txt +0 -0
  36. {mx_bluesky-1.4.9.dist-info → mx_bluesky-1.5.0.dist-info}/licenses/LICENSE +0 -0
  37. {mx_bluesky-1.4.9.dist-info → mx_bluesky-1.5.0.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,8 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from pathlib import Path
4
+ from typing import Protocol, TypeVar
4
5
 
5
- from blueapi.core import BlueskyContext
6
6
  from bluesky import plan_stubs as bps
7
7
  from bluesky import preprocessors as bpp
8
8
  from bluesky.preprocessors import subs_decorator
@@ -10,20 +10,27 @@ from bluesky.utils import MsgGenerator
10
10
  from dodal.devices.backlight import BacklightPosition
11
11
  from dodal.devices.eiger import EigerDetector
12
12
  from dodal.devices.oav.oav_parameters import OAVParameters
13
- from dodal.plans.preprocessors.verify_undulator_gap import (
14
- verify_undulator_gap_before_run_decorator,
15
- )
16
13
 
17
14
  from mx_bluesky.common.device_setup_plans.manipulate_sample import (
18
15
  move_aperture_if_required,
19
16
  )
17
+ from mx_bluesky.common.device_setup_plans.utils import (
18
+ start_preparing_data_collection_then_do_plan,
19
+ )
20
20
  from mx_bluesky.common.experiment_plans.change_aperture_then_move_plan import (
21
21
  change_aperture_then_move_to_xtal,
22
22
  )
23
+ from mx_bluesky.common.experiment_plans.common_flyscan_xray_centre_plan import (
24
+ BeamlineSpecificFGSFeatures,
25
+ common_flyscan_xray_centre,
26
+ )
23
27
  from mx_bluesky.common.experiment_plans.oav_grid_detection_plan import (
24
28
  OavGridDetectionComposite,
25
29
  grid_detection_plan,
26
30
  )
31
+ from mx_bluesky.common.experiment_plans.oav_snapshot_plan import (
32
+ setup_beamline_for_OAV,
33
+ )
27
34
  from mx_bluesky.common.external_interaction.callbacks.common.grid_detection_callback import (
28
35
  GridDetectionCallback,
29
36
  GridParamUpdate,
@@ -31,62 +38,97 @@ from mx_bluesky.common.external_interaction.callbacks.common.grid_detection_call
31
38
  from mx_bluesky.common.external_interaction.callbacks.xray_centre.ispyb_callback import (
32
39
  ispyb_activation_wrapper,
33
40
  )
34
- from mx_bluesky.common.parameters.constants import OavConstants
35
- from mx_bluesky.common.parameters.gridscan import GridCommon
36
- from mx_bluesky.common.plans.common_flyscan_xray_centre_plan import (
37
- BeamlineSpecificFGSFeatures,
38
- common_flyscan_xray_centre,
41
+ from mx_bluesky.common.parameters.constants import (
42
+ OavConstants,
43
+ PlanGroupCheckpointConstants,
39
44
  )
40
- from mx_bluesky.common.preprocessors.preprocessors import (
41
- transmission_and_xbpm_feedback_for_collection_decorator,
45
+ from mx_bluesky.common.parameters.device_composites import (
46
+ FlyScanEssentialDevices,
47
+ GridDetectThenXRayCentreComposite,
42
48
  )
43
- from mx_bluesky.common.utils.context import device_composite_from_context
49
+ from mx_bluesky.common.parameters.gridscan import GridCommon, SpecifiedThreeDGridScan
44
50
  from mx_bluesky.common.utils.log import LOGGER
45
51
  from mx_bluesky.common.xrc_result import XRayCentreEventHandler
46
- from mx_bluesky.hyperion.device_setup_plans.utils import (
47
- start_preparing_data_collection_then_do_plan,
48
- )
49
- from mx_bluesky.hyperion.experiment_plans.hyperion_flyscan_xray_centre_plan import (
50
- construct_hyperion_specific_features,
51
- )
52
- from mx_bluesky.hyperion.experiment_plans.oav_snapshot_plan import (
53
- setup_beamline_for_OAV,
54
- )
55
- from mx_bluesky.hyperion.parameters.constants import CONST
56
- from mx_bluesky.hyperion.parameters.device_composites import (
57
- GridDetectThenXRayCentreComposite,
58
- HyperionFlyScanXRayCentreComposite,
52
+
53
+ TFlyScanEssentialDevices = TypeVar(
54
+ "TFlyScanEssentialDevices", bound=FlyScanEssentialDevices, contravariant=True
59
55
  )
60
- from mx_bluesky.hyperion.parameters.gridscan import (
61
- GridScanWithEdgeDetect,
62
- HyperionSpecifiedThreeDGridScan,
56
+ TSpecifiedThreeDGridScan = TypeVar(
57
+ "TSpecifiedThreeDGridScan", bound=SpecifiedThreeDGridScan, contravariant=True
63
58
  )
64
59
 
65
60
 
66
- def create_devices(context: BlueskyContext) -> GridDetectThenXRayCentreComposite:
67
- return device_composite_from_context(context, GridDetectThenXRayCentreComposite)
61
+ def grid_detect_then_xray_centre(
62
+ composite: GridDetectThenXRayCentreComposite,
63
+ parameters: GridCommon,
64
+ xrc_params_type: type[SpecifiedThreeDGridScan],
65
+ construct_beamline_specific: ConstructBeamlineSpecificFeatures,
66
+ oav_config: str = OavConstants.OAV_CONFIG_JSON,
67
+ ) -> MsgGenerator:
68
+ """
69
+ A plan which combines the collection of snapshots from the OAV and the determination
70
+ of the grid dimensions to use for the following grid scan.
71
+ """
68
72
 
73
+ eiger: EigerDetector = composite.eiger
69
74
 
70
- def create_parameters_for_flyscan_xray_centre(
71
- grid_scan_with_edge_params: GridCommon,
72
- grid_parameters: GridParamUpdate,
73
- ) -> HyperionSpecifiedThreeDGridScan:
74
- params_json = grid_scan_with_edge_params.model_dump()
75
- params_json.update(grid_parameters)
76
- flyscan_xray_centre_parameters = HyperionSpecifiedThreeDGridScan(**params_json)
77
- LOGGER.info(f"Parameters for FGS: {flyscan_xray_centre_parameters}")
78
- return flyscan_xray_centre_parameters
75
+ eiger.set_detector_parameters(parameters.detector_params)
76
+
77
+ oav_params = OAVParameters("xrayCentring", oav_config)
78
+
79
+ flyscan_event_handler = XRayCentreEventHandler()
80
+
81
+ @subs_decorator(flyscan_event_handler)
82
+ def plan_to_perform():
83
+ yield from ispyb_activation_wrapper(
84
+ detect_grid_and_do_gridscan(
85
+ composite,
86
+ parameters,
87
+ oav_params,
88
+ xrc_params_type,
89
+ construct_beamline_specific,
90
+ ),
91
+ parameters,
92
+ )
93
+
94
+ yield from start_preparing_data_collection_then_do_plan(
95
+ composite.beamstop,
96
+ eiger,
97
+ composite.detector_motion,
98
+ parameters.detector_params.detector_distance,
99
+ plan_to_perform(),
100
+ group=PlanGroupCheckpointConstants.GRID_READY_FOR_DC,
101
+ )
102
+
103
+ assert flyscan_event_handler.xray_centre_results, (
104
+ "Flyscan result event not received or no crystal found and exception not raised"
105
+ )
106
+
107
+ yield from change_aperture_then_move_to_xtal(
108
+ flyscan_event_handler.xray_centre_results[0],
109
+ composite.smargon,
110
+ composite.aperture_scatterguard,
111
+ )
79
112
 
80
113
 
81
114
  def detect_grid_and_do_gridscan(
82
115
  composite: GridDetectThenXRayCentreComposite,
83
116
  parameters: GridCommon,
84
117
  oav_params: OAVParameters,
118
+ xrc_params_type: type[SpecifiedThreeDGridScan],
119
+ construct_beamline_specific: ConstructBeamlineSpecificFeatures,
85
120
  ):
86
121
  snapshot_template = f"{parameters.detector_params.prefix}_{parameters.detector_params.run_number}_{{angle}}"
87
122
 
88
123
  grid_params_callback = GridDetectionCallback()
89
124
 
125
+ yield from setup_beamline_for_OAV(
126
+ composite.smargon,
127
+ composite.backlight,
128
+ composite.aperture_scatterguard,
129
+ wait=True,
130
+ )
131
+
90
132
  @bpp.subs_decorator([grid_params_callback])
91
133
  def run_grid_detection_plan(
92
134
  oav_params,
@@ -109,19 +151,12 @@ def detect_grid_and_do_gridscan(
109
151
  parameters.box_size_um,
110
152
  )
111
153
 
112
- yield from setup_beamline_for_OAV(
113
- composite.smargon,
114
- composite.backlight,
115
- composite.aperture_scatterguard,
116
- wait=True,
117
- )
118
-
119
154
  if parameters.selected_aperture:
120
155
  # Start moving the aperture/scatterguard into position without moving it in
121
156
  yield from bps.prepare(
122
157
  composite.aperture_scatterguard,
123
158
  parameters.selected_aperture,
124
- group=CONST.WAIT.PREPARE_APERTURE,
159
+ group=PlanGroupCheckpointConstants.PREPARE_APERTURE,
125
160
  )
126
161
 
127
162
  yield from run_grid_detection_plan(
@@ -131,105 +166,42 @@ def detect_grid_and_do_gridscan(
131
166
  )
132
167
 
133
168
  yield from bps.abs_set(
134
- composite.backlight, BacklightPosition.OUT, group=CONST.WAIT.GRID_READY_FOR_DC
169
+ composite.backlight,
170
+ BacklightPosition.OUT,
171
+ group=PlanGroupCheckpointConstants.GRID_READY_FOR_DC,
135
172
  )
136
173
 
137
- yield from bps.wait(CONST.WAIT.PREPARE_APERTURE)
174
+ yield from bps.wait(PlanGroupCheckpointConstants.PREPARE_APERTURE)
138
175
  yield from move_aperture_if_required(
139
176
  composite.aperture_scatterguard,
140
177
  parameters.selected_aperture,
141
- group=CONST.WAIT.GRID_READY_FOR_DC,
178
+ group=PlanGroupCheckpointConstants.GRID_READY_FOR_DC,
142
179
  )
143
-
144
- xrc_composite = HyperionFlyScanXRayCentreComposite(
145
- aperture_scatterguard=composite.aperture_scatterguard,
146
- attenuator=composite.attenuator,
147
- backlight=composite.backlight,
148
- eiger=composite.eiger,
149
- panda_fast_grid_scan=composite.panda_fast_grid_scan,
150
- flux=composite.flux,
151
- s4_slit_gaps=composite.s4_slit_gaps,
152
- smargon=composite.smargon,
153
- undulator=composite.undulator,
154
- synchrotron=composite.synchrotron,
155
- xbpm_feedback=composite.xbpm_feedback,
156
- zebra=composite.zebra,
157
- zocalo=composite.zocalo,
158
- panda=composite.panda,
159
- zebra_fast_grid_scan=composite.zebra_fast_grid_scan,
160
- dcm=composite.dcm,
161
- robot=composite.robot,
162
- sample_shutter=composite.sample_shutter,
180
+ xrc_params = create_parameters_for_flyscan_xray_centre(
181
+ parameters, grid_params_callback.get_grid_parameters(), xrc_params_type
163
182
  )
183
+ beamline_specific = construct_beamline_specific(composite, xrc_params)
164
184
 
165
- params = create_parameters_for_flyscan_xray_centre(
166
- parameters, grid_params_callback.get_grid_parameters()
167
- )
185
+ yield from common_flyscan_xray_centre(composite, xrc_params, beamline_specific)
168
186
 
169
- beamline_specific = construct_hyperion_specific_features(xrc_composite, params)
170
187
 
171
- yield from _gridscan_with_undulator_checks(xrc_composite, params, beamline_specific)
172
-
173
-
174
- def _gridscan_with_undulator_checks(
175
- composite: HyperionFlyScanXRayCentreComposite,
176
- params: HyperionSpecifiedThreeDGridScan,
177
- beamline_specific: BeamlineSpecificFGSFeatures,
188
+ class ConstructBeamlineSpecificFeatures(
189
+ Protocol[TFlyScanEssentialDevices, TSpecifiedThreeDGridScan]
178
190
  ):
179
- @transmission_and_xbpm_feedback_for_collection_decorator(
180
- composite, params.transmission_frac
181
- )
182
- @verify_undulator_gap_before_run_decorator(composite)
183
- def _inner():
184
- yield from common_flyscan_xray_centre(composite, params, beamline_specific)
185
-
186
- yield from _inner()
191
+ def __call__(
192
+ self,
193
+ xrc_composite: TFlyScanEssentialDevices,
194
+ xrc_parameters: TSpecifiedThreeDGridScan,
195
+ ) -> BeamlineSpecificFGSFeatures: ...
187
196
 
188
197
 
189
- def grid_detect_then_xray_centre(
190
- composite: GridDetectThenXRayCentreComposite,
191
- parameters: GridScanWithEdgeDetect,
192
- oav_config: str = OavConstants.OAV_CONFIG_JSON,
193
- ) -> MsgGenerator:
194
- """
195
- A plan which combines the collection of snapshots from the OAV and the determination
196
- of the grid dimensions to use for the following grid scan.
197
- """
198
-
199
- eiger: EigerDetector = composite.eiger
200
-
201
- eiger.set_detector_parameters(parameters.detector_params)
202
-
203
- oav_params = OAVParameters("xrayCentring", oav_config)
204
-
205
- flyscan_event_handler = XRayCentreEventHandler()
206
-
207
- @subs_decorator(flyscan_event_handler)
208
- def plan_to_perform():
209
- yield from ispyb_activation_wrapper(
210
- detect_grid_and_do_gridscan(
211
- composite,
212
- parameters,
213
- oav_params,
214
- ),
215
- parameters,
216
- )
217
-
218
- yield from start_preparing_data_collection_then_do_plan(
219
- composite.beamstop,
220
- eiger,
221
- composite.detector_motion,
222
- parameters.detector_params.detector_distance,
223
- plan_to_perform(),
224
- group=CONST.WAIT.GRID_READY_FOR_DC,
225
- )
226
-
227
- assert flyscan_event_handler.xray_centre_results, (
228
- "Flyscan result event not received or no crystal found and exception not raised"
229
- )
230
-
231
- yield from change_aperture_then_move_to_xtal(
232
- flyscan_event_handler.xray_centre_results[0],
233
- composite.smargon,
234
- composite.aperture_scatterguard,
235
- )
198
+ def create_parameters_for_flyscan_xray_centre(
199
+ parameters: GridCommon,
200
+ grid_parameters: GridParamUpdate,
201
+ xrc_params_type: type[SpecifiedThreeDGridScan],
202
+ ) -> SpecifiedThreeDGridScan:
203
+ params_json = parameters.model_dump()
204
+ params_json.update(grid_parameters)
205
+ flyscan_xray_centre_parameters = xrc_params_type(**params_json)
206
+ LOGGER.info(f"Parameters for FGS: {flyscan_xray_centre_parameters}")
207
+ return flyscan_xray_centre_parameters
@@ -14,10 +14,10 @@ from dodal.log import LOGGER
14
14
  from dodal.plan_stubs.check_topup import check_topup_and_wait_if_necessary
15
15
  from scanspec.core import AxesPoints, Axis
16
16
 
17
+ from mx_bluesky.common.experiment_plans.read_hardware import read_hardware_for_zocalo
17
18
  from mx_bluesky.common.parameters.constants import (
18
19
  PlanNameConstants,
19
20
  )
20
- from mx_bluesky.common.plans.read_hardware import read_hardware_for_zocalo
21
21
  from mx_bluesky.common.utils.tracing import TRACER
22
22
 
23
23
 
@@ -5,9 +5,7 @@ from typing import TYPE_CHECKING
5
5
 
6
6
  import bluesky.plan_stubs as bps
7
7
  import numpy as np
8
- import pydantic
9
8
  from blueapi.core import BlueskyContext
10
- from dodal.devices.backlight import Backlight
11
9
  from dodal.devices.oav.oav_detector import OAV
12
10
  from dodal.devices.oav.pin_image_recognition import PinTipDetection
13
11
  from dodal.devices.oav.pin_image_recognition.utils import NONE_VALUE
@@ -17,7 +15,11 @@ from dodal.devices.smargon import Smargon
17
15
  from mx_bluesky.common.device_setup_plans.setup_oav import (
18
16
  pre_centring_setup_oav,
19
17
  )
20
- from mx_bluesky.common.parameters.constants import DocDescriptorNames, HardwareConstants
18
+ from mx_bluesky.common.parameters.constants import (
19
+ DocDescriptorNames,
20
+ HardwareConstants,
21
+ )
22
+ from mx_bluesky.common.parameters.device_composites import OavGridDetectionComposite
21
23
  from mx_bluesky.common.utils.context import device_composite_from_context
22
24
  from mx_bluesky.common.utils.exceptions import catch_exception_and_warn
23
25
  from mx_bluesky.common.utils.log import LOGGER
@@ -26,16 +28,6 @@ if TYPE_CHECKING:
26
28
  from dodal.devices.oav.oav_parameters import OAVParameters
27
29
 
28
30
 
29
- @pydantic.dataclasses.dataclass(config={"arbitrary_types_allowed": True})
30
- class OavGridDetectionComposite:
31
- """All devices which are directly or indirectly required by this plan"""
32
-
33
- backlight: Backlight
34
- oav: OAV
35
- smargon: Smargon
36
- pin_tip_detection: PinTipDetection
37
-
38
-
39
31
  def create_devices(context: BlueskyContext) -> OavGridDetectionComposite:
40
32
  return device_composite_from_context(context, OavGridDetectionComposite)
41
33
 
@@ -11,7 +11,10 @@ from dodal.devices.smargon import Smargon
11
11
 
12
12
  from mx_bluesky.common.device_setup_plans.setup_oav import setup_general_oav_params
13
13
  from mx_bluesky.common.parameters.components import WithSnapshot
14
- from mx_bluesky.hyperion.parameters.constants import CONST, DocDescriptorNames
14
+ from mx_bluesky.common.parameters.constants import (
15
+ DocDescriptorNames,
16
+ PlanGroupCheckpointConstants,
17
+ )
15
18
 
16
19
  OAV_SNAPSHOT_SETUP_SHOT = "oav_snapshot_setup_shot"
17
20
  OAV_SNAPSHOT_GROUP = "oav_snapshot_group"
@@ -28,7 +31,7 @@ def setup_beamline_for_OAV(
28
31
  smargon: Smargon,
29
32
  backlight: Backlight,
30
33
  aperture_scatterguard: ApertureScatterguard,
31
- group=CONST.WAIT.READY_FOR_OAV,
34
+ group=PlanGroupCheckpointConstants.READY_FOR_OAV,
32
35
  wait=False,
33
36
  ):
34
37
  max_vel = yield from bps.rd(smargon.omega.max_velocity)
@@ -136,7 +136,7 @@ class WithSnapshot(BaseModel):
136
136
 
137
137
  @model_validator(mode="after")
138
138
  def _validate_omegas_with_grid_snapshots(self) -> Self:
139
- assert not self.use_grid_snapshots or self.snapshot_omegas_deg is None, (
139
+ assert not self.use_grid_snapshots or not self.snapshot_omegas_deg, (
140
140
  "snapshot_omegas may not be specified with use_grid_snapshots"
141
141
  )
142
142
  return self
@@ -0,0 +1,65 @@
1
+ import pydantic
2
+ from dodal.devices.aperturescatterguard import (
3
+ ApertureScatterguard,
4
+ )
5
+ from dodal.devices.attenuator.attenuator import BinaryFilterAttenuator
6
+ from dodal.devices.backlight import Backlight
7
+ from dodal.devices.common_dcm import BaseDCM
8
+ from dodal.devices.detector.detector_motion import DetectorMotion
9
+ from dodal.devices.eiger import EigerDetector
10
+ from dodal.devices.fast_grid_scan import (
11
+ ZebraFastGridScan,
12
+ )
13
+ from dodal.devices.flux import Flux
14
+ from dodal.devices.i03 import Beamstop
15
+ from dodal.devices.oav.oav_detector import OAV
16
+ from dodal.devices.oav.pin_image_recognition import PinTipDetection
17
+ from dodal.devices.robot import BartRobot
18
+ from dodal.devices.s4_slit_gaps import S4SlitGaps
19
+ from dodal.devices.smargon import Smargon
20
+ from dodal.devices.synchrotron import Synchrotron
21
+ from dodal.devices.undulator import Undulator
22
+ from dodal.devices.xbpm_feedback import XBPMFeedback
23
+ from dodal.devices.zebra.zebra import Zebra
24
+ from dodal.devices.zebra.zebra_controlled_shutter import ZebraShutter
25
+ from dodal.devices.zocalo import ZocaloResults
26
+
27
+
28
+ @pydantic.dataclasses.dataclass(config={"arbitrary_types_allowed": True})
29
+ class FlyScanEssentialDevices:
30
+ eiger: EigerDetector
31
+ synchrotron: Synchrotron
32
+ zocalo: ZocaloResults
33
+ smargon: Smargon
34
+
35
+
36
+ @pydantic.dataclasses.dataclass(config={"arbitrary_types_allowed": True})
37
+ class OavGridDetectionComposite:
38
+ """All devices which are directly or indirectly required by this plan"""
39
+
40
+ backlight: Backlight
41
+ oav: OAV
42
+ smargon: Smargon
43
+ pin_tip_detection: PinTipDetection
44
+
45
+
46
+ @pydantic.dataclasses.dataclass(config={"arbitrary_types_allowed": True})
47
+ class GridDetectThenXRayCentreComposite(FlyScanEssentialDevices):
48
+ """All devices which are directly or indirectly required by this plan"""
49
+
50
+ aperture_scatterguard: ApertureScatterguard
51
+ attenuator: BinaryFilterAttenuator
52
+ backlight: Backlight
53
+ beamstop: Beamstop
54
+ dcm: BaseDCM
55
+ detector_motion: DetectorMotion
56
+ zebra_fast_grid_scan: ZebraFastGridScan
57
+ flux: Flux
58
+ oav: OAV
59
+ pin_tip_detection: PinTipDetection
60
+ s4_slit_gaps: S4SlitGaps
61
+ undulator: Undulator
62
+ xbpm_feedback: XBPMFeedback
63
+ zebra: Zebra
64
+ robot: BartRobot
65
+ sample_shutter: ZebraShutter
File without changes
@@ -1,20 +1,8 @@
1
- from collections.abc import Generator
2
-
3
1
  from bluesky import plan_stubs as bps
4
- from bluesky import preprocessors as bpp
5
- from bluesky.utils import Msg
6
2
  from dodal.devices.detector import (
7
3
  DetectorParams,
8
4
  )
9
- from dodal.devices.detector.detector_motion import DetectorMotion, ShutterState
10
- from dodal.devices.eiger import EigerDetector
11
5
  from dodal.devices.i03.dcm import DCM
12
- from dodal.devices.mx_phase1.beamstop import Beamstop, BeamstopPositions
13
-
14
- from mx_bluesky.common.device_setup_plans.position_detector import (
15
- set_detector_z_position,
16
- set_shutter,
17
- )
18
6
 
19
7
 
20
8
  def fill_in_energy_if_not_supplied(dcm: DCM, detector_params: DetectorParams):
@@ -22,39 +10,3 @@ def fill_in_energy_if_not_supplied(dcm: DCM, detector_params: DetectorParams):
22
10
  actual_energy_ev = 1000 * (yield from bps.rd(dcm.energy_in_kev))
23
11
  detector_params.expected_energy_ev = actual_energy_ev
24
12
  return detector_params
25
-
26
-
27
- def start_preparing_data_collection_then_do_plan(
28
- beamstop: Beamstop,
29
- eiger: EigerDetector,
30
- detector_motion: DetectorMotion,
31
- detector_distance_mm: float | None,
32
- plan_to_run: Generator[Msg, None, None],
33
- group="ready_for_data_collection",
34
- ) -> Generator[Msg, None, None]:
35
- """Starts preparing for the next data collection and then runs the
36
- given plan.
37
-
38
- Preparation consists of:
39
- * Arming the Eiger
40
- * Moving the detector to the specified position
41
- * Opening the detect shutter
42
- If the plan fails it will disarm the eiger.
43
- """
44
-
45
- def wrapped_plan():
46
- yield from bps.abs_set(eiger.do_arm, 1, group=group) # type: ignore # Fix types in ophyd-async (https://github.com/DiamondLightSource/mx-bluesky/issues/855)
47
- yield from bps.abs_set(
48
- beamstop.selected_pos, BeamstopPositions.DATA_COLLECTION, group=group
49
- )
50
- if detector_distance_mm:
51
- yield from set_detector_z_position(
52
- detector_motion, detector_distance_mm, group
53
- )
54
- yield from set_shutter(detector_motion, ShutterState.OPEN, group)
55
- yield from plan_to_run
56
-
57
- yield from bpp.contingency_wrapper(
58
- wrapped_plan(),
59
- except_plan=lambda e: (yield from bps.stop(eiger)), # type: ignore # Fix types in ophyd-async (https://github.com/DiamondLightSource/mx-bluesky/issues/855)
60
- )
@@ -3,8 +3,8 @@
3
3
  The __all__ list in here are the plans that are externally available from outside Hyperion.
4
4
  """
5
5
 
6
- from mx_bluesky.hyperion.experiment_plans.grid_detect_then_xray_centre_plan import (
7
- grid_detect_then_xray_centre,
6
+ from mx_bluesky.hyperion.experiment_plans.hyperion_grid_detect_then_xray_centre_plan import (
7
+ hyperion_grid_detect_then_xray_centre,
8
8
  )
9
9
  from mx_bluesky.hyperion.experiment_plans.load_centre_collect_full_plan import (
10
10
  load_centre_collect_full,
@@ -17,7 +17,7 @@ from mx_bluesky.hyperion.experiment_plans.rotation_scan_plan import (
17
17
  )
18
18
 
19
19
  __all__ = [
20
- "grid_detect_then_xray_centre",
20
+ "hyperion_grid_detect_then_xray_centre",
21
21
  "pin_tip_centre_then_xray_centre",
22
22
  "rotation_scan",
23
23
  "load_centre_collect_full",
@@ -5,7 +5,7 @@ from typing import TypedDict
5
5
 
6
6
  import mx_bluesky.hyperion.experiment_plans.rotation_scan_plan as rotation_scan_plan
7
7
  from mx_bluesky.hyperion.experiment_plans import (
8
- grid_detect_then_xray_centre_plan,
8
+ hyperion_grid_detect_then_xray_centre_plan,
9
9
  load_centre_collect_full_plan,
10
10
  pin_centre_then_xray_centre_plan,
11
11
  )
@@ -38,8 +38,8 @@ class ExperimentRegistryEntry(TypedDict):
38
38
 
39
39
 
40
40
  PLAN_REGISTRY: dict[str, ExperimentRegistryEntry] = {
41
- "grid_detect_then_xray_centre": {
42
- "setup": grid_detect_then_xray_centre_plan.create_devices,
41
+ "hyperion_grid_detect_then_xray_centre": {
42
+ "setup": hyperion_grid_detect_then_xray_centre_plan.create_devices,
43
43
  "param_type": GridScanWithEdgeDetect,
44
44
  },
45
45
  "pin_tip_centre_then_xray_centre": {