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.
- mx_bluesky/_version.py +2 -2
- mx_bluesky/beamlines/aithre_lasershaping/goniometer_controls.py +2 -2
- mx_bluesky/beamlines/i02_1/parameters/gridscan.py +1 -1
- mx_bluesky/beamlines/i04/experiment_plans/i04_grid_detect_then_xray_centre_plan.py +9 -9
- mx_bluesky/beamlines/i04/thawing_plan.py +9 -9
- mx_bluesky/beamlines/i24/jungfrau_commissioning/experiment_plans/do_darks.py +123 -0
- mx_bluesky/beamlines/i24/jungfrau_commissioning/plan_stubs/__init__.py +1 -0
- mx_bluesky/beamlines/i24/jungfrau_commissioning/{do_external_acquisition.py → plan_stubs/do_external_acquisition.py} +8 -7
- mx_bluesky/beamlines/i24/jungfrau_commissioning/{do_internal_acquisition.py → plan_stubs/do_internal_acquisition.py} +4 -3
- mx_bluesky/beamlines/i24/jungfrau_commissioning/{plan_utils.py → plan_stubs/plan_utils.py} +21 -28
- mx_bluesky/beamlines/i24/serial/__init__.py +7 -5
- mx_bluesky/beamlines/i24/serial/dcid.py +3 -3
- mx_bluesky/beamlines/i24/serial/extruder/{i24ssx_Extruder_Collect_py3v2.py → i24ssx_extruder_collect_py3v2.py} +65 -35
- mx_bluesky/beamlines/i24/serial/fixed_target/{i24ssx_Chip_Collect_py3v1.py → i24ssx_chip_collect_py3v1.py} +5 -5
- mx_bluesky/beamlines/i24/serial/fixed_target/{i24ssx_Chip_Manager_py3v1.py → i24ssx_chip_manager_py3v1.py} +46 -46
- mx_bluesky/beamlines/i24/serial/fixed_target/{i24ssx_Chip_StartUp_py3v1.py → i24ssx_chip_startup_py3v1.py} +3 -3
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py +33 -33
- mx_bluesky/beamlines/i24/serial/log.py +11 -11
- mx_bluesky/beamlines/i24/serial/parameters/fixed_target/cs/cs_maker.json +3 -3
- mx_bluesky/beamlines/i24/serial/setup_beamline/ca.py +0 -12
- mx_bluesky/beamlines/i24/serial/setup_beamline/pv.py +13 -32
- mx_bluesky/beamlines/i24/serial/setup_beamline/pv_abstract.py +5 -5
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +22 -249
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +2 -2
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +4 -4
- mx_bluesky/beamlines/i24/serial/web_gui_plans/general_plans.py +102 -15
- mx_bluesky/beamlines/i24/serial/write_nexus.py +4 -4
- mx_bluesky/common/device_setup_plans/robot_load_unload.py +2 -2
- mx_bluesky/common/device_setup_plans/setup_oav.py +1 -1
- mx_bluesky/common/device_setup_plans/xbpm_feedback.py +4 -4
- mx_bluesky/common/experiment_plans/common_flyscan_xray_centre_plan.py +9 -9
- mx_bluesky/common/experiment_plans/common_grid_detect_then_xray_centre_plan.py +2 -2
- mx_bluesky/common/experiment_plans/inner_plans/do_fgs.py +2 -2
- mx_bluesky/common/experiment_plans/inner_plans/read_hardware.py +5 -5
- mx_bluesky/common/experiment_plans/inner_plans/udc_default_state.py +22 -1
- mx_bluesky/common/experiment_plans/inner_plans/write_sample_status.py +2 -2
- mx_bluesky/common/experiment_plans/oav_grid_detection_plan.py +2 -2
- mx_bluesky/common/experiment_plans/oav_snapshot_plan.py +1 -1
- mx_bluesky/common/external_interaction/callbacks/common/ispyb_callback_base.py +3 -3
- mx_bluesky/common/external_interaction/callbacks/common/plan_reactive_callback.py +1 -1
- mx_bluesky/common/external_interaction/callbacks/common/zocalo_callback.py +2 -2
- mx_bluesky/common/external_interaction/callbacks/sample_handling/sample_handling_callback.py +3 -3
- mx_bluesky/common/external_interaction/callbacks/xray_centre/ispyb_callback.py +7 -5
- mx_bluesky/common/external_interaction/callbacks/xray_centre/nexus_callback.py +2 -2
- mx_bluesky/common/external_interaction/config_server.py +2 -2
- mx_bluesky/common/external_interaction/ispyb/exp_eye_store.py +4 -2
- mx_bluesky/common/external_interaction/ispyb/ispyb_store.py +0 -1
- mx_bluesky/common/external_interaction/nexus/nexus_utils.py +2 -2
- mx_bluesky/common/external_interaction/nexus/write_nexus.py +3 -3
- mx_bluesky/common/parameters/constants.py +1 -1
- mx_bluesky/common/parameters/device_composites.py +2 -2
- mx_bluesky/common/parameters/gridscan.py +2 -2
- mx_bluesky/common/utils/exceptions.py +9 -7
- mx_bluesky/common/utils/log.py +4 -4
- mx_bluesky/common/utils/tracing.py +5 -5
- mx_bluesky/common/utils/utils.py +8 -8
- mx_bluesky/hyperion/__main__.py +5 -5
- mx_bluesky/hyperion/baton_handler.py +15 -8
- mx_bluesky/hyperion/device_setup_plans/smargon.py +5 -5
- mx_bluesky/hyperion/device_setup_plans/utils.py +1 -1
- mx_bluesky/hyperion/experiment_plans/experiment_registry.py +1 -1
- mx_bluesky/hyperion/experiment_plans/hyperion_flyscan_xray_centre_plan.py +19 -18
- mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +54 -40
- mx_bluesky/hyperion/experiment_plans/optimise_attenuation_plan.py +9 -9
- mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +2 -2
- mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +5 -5
- mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +3 -3
- mx_bluesky/hyperion/external_interaction/agamemnon.py +2 -2
- mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +2 -2
- mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_callback.py +1 -1
- mx_bluesky/hyperion/external_interaction/callbacks/rotation/nexus_callback.py +2 -2
- mx_bluesky/hyperion/external_interaction/config_server.py +2 -2
- mx_bluesky/hyperion/parameters/constants.py +2 -2
- mx_bluesky/hyperion/parameters/device_composites.py +2 -2
- mx_bluesky/hyperion/parameters/gridscan.py +4 -4
- mx_bluesky/hyperion/parameters/rotation.py +4 -6
- mx_bluesky/hyperion/plan_runner.py +6 -6
- mx_bluesky/hyperion/runner.py +10 -8
- mx_bluesky/hyperion/utils/context.py +6 -1
- mx_bluesky/jupyter_example.ipynb +3 -3
- {mx_bluesky-1.5.9.dist-info → mx_bluesky-1.5.11.dist-info}/METADATA +7 -6
- {mx_bluesky-1.5.9.dist-info → mx_bluesky-1.5.11.dist-info}/RECORD +87 -85
- /mx_bluesky/beamlines/i24/jungfrau_commissioning/{__init__.py → experiment_plans/__init__.py} +0 -0
- {mx_bluesky-1.5.9.dist-info → mx_bluesky-1.5.11.dist-info}/WHEEL +0 -0
- {mx_bluesky-1.5.9.dist-info → mx_bluesky-1.5.11.dist-info}/entry_points.txt +0 -0
- {mx_bluesky-1.5.9.dist-info → mx_bluesky-1.5.11.dist-info}/licenses/LICENSE +0 -0
- {mx_bluesky-1.5.9.dist-info → mx_bluesky-1.5.11.dist-info}/top_level.txt +0 -0
|
@@ -19,7 +19,7 @@ from mx_bluesky.common.experiment_plans.common_grid_detect_then_xray_centre_plan
|
|
|
19
19
|
detect_grid_and_do_gridscan,
|
|
20
20
|
)
|
|
21
21
|
from mx_bluesky.common.experiment_plans.oav_snapshot_plan import (
|
|
22
|
-
|
|
22
|
+
setup_beamline_for_oav,
|
|
23
23
|
)
|
|
24
24
|
from mx_bluesky.common.external_interaction.callbacks.xray_centre.ispyb_callback import (
|
|
25
25
|
ispyb_activation_wrapper,
|
|
@@ -84,7 +84,7 @@ def pin_centre_then_flyscan_plan(
|
|
|
84
84
|
)
|
|
85
85
|
|
|
86
86
|
def _pin_centre_then_flyscan_plan():
|
|
87
|
-
yield from
|
|
87
|
+
yield from setup_beamline_for_oav(
|
|
88
88
|
composite.smargon, composite.backlight, composite.aperture_scatterguard
|
|
89
89
|
)
|
|
90
90
|
|
|
@@ -9,7 +9,7 @@ from dodal.devices.oav.oav_detector import OAV
|
|
|
9
9
|
from dodal.devices.oav.oav_parameters import OAV_CONFIG_JSON, OAVParameters
|
|
10
10
|
from dodal.devices.oav.pin_image_recognition import PinTipDetection, Tip
|
|
11
11
|
from dodal.devices.oav.utils import (
|
|
12
|
-
|
|
12
|
+
PinNotFoundError,
|
|
13
13
|
Pixel,
|
|
14
14
|
get_move_required_so_that_beam_is_at_pixel,
|
|
15
15
|
wait_for_tip_to_be_found,
|
|
@@ -18,7 +18,7 @@ from dodal.devices.smargon import Smargon
|
|
|
18
18
|
|
|
19
19
|
from mx_bluesky.common.device_setup_plans.setup_oav import pre_centring_setup_oav
|
|
20
20
|
from mx_bluesky.common.utils.context import device_composite_from_context
|
|
21
|
-
from mx_bluesky.common.utils.exceptions import
|
|
21
|
+
from mx_bluesky.common.utils.exceptions import SampleError, catch_exception_and_warn
|
|
22
22
|
from mx_bluesky.common.utils.log import LOGGER
|
|
23
23
|
from mx_bluesky.hyperion.device_setup_plans.smargon import (
|
|
24
24
|
move_smargon_warn_on_out_of_range,
|
|
@@ -69,7 +69,7 @@ def move_pin_into_view(
|
|
|
69
69
|
max_steps (int, optional): The number of steps to search with. Defaults to 2.
|
|
70
70
|
|
|
71
71
|
Raises:
|
|
72
|
-
|
|
72
|
+
SampleError: Error if the pin tip is never found
|
|
73
73
|
|
|
74
74
|
Returns:
|
|
75
75
|
Tuple[int, int]: The location of the pin tip in pixels
|
|
@@ -106,7 +106,7 @@ def move_pin_into_view(
|
|
|
106
106
|
tip_xy_px = yield from trigger_and_return_pin_tip(pin_tip_device)
|
|
107
107
|
|
|
108
108
|
if not pin_tip_valid(tip_xy_px):
|
|
109
|
-
raise
|
|
109
|
+
raise SampleError(
|
|
110
110
|
"Pin tip centring failed - pin too long/short/bent and out of range"
|
|
111
111
|
)
|
|
112
112
|
else:
|
|
@@ -161,6 +161,6 @@ def pin_tip_centre_plan(
|
|
|
161
161
|
# See #673 for improvements
|
|
162
162
|
yield from bps.sleep(0.3)
|
|
163
163
|
tip = yield from catch_exception_and_warn(
|
|
164
|
-
|
|
164
|
+
PinNotFoundError, wait_for_tip_to_be_found, pin_tip_detect
|
|
165
165
|
)
|
|
166
166
|
yield from offset_and_move(tip)
|
|
@@ -49,7 +49,7 @@ from mx_bluesky.common.experiment_plans.inner_plans.read_hardware import (
|
|
|
49
49
|
from mx_bluesky.common.experiment_plans.oav_snapshot_plan import (
|
|
50
50
|
OavSnapshotComposite,
|
|
51
51
|
oav_snapshot_plan,
|
|
52
|
-
|
|
52
|
+
setup_beamline_for_oav,
|
|
53
53
|
)
|
|
54
54
|
from mx_bluesky.common.parameters.components import WithSnapshot
|
|
55
55
|
from mx_bluesky.common.preprocessors.preprocessors import (
|
|
@@ -346,7 +346,7 @@ def _move_and_rotation(
|
|
|
346
346
|
yield from bps.wait(CONST.WAIT.MOVE_GONIO_TO_START)
|
|
347
347
|
|
|
348
348
|
if not params.use_grid_snapshots:
|
|
349
|
-
yield from
|
|
349
|
+
yield from setup_beamline_for_oav(
|
|
350
350
|
composite.smargon,
|
|
351
351
|
composite.backlight,
|
|
352
352
|
composite.aperture_scatterguard,
|
|
@@ -428,7 +428,7 @@ def rotation_scan_internal(
|
|
|
428
428
|
|
|
429
429
|
yield from rotation_scan_core(single_scan)
|
|
430
430
|
|
|
431
|
-
yield from bps.unstage(eiger)
|
|
431
|
+
yield from bps.unstage(eiger, wait=True)
|
|
432
432
|
|
|
433
433
|
LOGGER.info("setting up and staging eiger...")
|
|
434
434
|
yield from start_preparing_data_collection_then_do_plan(
|
|
@@ -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
|
|
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
|
|
|
@@ -222,7 +222,7 @@ def _get_withenergy_parameters_from_agamemnon(parameters: dict) -> dict[str, Any
|
|
|
222
222
|
first_collection: dict = parameters["collection"][0]
|
|
223
223
|
wavelength = first_collection.get("wavelength")
|
|
224
224
|
assert isinstance(wavelength, float)
|
|
225
|
-
demand_energy_ev =
|
|
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
|
|
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
|
-
|
|
127
|
+
DODAL_LOGGER.parent = ISPYB_ZOCALO_CALLBACK_LOGGER
|
|
128
128
|
log_debug("nexgen logger added to nexus logger")
|
|
129
129
|
|
|
130
130
|
|
|
@@ -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
|
-
|
|
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
|
|
@@ -29,7 +29,7 @@ class RotationNexusFileCallback(PlanReactiveCallback):
|
|
|
29
29
|
To use, subscribe the Bluesky RunEngine to an instance of this class.
|
|
30
30
|
E.g.:
|
|
31
31
|
nexus_file_handler_callback = NexusFileCallback(parameters)
|
|
32
|
-
|
|
32
|
+
run_engine.subscribe(nexus_file_handler_callback)
|
|
33
33
|
Or decorate a plan using bluesky.preprocessors.subs_decorator.
|
|
34
34
|
|
|
35
35
|
See: https://blueskyproject.io/bluesky/callbacks.html#ways-to-invoke-callbacks
|
|
@@ -65,7 +65,7 @@ class RotationNexusFileCallback(PlanReactiveCallback):
|
|
|
65
65
|
self.writer.beam,
|
|
66
66
|
self.writer.attenuator,
|
|
67
67
|
) = create_beam_and_attenuator_parameters(
|
|
68
|
-
data["dcm-
|
|
68
|
+
data["dcm-energy_in_keV"],
|
|
69
69
|
data["flux-flux_reading"],
|
|
70
70
|
data["attenuator-actual_transmission"],
|
|
71
71
|
)
|
|
@@ -3,14 +3,14 @@ from functools import cache
|
|
|
3
3
|
from mx_bluesky.common.external_interaction.config_server import MXConfigClient
|
|
4
4
|
from mx_bluesky.hyperion.parameters.constants import (
|
|
5
5
|
HyperionFeatureSetting,
|
|
6
|
-
|
|
6
|
+
HyperionFeatureSettingSources,
|
|
7
7
|
)
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
@cache
|
|
11
11
|
def get_hyperion_config_client() -> MXConfigClient[HyperionFeatureSetting]:
|
|
12
12
|
return MXConfigClient(
|
|
13
|
-
feature_sources=
|
|
13
|
+
feature_sources=HyperionFeatureSettingSources,
|
|
14
14
|
feature_dc=HyperionFeatureSetting,
|
|
15
15
|
url="https://daq-config.diamond.ac.uk",
|
|
16
16
|
)
|
|
@@ -9,7 +9,7 @@ from mx_bluesky.common.parameters.constants import (
|
|
|
9
9
|
EnvironmentConstants,
|
|
10
10
|
ExperimentParamConstants,
|
|
11
11
|
FeatureSetting,
|
|
12
|
-
|
|
12
|
+
FeatureSettingSources,
|
|
13
13
|
HardwareConstants,
|
|
14
14
|
OavConstants,
|
|
15
15
|
PlanGroupCheckpointConstants,
|
|
@@ -32,7 +32,7 @@ class I03Constants:
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
# These currently exist in GDA domain.properties
|
|
35
|
-
class
|
|
35
|
+
class HyperionFeatureSettingSources(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"
|
|
@@ -6,7 +6,7 @@ from dodal.devices.aperturescatterguard import (
|
|
|
6
6
|
)
|
|
7
7
|
from dodal.devices.attenuator.attenuator import BinaryFilterAttenuator
|
|
8
8
|
from dodal.devices.backlight import Backlight
|
|
9
|
-
from dodal.devices.common_dcm import
|
|
9
|
+
from dodal.devices.common_dcm import DoubleCrystalMonochromatorWithDSpacing
|
|
10
10
|
from dodal.devices.eiger import EigerDetector
|
|
11
11
|
from dodal.devices.fast_grid_scan import (
|
|
12
12
|
PandAFastGridScan,
|
|
@@ -37,7 +37,7 @@ class HyperionFlyScanXRayCentreComposite(FlyScanEssentialDevices):
|
|
|
37
37
|
|
|
38
38
|
aperture_scatterguard: ApertureScatterguard
|
|
39
39
|
attenuator: BinaryFilterAttenuator
|
|
40
|
-
dcm:
|
|
40
|
+
dcm: DoubleCrystalMonochromatorWithDSpacing
|
|
41
41
|
eiger: EigerDetector
|
|
42
42
|
flux: Flux
|
|
43
43
|
s4_slit_gaps: S4SlitGaps
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
96
|
+
class OddYStepsError(Exception): ...
|
|
97
97
|
|
|
98
98
|
|
|
99
99
|
class PinTipCentreThenXrayCentre(GridCommonWithHyperionDetectorParams):
|
|
@@ -150,14 +150,12 @@ class RotationScan(RotationExperiment, SplitScan):
|
|
|
150
150
|
return rotation_scan
|
|
151
151
|
|
|
152
152
|
@model_validator(mode="after")
|
|
153
|
-
|
|
154
|
-
def correct_start_vds(cls, values: Any) -> Any:
|
|
155
|
-
assert isinstance(values, RotationScan)
|
|
153
|
+
def correct_start_vds(self) -> Any:
|
|
156
154
|
start_img = 0.0
|
|
157
|
-
for scan in
|
|
155
|
+
for scan in self.rotation_scans:
|
|
158
156
|
scan.nexus_vds_start_img = int(start_img)
|
|
159
|
-
start_img += scan.scan_width_deg /
|
|
160
|
-
return
|
|
157
|
+
start_img += scan.scan_width_deg / self.rotation_increment_deg
|
|
158
|
+
return self
|
|
161
159
|
|
|
162
160
|
@model_validator(mode="after")
|
|
163
161
|
def _check_valid_for_single_arm_multiple_sweep(self) -> Self:
|
|
@@ -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
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
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.
|
|
64
|
+
self.run_engine.abort()
|
|
65
65
|
except Exception as e:
|
|
66
66
|
LOGGER.warning(
|
|
67
67
|
"Exception encountered when issuing abort() to RunEngine:",
|
mx_bluesky/hyperion/runner.py
CHANGED
|
@@ -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
|
|
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.
|
|
69
|
-
# These references are necessary to maintain liveness of callbacks because
|
|
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.
|
|
74
|
+
self.run_engine.subscribe(self._logging_uid_tag_callback)
|
|
75
75
|
LOGGER.info("Connecting to external callback ZMQ proxy...")
|
|
76
|
-
self.
|
|
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.
|
|
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.
|
|
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
|
|
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:
|
|
@@ -27,7 +27,12 @@ def clear_all_device_caches(context: BlueskyContext):
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
def setup_devices(context: BlueskyContext, dev_mode: bool):
|
|
30
|
-
context.with_dodal_module(
|
|
30
|
+
_, exceptions = context.with_dodal_module(
|
|
31
31
|
get_beamline_based_on_environment_variable(),
|
|
32
32
|
mock=dev_mode,
|
|
33
33
|
)
|
|
34
|
+
if exceptions:
|
|
35
|
+
raise ExceptionGroup(
|
|
36
|
+
f"Unable to connect to beamline devices {list(exceptions.keys())}",
|
|
37
|
+
list(exceptions.values()),
|
|
38
|
+
)
|
mx_bluesky/jupyter_example.ipynb
CHANGED
|
@@ -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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
49
|
+
"run_engine(scan(dets, motor, -1, 1, 10))"
|
|
50
50
|
]
|
|
51
51
|
}
|
|
52
52
|
],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mx-bluesky
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.11
|
|
4
4
|
Summary: Bluesky tools for MX Beamlines at DLS
|
|
5
5
|
Author-email: Dominic Oram <dominic.oram@diamond.ac.uk>
|
|
6
6
|
License: Apache License
|
|
@@ -210,6 +210,7 @@ Classifier: Development Status :: 3 - Alpha
|
|
|
210
210
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
211
211
|
Classifier: Programming Language :: Python :: 3.11
|
|
212
212
|
Classifier: Programming Language :: Python :: 3.12
|
|
213
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
213
214
|
Requires-Python: >=3.11
|
|
214
215
|
Description-Content-Type: text/x-rst
|
|
215
216
|
License-File: LICENSE
|
|
@@ -237,11 +238,11 @@ Requires-Dist: deepdiff
|
|
|
237
238
|
Requires-Dist: matplotlib
|
|
238
239
|
Requires-Dist: cachetools
|
|
239
240
|
Requires-Dist: daq-config-server>=v1.0.0-rc.2
|
|
240
|
-
Requires-Dist: blueapi>=
|
|
241
|
+
Requires-Dist: blueapi>=1.6.3
|
|
241
242
|
Requires-Dist: ophyd>=1.10.5
|
|
242
|
-
Requires-Dist: ophyd-async>=0.
|
|
243
|
-
Requires-Dist: bluesky>=1.
|
|
244
|
-
Requires-Dist: dls-dodal==1.
|
|
243
|
+
Requires-Dist: ophyd-async>=0.13.5
|
|
244
|
+
Requires-Dist: bluesky>=1.14.6
|
|
245
|
+
Requires-Dist: dls-dodal==1.65.0
|
|
245
246
|
Provides-Extra: dev
|
|
246
247
|
Requires-Dist: black; extra == "dev"
|
|
247
248
|
Requires-Dist: build; extra == "dev"
|
|
@@ -255,7 +256,7 @@ Requires-Dist: pipdeptree; extra == "dev"
|
|
|
255
256
|
Requires-Dist: plantweb; extra == "dev"
|
|
256
257
|
Requires-Dist: pre-commit; extra == "dev"
|
|
257
258
|
Requires-Dist: pydata-sphinx-theme>=0.12; extra == "dev"
|
|
258
|
-
Requires-Dist: pyright; extra == "dev"
|
|
259
|
+
Requires-Dist: pyright==1.1.406; extra == "dev"
|
|
259
260
|
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
260
261
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
261
262
|
Requires-Dist: pytest-random-order; extra == "dev"
|