mx-bluesky 0.3.1__py3-none-any.whl → 1.1.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 (138) hide show
  1. mx_bluesky/_version.py +2 -2
  2. mx_bluesky/beamlines/i04/__init__.py +3 -0
  3. mx_bluesky/{i04 → beamlines/i04}/thawing_plan.py +5 -4
  4. mx_bluesky/{i24 → beamlines/i24}/serial/blueapi_config.yaml +1 -1
  5. mx_bluesky/{i24 → beamlines/i24}/serial/dcid.py +2 -2
  6. mx_bluesky/{i24 → beamlines/i24}/serial/extruder/EX-gui-edm/DetStage.edl +3 -3
  7. mx_bluesky/{i24 → beamlines/i24}/serial/extruder/EX-gui-edm/DiamondExtruder-I24-py3v1.edl +7 -7
  8. mx_bluesky/{i24 → beamlines/i24}/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +12 -9
  9. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/CustomChip_py3v1.edl +3 -3
  10. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/DetStage.edl +3 -3
  11. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/DiamondChipI24-py3v1.edl +245 -200
  12. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/MappingLite-oxford_py3v1.edl +4 -4
  13. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/pumpprobe-py3v1.edl +8 -8
  14. mx_bluesky/beamlines/i24/serial/fixed_target/__init__.py +0 -0
  15. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +80 -70
  16. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +20 -21
  17. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/i24ssx_Chip_Mapping_py3v1.py +5 -5
  18. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/i24ssx_Chip_StartUp_py3v1.py +7 -4
  19. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/i24ssx_moveonclick.py +59 -39
  20. mx_bluesky/{i24 → beamlines/i24}/serial/log.py +1 -9
  21. mx_bluesky/beamlines/i24/serial/parameters/__init__.py +15 -0
  22. mx_bluesky/{i24 → beamlines/i24}/serial/parameters/constants.py +1 -1
  23. mx_bluesky/{i24 → beamlines/i24}/serial/parameters/experiment_parameters.py +4 -25
  24. mx_bluesky/{i24 → beamlines/i24}/serial/parameters/utils.py +5 -3
  25. mx_bluesky/{i24 → beamlines/i24}/serial/run_serial.py +1 -1
  26. mx_bluesky/{i24 → beamlines/i24}/serial/setup_beamline/pv_abstract.py +1 -1
  27. mx_bluesky/{i24 → beamlines/i24}/serial/setup_beamline/setup_beamline.py +2 -2
  28. mx_bluesky/{i24 → beamlines/i24}/serial/setup_beamline/setup_detector.py +5 -5
  29. mx_bluesky/{i24 → beamlines/i24}/serial/write_nexus.py +6 -3
  30. mx_bluesky/hyperion/__init__.py +1 -0
  31. mx_bluesky/hyperion/__main__.py +374 -0
  32. mx_bluesky/hyperion/device_setup_plans/__init__.py +0 -0
  33. mx_bluesky/hyperion/device_setup_plans/dcm_pitch_roll_mirror_adjuster.py +134 -0
  34. mx_bluesky/hyperion/device_setup_plans/manipulate_sample.py +110 -0
  35. mx_bluesky/hyperion/device_setup_plans/position_detector.py +16 -0
  36. mx_bluesky/hyperion/device_setup_plans/read_hardware_for_setup.py +60 -0
  37. mx_bluesky/hyperion/device_setup_plans/setup_oav.py +87 -0
  38. mx_bluesky/hyperion/device_setup_plans/setup_panda.py +210 -0
  39. mx_bluesky/hyperion/device_setup_plans/setup_zebra.py +214 -0
  40. mx_bluesky/hyperion/device_setup_plans/smargon.py +25 -0
  41. mx_bluesky/hyperion/device_setup_plans/utils.py +44 -0
  42. mx_bluesky/hyperion/device_setup_plans/xbpm_feedback.py +93 -0
  43. mx_bluesky/hyperion/exceptions.py +47 -0
  44. mx_bluesky/hyperion/experiment_plans/__init__.py +30 -0
  45. mx_bluesky/hyperion/experiment_plans/experiment_registry.py +84 -0
  46. mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py +528 -0
  47. mx_bluesky/hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py +209 -0
  48. mx_bluesky/hyperion/experiment_plans/oav_grid_detection_plan.py +173 -0
  49. mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +81 -0
  50. mx_bluesky/hyperion/experiment_plans/optimise_attenuation_plan.py +463 -0
  51. mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +119 -0
  52. mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +164 -0
  53. mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +322 -0
  54. mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +436 -0
  55. mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +68 -0
  56. mx_bluesky/hyperion/external_interaction/__init__.py +9 -0
  57. mx_bluesky/hyperion/external_interaction/callbacks/__init__.py +10 -0
  58. mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +148 -0
  59. mx_bluesky/hyperion/external_interaction/callbacks/aperture_change_callback.py +22 -0
  60. mx_bluesky/hyperion/external_interaction/callbacks/common/__init__.py +0 -0
  61. mx_bluesky/hyperion/external_interaction/callbacks/common/callback_util.py +46 -0
  62. mx_bluesky/hyperion/external_interaction/callbacks/common/ispyb_mapping.py +70 -0
  63. mx_bluesky/hyperion/external_interaction/callbacks/grid_detection_callback.py +88 -0
  64. mx_bluesky/hyperion/external_interaction/callbacks/ispyb_callback_base.py +203 -0
  65. mx_bluesky/hyperion/external_interaction/callbacks/log_uid_tag_callback.py +20 -0
  66. mx_bluesky/hyperion/external_interaction/callbacks/logging_callback.py +29 -0
  67. mx_bluesky/hyperion/external_interaction/callbacks/plan_reactive_callback.py +101 -0
  68. mx_bluesky/hyperion/external_interaction/callbacks/robot_load/ispyb_callback.py +88 -0
  69. mx_bluesky/hyperion/external_interaction/callbacks/rotation/__init__.py +0 -0
  70. mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_callback.py +174 -0
  71. mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_mapping.py +17 -0
  72. mx_bluesky/hyperion/external_interaction/callbacks/rotation/nexus_callback.py +102 -0
  73. mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/__init__.py +0 -0
  74. mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/ispyb_callback.py +269 -0
  75. mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/ispyb_mapping.py +53 -0
  76. mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/nexus_callback.py +95 -0
  77. mx_bluesky/hyperion/external_interaction/callbacks/zocalo_callback.py +92 -0
  78. mx_bluesky/hyperion/external_interaction/config_server.py +35 -0
  79. mx_bluesky/hyperion/external_interaction/exceptions.py +13 -0
  80. mx_bluesky/hyperion/external_interaction/ispyb/__init__.py +0 -0
  81. mx_bluesky/hyperion/external_interaction/ispyb/data_model.py +95 -0
  82. mx_bluesky/hyperion/external_interaction/ispyb/exp_eye_store.py +125 -0
  83. mx_bluesky/hyperion/external_interaction/ispyb/ispyb_store.py +276 -0
  84. mx_bluesky/hyperion/external_interaction/ispyb/ispyb_utils.py +29 -0
  85. mx_bluesky/hyperion/external_interaction/nexus/__init__.py +0 -0
  86. mx_bluesky/hyperion/external_interaction/nexus/nexus_utils.py +148 -0
  87. mx_bluesky/hyperion/external_interaction/nexus/write_nexus.py +114 -0
  88. mx_bluesky/hyperion/log.py +99 -0
  89. mx_bluesky/hyperion/parameters/__init__.py +2 -0
  90. mx_bluesky/hyperion/parameters/cli.py +68 -0
  91. mx_bluesky/{parameters → hyperion/parameters}/components.py +77 -24
  92. mx_bluesky/hyperion/parameters/constants.py +158 -0
  93. mx_bluesky/hyperion/parameters/gridscan.py +216 -0
  94. mx_bluesky/hyperion/parameters/rotation.py +160 -0
  95. mx_bluesky/hyperion/resources/panda/panda-gridscan.yaml +964 -0
  96. mx_bluesky/hyperion/tracing.py +28 -0
  97. mx_bluesky/hyperion/utils/context.py +84 -0
  98. mx_bluesky/hyperion/utils/utils.py +25 -0
  99. mx_bluesky/hyperion/utils/validation.py +196 -0
  100. mx_bluesky/jupyter_example.ipynb +3 -2
  101. {mx_bluesky-0.3.1.dist-info → mx_bluesky-1.1.0.dist-info}/METADATA +26 -11
  102. mx_bluesky-1.1.0.dist-info/RECORD +136 -0
  103. {mx_bluesky-0.3.1.dist-info → mx_bluesky-1.1.0.dist-info}/WHEEL +1 -1
  104. mx_bluesky-1.1.0.dist-info/entry_points.txt +8 -0
  105. mx_bluesky/i04/__init__.py +0 -3
  106. mx_bluesky/i24/serial/parameters/__init__.py +0 -15
  107. mx_bluesky/parameters/__init__.py +0 -31
  108. mx_bluesky-0.3.1.dist-info/RECORD +0 -67
  109. mx_bluesky-0.3.1.dist-info/entry_points.txt +0 -4
  110. /mx_bluesky/{i24 → beamlines}/__init__.py +0 -0
  111. /mx_bluesky/{i04 → beamlines/i04}/callbacks/murko_callback.py +0 -0
  112. /mx_bluesky/{i24/serial/extruder → beamlines/i24}/__init__.py +0 -0
  113. /mx_bluesky/{i24 → beamlines/i24}/serial/__init__.py +0 -0
  114. /mx_bluesky/{i24 → beamlines/i24}/serial/extruder/EX-gui-edm/microdrop_alignment.edl +0 -0
  115. /mx_bluesky/{i24/serial/fixed_target → beamlines/i24/serial/extruder}/__init__.py +0 -0
  116. /mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/ME14E-GeneralPurpose.edl +0 -0
  117. /mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/PMAC_Command.edl +0 -0
  118. /mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/Shutter_Control.edl +0 -0
  119. /mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/microdrop_alignment.edl +0 -0
  120. /mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/nudgechip.edl +0 -0
  121. /mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/short1-laser.png +0 -0
  122. /mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/short2-laser.png +0 -0
  123. /mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/ft_utils.py +0 -0
  124. /mx_bluesky/{i24 → beamlines/i24}/serial/parameters/fixed_target/cs/cs_maker.json +0 -0
  125. /mx_bluesky/{i24 → beamlines/i24}/serial/parameters/fixed_target/cs/motor_direction.txt +0 -0
  126. /mx_bluesky/{i24 → beamlines/i24}/serial/parameters/fixed_target/pvar_files/minichip-oxford.pvar +0 -0
  127. /mx_bluesky/{i24 → beamlines/i24}/serial/parameters/fixed_target/pvar_files/oxford.pvar +0 -0
  128. /mx_bluesky/{i24 → beamlines/i24}/serial/run_extruder.sh +0 -0
  129. /mx_bluesky/{i24 → beamlines/i24}/serial/run_fixed_target.sh +0 -0
  130. /mx_bluesky/{i24 → beamlines/i24}/serial/run_ssx.sh +0 -0
  131. /mx_bluesky/{i24 → beamlines/i24}/serial/set_visit_directory.sh +0 -0
  132. /mx_bluesky/{i24 → beamlines/i24}/serial/setup_beamline/__init__.py +0 -0
  133. /mx_bluesky/{i24 → beamlines/i24}/serial/setup_beamline/ca.py +0 -0
  134. /mx_bluesky/{i24 → beamlines/i24}/serial/setup_beamline/pv.py +0 -0
  135. /mx_bluesky/{i24 → beamlines/i24}/serial/setup_beamline/setup_zebra_plans.py +0 -0
  136. /mx_bluesky/{i24 → beamlines/i24}/serial/start_blueapi.sh +0 -0
  137. {mx_bluesky-0.3.1.dist-info → mx_bluesky-1.1.0.dist-info}/LICENSE +0 -0
  138. {mx_bluesky-0.3.1.dist-info → mx_bluesky-1.1.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,25 @@
1
+ import numpy as np
2
+ from bluesky import plan_stubs as bps
3
+ from dodal.devices.smargon import Smargon
4
+
5
+ from mx_bluesky.hyperion.exceptions import WarningException
6
+
7
+
8
+ def move_smargon_warn_on_out_of_range(
9
+ smargon: Smargon, position: np.ndarray | list[float] | tuple[float, float, float]
10
+ ):
11
+ """Throws a WarningException if the specified position is out of range for the
12
+ smargon. Otherwise moves to that position."""
13
+ limits = yield from smargon.get_xyz_limits()
14
+ if not limits.position_valid(position):
15
+ raise WarningException(
16
+ "Pin tip centring failed - pin too long/short/bent and out of range"
17
+ )
18
+ yield from bps.mv(
19
+ smargon.x,
20
+ position[0],
21
+ smargon.y,
22
+ position[1],
23
+ smargon.z,
24
+ position[2],
25
+ )
@@ -0,0 +1,44 @@
1
+ from collections.abc import Generator
2
+
3
+ from bluesky import plan_stubs as bps
4
+ from bluesky import preprocessors as bpp
5
+ from bluesky.utils import Msg
6
+ from dodal.devices.detector.detector_motion import DetectorMotion, ShutterState
7
+ from dodal.devices.eiger import EigerDetector
8
+
9
+ from mx_bluesky.hyperion.device_setup_plans.position_detector import (
10
+ set_detector_z_position,
11
+ set_shutter,
12
+ )
13
+
14
+
15
+ def start_preparing_data_collection_then_do_plan(
16
+ eiger: EigerDetector,
17
+ detector_motion: DetectorMotion,
18
+ detector_distance_mm: float | None,
19
+ plan_to_run: Generator[Msg, None, None],
20
+ group="ready_for_data_collection",
21
+ ) -> Generator[Msg, None, None]:
22
+ """Starts preparing for the next data collection and then runs the
23
+ given plan.
24
+
25
+ Preparation consists of:
26
+ * Arming the Eiger
27
+ * Moving the detector to the specified position
28
+ * Opening the detect shutter
29
+ If the plan fails it will disarm the eiger.
30
+ """
31
+
32
+ def wrapped_plan():
33
+ yield from bps.abs_set(eiger.do_arm, 1, group=group)
34
+ if detector_distance_mm:
35
+ yield from set_detector_z_position(
36
+ detector_motion, detector_distance_mm, group
37
+ )
38
+ yield from set_shutter(detector_motion, ShutterState.OPEN, group)
39
+ yield from plan_to_run
40
+
41
+ yield from bpp.contingency_wrapper(
42
+ wrapped_plan(),
43
+ except_plan=lambda e: (yield from bps.stop(eiger)),
44
+ )
@@ -0,0 +1,93 @@
1
+ from bluesky import plan_stubs as bps
2
+ from bluesky.preprocessors import finalize_wrapper
3
+ from bluesky.utils import make_decorator
4
+ from dodal.devices.attenuator import Attenuator
5
+ from dodal.devices.xbpm_feedback import Pause, XBPMFeedback
6
+
7
+ from mx_bluesky.hyperion.log import LOGGER
8
+
9
+
10
+ def _check_and_pause_feedback(
11
+ xbpm_feedback: XBPMFeedback,
12
+ attenuator: Attenuator,
13
+ desired_transmission_fraction: float,
14
+ ):
15
+ """Checks that the xbpm is in position before then turning it off and setting a new
16
+ transmission.
17
+
18
+ Args:
19
+ xbpm_feedback (XBPMFeedback): The XBPM device that is responsible for keeping
20
+ the beam in position
21
+ attenuator (Attenuator): The attenuator used to set transmission
22
+ desired_transmission_fraction (float): The desired transmission to set after
23
+ turning XBPM feedback off.
24
+
25
+ """
26
+ yield from bps.mv(attenuator, 1.0)
27
+ LOGGER.info("Waiting for XBPM feedback to be stable")
28
+ yield from bps.trigger(xbpm_feedback, wait=True)
29
+ LOGGER.info(
30
+ f"XPBM feedback in position, pausing and setting transmission to {desired_transmission_fraction}"
31
+ )
32
+ yield from bps.mv(xbpm_feedback.pause_feedback, Pause.PAUSE)
33
+ yield from bps.mv(attenuator, desired_transmission_fraction)
34
+
35
+
36
+ def _unpause_xbpm_feedback_and_set_transmission_to_1(
37
+ xbpm_feedback: XBPMFeedback, attenuator: Attenuator
38
+ ):
39
+ """Turns the XBPM feedback back on and sets transmission to 1 so that it keeps the
40
+ beam aligned whilst not collecting.
41
+
42
+ Args:
43
+ xbpm_feedback (XBPMFeedback): The XBPM device that is responsible for keeping
44
+ the beam in position
45
+ attenuator (Attenuator): The attenuator used to set transmission
46
+ """
47
+ yield from bps.mv(xbpm_feedback.pause_feedback, Pause.RUN, attenuator, 1.0)
48
+
49
+
50
+ def transmission_and_xbpm_feedback_for_collection_wrapper(
51
+ plan,
52
+ xbpm_feedback: XBPMFeedback,
53
+ attenuator: Attenuator,
54
+ desired_transmission_fraction: float,
55
+ ):
56
+ """Sets the transmission for the data collection, ensuring the xbpm feedback is valid
57
+ this wrapper should be run around every data collection or movement that may disrupt
58
+ the XBPM feedback.
59
+
60
+ XBPM feedback isn't reliable during collections due to:
61
+ * Objects (e.g. attenuator) crossing the beam can cause large (incorrect) feedback movements
62
+ * Lower transmissions/higher energies are less reliable for the xbpm
63
+
64
+ So we need to keep the transmission at 100% and the feedback on when not collecting
65
+ and then turn it off and set the correct transmission for collection. The feedback
66
+ mostly accounts for slow thermal drift so it is safe to assume that the beam is
67
+ stable during a collection.
68
+
69
+ Args:
70
+ plan: The plan performing the data collection
71
+ xbpm_feedback (XBPMFeedback): The XBPM device that is responsible for keeping
72
+ the beam in position
73
+ attenuator (Attenuator): The attenuator used to set transmission
74
+ desired_transmission_fraction (float): The desired transmission for the collection
75
+ """
76
+
77
+ def _inner_plan():
78
+ yield from _check_and_pause_feedback(
79
+ xbpm_feedback, attenuator, desired_transmission_fraction
80
+ )
81
+ return (yield from plan)
82
+
83
+ return (
84
+ yield from finalize_wrapper(
85
+ _inner_plan(),
86
+ _unpause_xbpm_feedback_and_set_transmission_to_1(xbpm_feedback, attenuator),
87
+ )
88
+ )
89
+
90
+
91
+ transmission_and_xbpm_feedback_for_collection_decorator = make_decorator(
92
+ transmission_and_xbpm_feedback_for_collection_wrapper
93
+ )
@@ -0,0 +1,47 @@
1
+ from collections.abc import Callable, Generator
2
+ from typing import TypeVar
3
+
4
+ from bluesky.plan_stubs import null
5
+ from bluesky.preprocessors import contingency_wrapper
6
+ from bluesky.utils import Msg
7
+
8
+
9
+ class WarningException(Exception):
10
+ """An exception used when we want to warn GDA of a
11
+ problem but continue with UDC anyway"""
12
+
13
+ pass
14
+
15
+
16
+ T = TypeVar("T")
17
+
18
+
19
+ def catch_exception_and_warn(
20
+ exception_to_catch: type[Exception],
21
+ func: Callable[..., Generator[Msg, None, T]],
22
+ *args,
23
+ **kwargs,
24
+ ) -> Generator[Msg, None, T]:
25
+ """A plan wrapper to catch a specific exception and instead raise a WarningException,
26
+ so that UDC is not halted
27
+
28
+ Example usage:
29
+
30
+ 'def plan_which_can_raise_exception_a(*args, **kwargs):
31
+ ...
32
+ yield from catch_exception_and_warn(ExceptionA, plan_which_can_raise_exception_a, **args, **kwargs)'
33
+
34
+ This will catch ExceptionA raised by the plan and instead raise a WarningException
35
+ """
36
+
37
+ def warn_if_exception_matches(exception: Exception):
38
+ if isinstance(exception, exception_to_catch):
39
+ raise WarningException(str(exception))
40
+ yield from null()
41
+
42
+ return (
43
+ yield from contingency_wrapper(
44
+ func(*args, **kwargs),
45
+ except_plan=warn_if_exception_matches,
46
+ )
47
+ )
@@ -0,0 +1,30 @@
1
+ """This module contains the experimental plans which hyperion can run.
2
+
3
+ The __all__ list in here are the plans that are externally available from outside Hyperion.
4
+ """
5
+
6
+ from mx_bluesky.hyperion.experiment_plans.flyscan_xray_centre_plan import (
7
+ flyscan_xray_centre,
8
+ )
9
+ from mx_bluesky.hyperion.experiment_plans.grid_detect_then_xray_centre_plan import (
10
+ grid_detect_then_xray_centre,
11
+ )
12
+ from mx_bluesky.hyperion.experiment_plans.pin_centre_then_xray_centre_plan import (
13
+ pin_tip_centre_then_xray_centre,
14
+ )
15
+ from mx_bluesky.hyperion.experiment_plans.robot_load_then_centre_plan import (
16
+ robot_load_then_centre,
17
+ )
18
+ from mx_bluesky.hyperion.experiment_plans.rotation_scan_plan import (
19
+ multi_rotation_scan,
20
+ rotation_scan,
21
+ )
22
+
23
+ __all__ = [
24
+ "flyscan_xray_centre",
25
+ "grid_detect_then_xray_centre",
26
+ "rotation_scan",
27
+ "pin_tip_centre_then_xray_centre",
28
+ "multi_rotation_scan",
29
+ "robot_load_then_centre",
30
+ ]
@@ -0,0 +1,84 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Callable
4
+ from typing import TypedDict
5
+
6
+ import mx_bluesky.hyperion.experiment_plans.flyscan_xray_centre_plan as flyscan_xray_centre_plan
7
+ import mx_bluesky.hyperion.experiment_plans.rotation_scan_plan as rotation_scan_plan
8
+ from mx_bluesky.hyperion.experiment_plans import (
9
+ grid_detect_then_xray_centre_plan,
10
+ pin_centre_then_xray_centre_plan,
11
+ robot_load_then_centre_plan,
12
+ )
13
+ from mx_bluesky.hyperion.external_interaction.callbacks.common.callback_util import (
14
+ CallbacksFactory,
15
+ create_gridscan_callbacks,
16
+ create_robot_load_and_centre_callbacks,
17
+ create_rotation_callbacks,
18
+ )
19
+ from mx_bluesky.hyperion.parameters.gridscan import (
20
+ GridScanWithEdgeDetect,
21
+ PinTipCentreThenXrayCentre,
22
+ RobotLoadThenCentre,
23
+ ThreeDGridScan,
24
+ )
25
+ from mx_bluesky.hyperion.parameters.rotation import MultiRotationScan, RotationScan
26
+
27
+
28
+ def not_implemented():
29
+ raise NotImplementedError
30
+
31
+
32
+ def do_nothing():
33
+ pass
34
+
35
+
36
+ class ExperimentRegistryEntry(TypedDict):
37
+ setup: Callable
38
+ param_type: type[
39
+ ThreeDGridScan
40
+ | GridScanWithEdgeDetect
41
+ | RotationScan
42
+ | MultiRotationScan
43
+ | PinTipCentreThenXrayCentre
44
+ | RobotLoadThenCentre
45
+ ]
46
+ callbacks_factory: CallbacksFactory
47
+
48
+
49
+ PLAN_REGISTRY: dict[str, ExperimentRegistryEntry] = {
50
+ "flyscan_xray_centre": {
51
+ "setup": flyscan_xray_centre_plan.create_devices,
52
+ "param_type": ThreeDGridScan,
53
+ "callbacks_factory": create_gridscan_callbacks,
54
+ },
55
+ "grid_detect_then_xray_centre": {
56
+ "setup": grid_detect_then_xray_centre_plan.create_devices,
57
+ "param_type": GridScanWithEdgeDetect,
58
+ "callbacks_factory": create_gridscan_callbacks,
59
+ },
60
+ "rotation_scan": {
61
+ "setup": rotation_scan_plan.create_devices,
62
+ "param_type": RotationScan,
63
+ "callbacks_factory": create_rotation_callbacks,
64
+ },
65
+ "pin_tip_centre_then_xray_centre": {
66
+ "setup": pin_centre_then_xray_centre_plan.create_devices,
67
+ "param_type": PinTipCentreThenXrayCentre,
68
+ "callbacks_factory": create_gridscan_callbacks,
69
+ },
70
+ "robot_load_then_centre": {
71
+ "setup": robot_load_then_centre_plan.create_devices,
72
+ "param_type": RobotLoadThenCentre,
73
+ "callbacks_factory": create_robot_load_and_centre_callbacks,
74
+ },
75
+ "multi_rotation_scan": {
76
+ "setup": rotation_scan_plan.create_devices,
77
+ "param_type": MultiRotationScan,
78
+ "callbacks_factory": create_rotation_callbacks,
79
+ },
80
+ }
81
+
82
+
83
+ class PlanNotFound(Exception):
84
+ pass