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
|
@@ -37,7 +37,7 @@ def call_nexgen(
|
|
|
37
37
|
Raises:
|
|
38
38
|
ValueError: For a wrong experiment type passed (either unknown or not matched \
|
|
39
39
|
to parameter model).
|
|
40
|
-
HTTPError: For a problem with
|
|
40
|
+
HTTPError: For a problem with response from server
|
|
41
41
|
|
|
42
42
|
"""
|
|
43
43
|
current_chip_map = None
|
|
@@ -55,7 +55,7 @@ def call_nexgen(
|
|
|
55
55
|
total_numb_imgs = parameters.num_images
|
|
56
56
|
pump_status = parameters.pump_status
|
|
57
57
|
|
|
58
|
-
filename_prefix = cagetstring(Eiger.
|
|
58
|
+
filename_prefix = cagetstring(Eiger.PV.filename_rbv)
|
|
59
59
|
meta_h5 = parameters.visit / parameters.directory / f"{filename_prefix}_meta.h5"
|
|
60
60
|
t0 = time.time()
|
|
61
61
|
max_wait = 60 # seconds
|
|
@@ -71,7 +71,7 @@ def call_nexgen(
|
|
|
71
71
|
SSX_LOGGER.warning(f"Giving up waiting for {meta_h5} after {max_wait} seconds")
|
|
72
72
|
return
|
|
73
73
|
|
|
74
|
-
bit_depth = int(caget(Eiger.
|
|
74
|
+
bit_depth = int(caget(Eiger.PV.bit_depth))
|
|
75
75
|
SSX_LOGGER.debug(
|
|
76
76
|
f"Call to nexgen server with the following chip definition: \n{chip_prog_dict}"
|
|
77
77
|
)
|
|
@@ -109,7 +109,7 @@ def submit_to_server(
|
|
|
109
109
|
Raises:
|
|
110
110
|
ValueError: For a wrong experiment type passed (either unknown or not matched \
|
|
111
111
|
to parameter model).
|
|
112
|
-
HTTPError: For a problem with
|
|
112
|
+
HTTPError: For a problem with response from server
|
|
113
113
|
|
|
114
114
|
"""
|
|
115
115
|
access_token = pathlib.Path("/scratch/ssx_nexgen.key").read_text().strip()
|
|
@@ -7,7 +7,7 @@ from dodal.devices.aperturescatterguard import ApertureScatterguard, ApertureVal
|
|
|
7
7
|
from dodal.devices.motors import XYZStage
|
|
8
8
|
from dodal.devices.robot import BartRobot
|
|
9
9
|
from dodal.devices.smargon import CombinedMove, Smargon, StubPosition
|
|
10
|
-
from dodal.plan_stubs.motor_utils import
|
|
10
|
+
from dodal.plan_stubs.motor_utils import MoveTooLargeError, home_and_reset_wrapper
|
|
11
11
|
|
|
12
12
|
from mx_bluesky.common.parameters.constants import (
|
|
13
13
|
DocDescriptorNames,
|
|
@@ -39,7 +39,7 @@ def wait_for_smargon_not_disabled(smargon: Smargon, timeout=60):
|
|
|
39
39
|
|
|
40
40
|
def _raise_exception_if_moved_out_of_cryojet(exception):
|
|
41
41
|
yield from bps.null()
|
|
42
|
-
if isinstance(exception,
|
|
42
|
+
if isinstance(exception, MoveTooLargeError):
|
|
43
43
|
raise Exception(
|
|
44
44
|
f"Moving {exception.axis} back to {exception.position} after \
|
|
45
45
|
robot load would move it out of the cryojet. The max safe \
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from functools import partial
|
|
2
2
|
|
|
3
3
|
import bluesky.plan_stubs as bps
|
|
4
|
-
from dodal.devices.areadetector.plugins.
|
|
4
|
+
from dodal.devices.areadetector.plugins.cam import ColorMode
|
|
5
5
|
from dodal.devices.oav.oav_detector import OAV
|
|
6
6
|
from dodal.devices.oav.oav_parameters import OAVParameters
|
|
7
7
|
from dodal.devices.oav.pin_image_recognition import PinTipDetection
|
|
@@ -16,7 +16,7 @@ def unpause_xbpm_feedback_and_set_transmission_to_1(
|
|
|
16
16
|
the beam in position
|
|
17
17
|
attenuator (BinaryFilterAttenuator): The attenuator used to set transmission
|
|
18
18
|
"""
|
|
19
|
-
yield from bps.mv(xbpm_feedback.pause_feedback, Pause.RUN, attenuator, 1.0)
|
|
19
|
+
yield from bps.mv(xbpm_feedback.pause_feedback, Pause.RUN, attenuator, 1.0)
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
def check_and_pause_feedback(
|
|
@@ -35,11 +35,11 @@ def check_and_pause_feedback(
|
|
|
35
35
|
turning XBPM feedback off.
|
|
36
36
|
|
|
37
37
|
"""
|
|
38
|
-
yield from bps.mv(attenuator, 1.0)
|
|
38
|
+
yield from bps.mv(attenuator, 1.0)
|
|
39
39
|
LOGGER.info("Waiting for XBPM feedback to be stable")
|
|
40
40
|
yield from bps.trigger(xbpm_feedback, wait=True)
|
|
41
41
|
LOGGER.info(
|
|
42
42
|
f"XPBM feedback in position, pausing and setting transmission to {desired_transmission_fraction}"
|
|
43
43
|
)
|
|
44
|
-
yield from bps.mv(xbpm_feedback.pause_feedback, Pause.PAUSE)
|
|
45
|
-
yield from bps.mv(attenuator, desired_transmission_fraction)
|
|
44
|
+
yield from bps.mv(xbpm_feedback.pause_feedback, Pause.PAUSE)
|
|
45
|
+
yield from bps.mv(attenuator, desired_transmission_fraction)
|
|
@@ -13,7 +13,7 @@ from dodal.common.beamlines.commissioning_mode import read_commissioning_mode
|
|
|
13
13
|
from dodal.devices.fast_grid_scan import (
|
|
14
14
|
FastGridScanCommon,
|
|
15
15
|
FastGridScanThreeD,
|
|
16
|
-
|
|
16
|
+
GridScanInvalidError,
|
|
17
17
|
)
|
|
18
18
|
from dodal.devices.zocalo import ZocaloResults
|
|
19
19
|
from dodal.devices.zocalo.zocalo_results import (
|
|
@@ -37,8 +37,8 @@ from mx_bluesky.common.parameters.constants import (
|
|
|
37
37
|
from mx_bluesky.common.parameters.device_composites import FlyScanEssentialDevices
|
|
38
38
|
from mx_bluesky.common.parameters.gridscan import SpecifiedThreeDGridScan
|
|
39
39
|
from mx_bluesky.common.utils.exceptions import (
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
CrystalNotFoundError,
|
|
41
|
+
SampleError,
|
|
42
42
|
)
|
|
43
43
|
from mx_bluesky.common.utils.log import LOGGER
|
|
44
44
|
from mx_bluesky.common.utils.tracing import TRACER
|
|
@@ -77,7 +77,7 @@ def generic_tidy(xrc_composite: FlyScanEssentialDevices, wait=True) -> MsgGenera
|
|
|
77
77
|
yield from bps.wait(group)
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
def
|
|
80
|
+
def construct_beamline_specific_fast_gridscan_features(
|
|
81
81
|
setup_trigger_plan: Callable[..., MsgGenerator],
|
|
82
82
|
tidy_plan: Callable[..., MsgGenerator],
|
|
83
83
|
set_flyscan_params_plan: Callable[..., MsgGenerator],
|
|
@@ -235,7 +235,7 @@ def _fetch_xrc_results_from_zocalo(
|
|
|
235
235
|
flyscan_results = [_generate_dummy_xrc_result(parameters)]
|
|
236
236
|
else:
|
|
237
237
|
LOGGER.warning("No X-ray centre received")
|
|
238
|
-
raise
|
|
238
|
+
raise CrystalNotFoundError()
|
|
239
239
|
yield from _fire_xray_centre_result_event(flyscan_results)
|
|
240
240
|
|
|
241
241
|
|
|
@@ -275,14 +275,14 @@ def run_gridscan(
|
|
|
275
275
|
try:
|
|
276
276
|
yield from beamline_specific.set_flyscan_params_plan()
|
|
277
277
|
except FailedStatus as e:
|
|
278
|
-
if isinstance(e.__cause__,
|
|
279
|
-
raise
|
|
278
|
+
if isinstance(e.__cause__, GridScanInvalidError):
|
|
279
|
+
raise SampleError(
|
|
280
280
|
"Scan invalid - gridscan not valid for detected pin position"
|
|
281
281
|
) from e
|
|
282
282
|
|
|
283
283
|
LOGGER.info("Waiting for arming to finish")
|
|
284
284
|
yield from bps.wait(PlanGroupCheckpointConstants.GRID_READY_FOR_DC)
|
|
285
|
-
yield from bps.stage(fgs_composite.eiger)
|
|
285
|
+
yield from bps.stage(fgs_composite.eiger, wait=True)
|
|
286
286
|
|
|
287
287
|
yield from kickoff_and_complete_gridscan(
|
|
288
288
|
beamline_specific.fgs_motors,
|
|
@@ -301,7 +301,7 @@ def run_gridscan(
|
|
|
301
301
|
def _xrc_result_in_boxes_to_result_in_mm(
|
|
302
302
|
xrc_result: XrcResult, parameters: SpecifiedThreeDGridScan
|
|
303
303
|
) -> XRayCentreResult:
|
|
304
|
-
fgs_params = parameters.
|
|
304
|
+
fgs_params = parameters.fast_gridscan_params
|
|
305
305
|
xray_centre = fgs_params.grid_position_to_motor_position(
|
|
306
306
|
np.array(xrc_result["centre_of_mass"])
|
|
307
307
|
)
|
|
@@ -29,7 +29,7 @@ from mx_bluesky.common.experiment_plans.oav_grid_detection_plan import (
|
|
|
29
29
|
grid_detection_plan,
|
|
30
30
|
)
|
|
31
31
|
from mx_bluesky.common.experiment_plans.oav_snapshot_plan import (
|
|
32
|
-
|
|
32
|
+
setup_beamline_for_oav,
|
|
33
33
|
)
|
|
34
34
|
from mx_bluesky.common.external_interaction.callbacks.common.grid_detection_callback import (
|
|
35
35
|
GridDetectionCallback,
|
|
@@ -123,7 +123,7 @@ def detect_grid_and_do_gridscan(
|
|
|
123
123
|
|
|
124
124
|
grid_params_callback = GridDetectionCallback()
|
|
125
125
|
|
|
126
|
-
yield from
|
|
126
|
+
yield from setup_beamline_for_oav(
|
|
127
127
|
composite.smargon,
|
|
128
128
|
composite.backlight,
|
|
129
129
|
composite.aperture_scatterguard,
|
|
@@ -46,7 +46,7 @@ def _wait_for_zocalo_to_stage_then_do_fgs(
|
|
|
46
46
|
LOGGER.info("Waiting for Zocalo device queue to have been cleared...")
|
|
47
47
|
yield from bps.wait(ZOCALO_STAGE_GROUP)
|
|
48
48
|
|
|
49
|
-
# Triggers Zocalo if
|
|
49
|
+
# Triggers Zocalo if run_engine is subscribed to ZocaloCallback
|
|
50
50
|
yield from read_hardware_for_zocalo(detector)
|
|
51
51
|
LOGGER.info("Wait for all moves with no assigned group")
|
|
52
52
|
yield from bps.wait()
|
|
@@ -103,7 +103,7 @@ def kickoff_and_complete_gridscan(
|
|
|
103
103
|
)
|
|
104
104
|
@bpp.contingency_decorator(
|
|
105
105
|
except_plan=lambda e: (yield from bps.stop(detector)), # type: ignore # Fix types in ophyd-async (https://github.com/DiamondLightSource/mx-bluesky/issues/855)
|
|
106
|
-
else_plan=lambda: (yield from bps.unstage(detector)),
|
|
106
|
+
else_plan=lambda: (yield from bps.unstage(detector, wait=True)),
|
|
107
107
|
)
|
|
108
108
|
def _decorated_do_fgs():
|
|
109
109
|
yield from _wait_for_zocalo_to_stage_then_do_fgs(
|
|
@@ -4,7 +4,7 @@ import bluesky.plan_stubs as bps
|
|
|
4
4
|
from bluesky.protocols import Readable
|
|
5
5
|
from dodal.devices.aperturescatterguard import ApertureScatterguard
|
|
6
6
|
from dodal.devices.attenuator.attenuator import BinaryFilterAttenuator
|
|
7
|
-
from dodal.devices.common_dcm import
|
|
7
|
+
from dodal.devices.common_dcm import DoubleCrystalMonochromator
|
|
8
8
|
from dodal.devices.eiger import EigerDetector
|
|
9
9
|
from dodal.devices.flux import Flux
|
|
10
10
|
from dodal.devices.s4_slit_gaps import S4SlitGaps
|
|
@@ -43,7 +43,7 @@ def standard_read_hardware_pre_collection(
|
|
|
43
43
|
undulator: Undulator,
|
|
44
44
|
synchrotron: Synchrotron,
|
|
45
45
|
s4_slit_gaps: S4SlitGaps,
|
|
46
|
-
dcm:
|
|
46
|
+
dcm: DoubleCrystalMonochromator,
|
|
47
47
|
smargon: Smargon,
|
|
48
48
|
):
|
|
49
49
|
LOGGER.info("Reading status of beamline for callbacks, pre collection.")
|
|
@@ -52,7 +52,7 @@ def standard_read_hardware_pre_collection(
|
|
|
52
52
|
synchrotron.synchrotron_mode,
|
|
53
53
|
s4_slit_gaps,
|
|
54
54
|
smargon,
|
|
55
|
-
dcm.
|
|
55
|
+
dcm.energy_in_keV,
|
|
56
56
|
]
|
|
57
57
|
yield from read_hardware_plan(
|
|
58
58
|
signals_to_read_pre_flyscan, DocDescriptorNames.HARDWARE_READ_PRE
|
|
@@ -63,14 +63,14 @@ def standard_read_hardware_during_collection(
|
|
|
63
63
|
aperture_scatterguard: ApertureScatterguard,
|
|
64
64
|
attenuator: BinaryFilterAttenuator,
|
|
65
65
|
flux: Flux,
|
|
66
|
-
dcm:
|
|
66
|
+
dcm: DoubleCrystalMonochromator,
|
|
67
67
|
detector: EigerDetector,
|
|
68
68
|
):
|
|
69
69
|
signals_to_read_during_collection = [
|
|
70
70
|
aperture_scatterguard,
|
|
71
71
|
attenuator.actual_transmission,
|
|
72
72
|
flux.flux_reading,
|
|
73
|
-
dcm.
|
|
73
|
+
dcm.energy_in_keV,
|
|
74
74
|
detector.bit_depth,
|
|
75
75
|
]
|
|
76
76
|
yield from read_hardware_plan(
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import bluesky.plan_stubs as bps
|
|
2
2
|
import pydantic
|
|
3
|
+
from bluesky.utils import MsgGenerator
|
|
3
4
|
from dodal.devices.aperturescatterguard import ApertureScatterguard, ApertureValue
|
|
4
5
|
from dodal.devices.collimation_table import CollimationTable
|
|
5
|
-
from dodal.devices.cryostream import CryoStream
|
|
6
|
+
from dodal.devices.cryostream import CryoStream, CryoStreamGantry, CryoStreamSelection
|
|
6
7
|
from dodal.devices.cryostream import InOut as CryoInOut
|
|
7
8
|
from dodal.devices.fluorescence_detector_motion import (
|
|
8
9
|
FluorescenceDetector,
|
|
9
10
|
)
|
|
10
11
|
from dodal.devices.fluorescence_detector_motion import InOut as FlouInOut
|
|
12
|
+
from dodal.devices.hutch_shutter import HutchShutter, ShutterDemand
|
|
11
13
|
from dodal.devices.mx_phase1.beamstop import Beamstop, BeamstopPositions
|
|
12
14
|
from dodal.devices.scintillator import InOut as ScinInOut
|
|
13
15
|
from dodal.devices.scintillator import Scintillator
|
|
@@ -16,15 +18,18 @@ from dodal.devices.scintillator import Scintillator
|
|
|
16
18
|
@pydantic.dataclasses.dataclass(config={"arbitrary_types_allowed": True})
|
|
17
19
|
class UDCDefaultDevices:
|
|
18
20
|
cryostream: CryoStream
|
|
21
|
+
cryostream_gantry: CryoStreamGantry
|
|
19
22
|
fluorescence_det_motion: FluorescenceDetector
|
|
20
23
|
beamstop: Beamstop
|
|
21
24
|
scintillator: Scintillator
|
|
22
25
|
aperture_scatterguard: ApertureScatterguard
|
|
23
26
|
collimation_table: CollimationTable
|
|
27
|
+
hutch_shutter: HutchShutter
|
|
24
28
|
|
|
25
29
|
|
|
26
30
|
def move_to_udc_default_state(devices: UDCDefaultDevices):
|
|
27
31
|
"""Moves beamline to known positions prior to UDC start"""
|
|
32
|
+
yield from _verify_correct_cryostream_selected(devices.cryostream_gantry)
|
|
28
33
|
|
|
29
34
|
cryostream_temp = yield from bps.rd(devices.cryostream.temperature_k)
|
|
30
35
|
cryostream_pressure = yield from bps.rd(devices.cryostream.back_pressure_bar)
|
|
@@ -33,6 +38,10 @@ def move_to_udc_default_state(devices: UDCDefaultDevices):
|
|
|
33
38
|
if cryostream_pressure > devices.cryostream.MAX_PRESSURE_BAR:
|
|
34
39
|
raise ValueError("Cryostream back pressure is too high, not starting UDC")
|
|
35
40
|
|
|
41
|
+
yield from bps.abs_set(
|
|
42
|
+
devices.hutch_shutter, ShutterDemand.OPEN, group="udc_default"
|
|
43
|
+
)
|
|
44
|
+
|
|
36
45
|
yield from bps.abs_set(devices.scintillator.selected_pos, ScinInOut.OUT, wait=True)
|
|
37
46
|
|
|
38
47
|
yield from bps.abs_set(
|
|
@@ -63,3 +72,15 @@ def move_to_udc_default_state(devices: UDCDefaultDevices):
|
|
|
63
72
|
yield from bps.abs_set(devices.cryostream.fine, CryoInOut.IN, group="udc_default")
|
|
64
73
|
|
|
65
74
|
yield from bps.wait("udc_default")
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _verify_correct_cryostream_selected(
|
|
78
|
+
cryostream_gantry: CryoStreamGantry,
|
|
79
|
+
) -> MsgGenerator:
|
|
80
|
+
cryostream_selection = yield from bps.rd(cryostream_gantry.cryostream_selector)
|
|
81
|
+
cryostream_selected = yield from bps.rd(cryostream_gantry.cryostream_selected)
|
|
82
|
+
if cryostream_selection != CryoStreamSelection.CRYOJET or cryostream_selected != 1:
|
|
83
|
+
raise ValueError(
|
|
84
|
+
f"Cryostream is not selected for use, control PV selection = {cryostream_selection}, "
|
|
85
|
+
f"current status {cryostream_selected}"
|
|
86
|
+
)
|
|
@@ -6,7 +6,7 @@ import bluesky.preprocessors as bpp
|
|
|
6
6
|
from mx_bluesky.common.external_interaction.callbacks.sample_handling.sample_handling_callback import (
|
|
7
7
|
SampleHandlingCallback,
|
|
8
8
|
)
|
|
9
|
-
from mx_bluesky.common.utils.exceptions import
|
|
9
|
+
from mx_bluesky.common.utils.exceptions import SampleError
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class SampleStatusExceptionType(StrEnum):
|
|
@@ -27,7 +27,7 @@ def deposit_sample_error(exception_type: SampleStatusExceptionType, sample_id: i
|
|
|
27
27
|
if exception_type == SampleStatusExceptionType.BEAMLINE:
|
|
28
28
|
raise AssertionError()
|
|
29
29
|
elif exception_type == SampleStatusExceptionType.SAMPLE:
|
|
30
|
-
raise
|
|
30
|
+
raise SampleError
|
|
31
31
|
|
|
32
32
|
yield from _inner()
|
|
33
33
|
|
|
@@ -10,7 +10,7 @@ from bluesky.utils import MsgGenerator
|
|
|
10
10
|
from dodal.devices.oav.oav_detector import OAV
|
|
11
11
|
from dodal.devices.oav.pin_image_recognition import PinTipDetection
|
|
12
12
|
from dodal.devices.oav.pin_image_recognition.utils import NONE_VALUE
|
|
13
|
-
from dodal.devices.oav.utils import
|
|
13
|
+
from dodal.devices.oav.utils import PinNotFoundError, wait_for_tip_to_be_found
|
|
14
14
|
from dodal.devices.smargon import Smargon
|
|
15
15
|
|
|
16
16
|
from mx_bluesky.common.device_setup_plans.setup_oav import (
|
|
@@ -108,7 +108,7 @@ def grid_detection_plan(
|
|
|
108
108
|
yield from bps.sleep(HardwareConstants.OAV_REFRESH_DELAY)
|
|
109
109
|
|
|
110
110
|
tip_x_px, tip_y_px = yield from catch_exception_and_warn(
|
|
111
|
-
|
|
111
|
+
PinNotFoundError, wait_for_tip_to_be_found, pin_tip_detection
|
|
112
112
|
)
|
|
113
113
|
|
|
114
114
|
LOGGER.info(f"Tip is at x,y: {tip_x_px},{tip_y_px}")
|
|
@@ -29,7 +29,7 @@ from mx_bluesky.common.external_interaction.ispyb.ispyb_utils import get_ispyb_c
|
|
|
29
29
|
from mx_bluesky.common.parameters.components import DiffractionExperimentWithSample
|
|
30
30
|
from mx_bluesky.common.parameters.constants import DocDescriptorNames
|
|
31
31
|
from mx_bluesky.common.utils.log import ISPYB_ZOCALO_CALLBACK_LOGGER, set_dcgid_tag
|
|
32
|
-
from mx_bluesky.common.utils.utils import
|
|
32
|
+
from mx_bluesky.common.utils.utils import convert_ev_to_angstrom
|
|
33
33
|
|
|
34
34
|
D = TypeVar("D")
|
|
35
35
|
if TYPE_CHECKING:
|
|
@@ -43,9 +43,9 @@ def _update_based_on_energy(
|
|
|
43
43
|
):
|
|
44
44
|
"""If energy has been read as part of this reading then add it into the data
|
|
45
45
|
collection info along with the other fields that depend on it."""
|
|
46
|
-
if energy_kev := doc["data"].get("dcm-
|
|
46
|
+
if energy_kev := doc["data"].get("dcm-energy_in_keV", None):
|
|
47
47
|
energy_ev = energy_kev * 1000
|
|
48
|
-
wavelength_angstroms =
|
|
48
|
+
wavelength_angstroms = convert_ev_to_angstrom(energy_ev)
|
|
49
49
|
data_collection_info.wavelength = wavelength_angstroms
|
|
50
50
|
data_collection_info.resolution = resolution(
|
|
51
51
|
detector_params,
|
|
@@ -40,7 +40,7 @@ class PlanReactiveCallback(CallbackBase):
|
|
|
40
40
|
self.log = log
|
|
41
41
|
|
|
42
42
|
def _run_activity_gated(self, name: str, func, doc, override=False):
|
|
43
|
-
# Runs `func` if self.active is True or
|
|
43
|
+
# Runs `func` if self.active is True or override is true. Override can be used
|
|
44
44
|
# to run the function even after setting self.active to False, i.e. in the last
|
|
45
45
|
# handler of a run.
|
|
46
46
|
|
|
@@ -9,7 +9,7 @@ from dodal.devices.zocalo import ZocaloStartInfo, ZocaloTrigger
|
|
|
9
9
|
from mx_bluesky.common.parameters.constants import (
|
|
10
10
|
DocDescriptorNames,
|
|
11
11
|
)
|
|
12
|
-
from mx_bluesky.common.utils.exceptions import
|
|
12
|
+
from mx_bluesky.common.utils.exceptions import ISPyBDepositionNotMadeError
|
|
13
13
|
from mx_bluesky.common.utils.log import ISPYB_ZOCALO_CALLBACK_LOGGER
|
|
14
14
|
|
|
15
15
|
if TYPE_CHECKING:
|
|
@@ -89,7 +89,7 @@ class ZocaloCallback(CallbackBase):
|
|
|
89
89
|
f"Zocalo handler received stop document, for run {doc.get('run_start')}."
|
|
90
90
|
)
|
|
91
91
|
if not self._started_zocalo_collections:
|
|
92
|
-
raise
|
|
92
|
+
raise ISPyBDepositionNotMadeError(
|
|
93
93
|
f"No ISPyB IDs received by the end of {self.triggering_plan=}"
|
|
94
94
|
)
|
|
95
95
|
for info in self._started_zocalo_collections:
|
mx_bluesky/common/external_interaction/callbacks/sample_handling/sample_handling_callback.py
CHANGED
|
@@ -12,7 +12,7 @@ from mx_bluesky.common.external_interaction.ispyb.exp_eye_store import (
|
|
|
12
12
|
BLSampleStatus,
|
|
13
13
|
ExpeyeInteraction,
|
|
14
14
|
)
|
|
15
|
-
from mx_bluesky.common.utils.exceptions import
|
|
15
|
+
from mx_bluesky.common.utils.exceptions import CrystalNotFoundError, SampleError
|
|
16
16
|
from mx_bluesky.common.utils.log import ISPYB_ZOCALO_CALLBACK_LOGGER
|
|
17
17
|
|
|
18
18
|
|
|
@@ -47,7 +47,7 @@ class SampleHandlingCallback(PlanReactiveCallback):
|
|
|
47
47
|
expeye = ExpeyeInteraction()
|
|
48
48
|
if doc["exit_status"] != "success":
|
|
49
49
|
reason = doc.get("reason", "")
|
|
50
|
-
exception_type, message =
|
|
50
|
+
exception_type, message = SampleError.type_and_message_from_reason(
|
|
51
51
|
reason
|
|
52
52
|
)
|
|
53
53
|
self.log.info(
|
|
@@ -83,7 +83,7 @@ class SampleHandlingCallback(PlanReactiveCallback):
|
|
|
83
83
|
|
|
84
84
|
def _decode_sample_status(self, exception_type: str) -> BLSampleStatus:
|
|
85
85
|
match exception_type:
|
|
86
|
-
case
|
|
86
|
+
case SampleError.__name__ | CrystalNotFoundError.__name__:
|
|
87
87
|
return BLSampleStatus.ERROR_SAMPLE
|
|
88
88
|
return BLSampleStatus.ERROR_BEAMLINE
|
|
89
89
|
|
|
@@ -40,8 +40,8 @@ from mx_bluesky.common.parameters.components import DiffractionExperimentWithSam
|
|
|
40
40
|
from mx_bluesky.common.parameters.constants import DocDescriptorNames, PlanNameConstants
|
|
41
41
|
from mx_bluesky.common.parameters.gridscan import GridCommon
|
|
42
42
|
from mx_bluesky.common.utils.exceptions import (
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
ISPyBDepositionNotMadeError,
|
|
44
|
+
SampleError,
|
|
45
45
|
)
|
|
46
46
|
from mx_bluesky.common.utils.log import ISPYB_ZOCALO_CALLBACK_LOGGER, set_dcgid_tag
|
|
47
47
|
from mx_bluesky.common.utils.utils import number_of_frames_from_scan_spec
|
|
@@ -87,7 +87,7 @@ class GridscanISPyBCallback(BaseISPyBCallback):
|
|
|
87
87
|
To use, subscribe the Bluesky RunEngine to an instance of this class.
|
|
88
88
|
E.g.:
|
|
89
89
|
ispyb_handler_callback = FGSISPyBCallback(parameters)
|
|
90
|
-
|
|
90
|
+
run_engine.subscribe(ispyb_handler_callback)
|
|
91
91
|
Or decorate a plan using bluesky.preprocessors.subs_decorator.
|
|
92
92
|
|
|
93
93
|
See: https://blueskyproject.io/bluesky/callbacks.html#ways-to-invoke-callbacks
|
|
@@ -303,8 +303,10 @@ class GridscanISPyBCallback(BaseISPyBCallback):
|
|
|
303
303
|
f"with uid: {self.uid_to_finalize_on}."
|
|
304
304
|
)
|
|
305
305
|
if self.ispyb_ids == IspybIds():
|
|
306
|
-
raise
|
|
307
|
-
|
|
306
|
+
raise ISPyBDepositionNotMadeError(
|
|
307
|
+
"ispyb was not initialised at run start"
|
|
308
|
+
)
|
|
309
|
+
exception_type, message = SampleError.type_and_message_from_reason(
|
|
308
310
|
doc.get("reason", "")
|
|
309
311
|
)
|
|
310
312
|
if exception_type:
|
|
@@ -33,7 +33,7 @@ class GridscanNexusFileCallback(PlanReactiveCallback):
|
|
|
33
33
|
To use, subscribe the Bluesky RunEngine to an instance of this class.
|
|
34
34
|
E.g.:
|
|
35
35
|
nexus_file_handler_callback = NexusFileCallback(parameters)
|
|
36
|
-
|
|
36
|
+
run_engine.subscribe(nexus_file_handler_callback)
|
|
37
37
|
Or decorate a plan using bluesky.preprocessors.subs_decorator.
|
|
38
38
|
|
|
39
39
|
See: https://blueskyproject.io/bluesky/callbacks.html#ways-to-invoke-callbacks
|
|
@@ -89,7 +89,7 @@ class GridscanNexusFileCallback(PlanReactiveCallback):
|
|
|
89
89
|
nexus_writer.beam,
|
|
90
90
|
nexus_writer.attenuator,
|
|
91
91
|
) = create_beam_and_attenuator_parameters(
|
|
92
|
-
data["dcm-
|
|
92
|
+
data["dcm-energy_in_keV"],
|
|
93
93
|
data["flux-flux_reading"],
|
|
94
94
|
data["attenuator-actual_transmission"],
|
|
95
95
|
)
|
|
@@ -10,7 +10,7 @@ from pydantic import TypeAdapter
|
|
|
10
10
|
from mx_bluesky.common.parameters.constants import (
|
|
11
11
|
GDA_DOMAIN_PROPERTIES_PATH,
|
|
12
12
|
FeatureSetting,
|
|
13
|
-
|
|
13
|
+
FeatureSettingSources,
|
|
14
14
|
OavConstants,
|
|
15
15
|
)
|
|
16
16
|
from mx_bluesky.common.utils.log import LOGGER
|
|
@@ -25,7 +25,7 @@ T = TypeVar("T", bound=FeatureSetting)
|
|
|
25
25
|
class MXConfigClient(ConfigServer, Generic[T]):
|
|
26
26
|
def __init__(
|
|
27
27
|
self,
|
|
28
|
-
feature_sources: type[
|
|
28
|
+
feature_sources: type[FeatureSettingSources],
|
|
29
29
|
feature_dc: type[T],
|
|
30
30
|
url: str = "https://daq-config.diamond.ac.uk",
|
|
31
31
|
):
|
|
@@ -11,7 +11,7 @@ from mx_bluesky.common.external_interaction.ispyb.ispyb_utils import (
|
|
|
11
11
|
get_current_time_string,
|
|
12
12
|
get_ispyb_config,
|
|
13
13
|
)
|
|
14
|
-
from mx_bluesky.common.utils.exceptions import
|
|
14
|
+
from mx_bluesky.common.utils.exceptions import ISPyBDepositionNotMadeError
|
|
15
15
|
|
|
16
16
|
RobotActionID = int
|
|
17
17
|
|
|
@@ -40,7 +40,9 @@ def _send_and_get_response(auth, url, data, send_func) -> dict:
|
|
|
40
40
|
resp_txt = str(response.json())
|
|
41
41
|
except JSONDecodeError:
|
|
42
42
|
resp_txt = str(response)
|
|
43
|
-
raise
|
|
43
|
+
raise ISPyBDepositionNotMadeError(
|
|
44
|
+
f"Could not write {data} to {url}: {resp_txt}"
|
|
45
|
+
)
|
|
44
46
|
return response.json()
|
|
45
47
|
|
|
46
48
|
|
|
@@ -11,7 +11,7 @@ from nexgen.nxs_utils.axes import TransformationType
|
|
|
11
11
|
from numpy.typing import DTypeLike
|
|
12
12
|
|
|
13
13
|
from mx_bluesky.common.utils.log import NEXUS_LOGGER
|
|
14
|
-
from mx_bluesky.common.utils.utils import
|
|
14
|
+
from mx_bluesky.common.utils.utils import convert_ev_to_angstrom
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class AxisDirection(Enum):
|
|
@@ -158,6 +158,6 @@ def create_beam_and_attenuator_parameters(
|
|
|
158
158
|
tuple[Beam, Attenuator]: Descriptions of the beam and attenuator for nexgen.
|
|
159
159
|
"""
|
|
160
160
|
return (
|
|
161
|
-
Beam(wavelength=
|
|
161
|
+
Beam(wavelength=convert_ev_to_angstrom(energy_kev * 1000), flux=flux),
|
|
162
162
|
Attenuator(transmission=transmission_fraction),
|
|
163
163
|
)
|
|
@@ -87,7 +87,7 @@ class NexusWriter:
|
|
|
87
87
|
vds_shape = self.data_shape
|
|
88
88
|
|
|
89
89
|
for filename in [self.nexus_file, self.master_file]:
|
|
90
|
-
|
|
90
|
+
nxmx_writer = NXmxFileWriter(
|
|
91
91
|
filename,
|
|
92
92
|
self.goniometer,
|
|
93
93
|
self.detector,
|
|
@@ -96,12 +96,12 @@ class NexusWriter:
|
|
|
96
96
|
self.attenuator,
|
|
97
97
|
self.full_num_of_images,
|
|
98
98
|
)
|
|
99
|
-
|
|
99
|
+
nxmx_writer.write(
|
|
100
100
|
image_filename=f"{self.data_filename}",
|
|
101
101
|
start_time=start_time,
|
|
102
102
|
est_end_time=est_end_time,
|
|
103
103
|
)
|
|
104
|
-
|
|
104
|
+
nxmx_writer.write_vds(
|
|
105
105
|
vds_offset=self.start_index, vds_shape=vds_shape, vds_dtype=bit_depth
|
|
106
106
|
)
|
|
107
107
|
|
|
@@ -166,6 +166,6 @@ class Status(Enum):
|
|
|
166
166
|
class FeatureSetting: ... # List of features and their default values. Subclasses must also be a pydantic dataclass
|
|
167
167
|
|
|
168
168
|
|
|
169
|
-
class
|
|
169
|
+
class FeatureSettingSources(
|
|
170
170
|
StrEnum
|
|
171
171
|
): ... # List of features and the name of that property in domain.properties
|
|
@@ -4,7 +4,7 @@ from dodal.devices.aperturescatterguard import (
|
|
|
4
4
|
)
|
|
5
5
|
from dodal.devices.attenuator.attenuator import BinaryFilterAttenuator
|
|
6
6
|
from dodal.devices.backlight import Backlight
|
|
7
|
-
from dodal.devices.common_dcm import
|
|
7
|
+
from dodal.devices.common_dcm import DoubleCrystalMonochromator
|
|
8
8
|
from dodal.devices.detector.detector_motion import DetectorMotion
|
|
9
9
|
from dodal.devices.eiger import EigerDetector
|
|
10
10
|
from dodal.devices.fast_grid_scan import (
|
|
@@ -51,7 +51,7 @@ class GridDetectThenXRayCentreComposite(FlyScanEssentialDevices):
|
|
|
51
51
|
attenuator: BinaryFilterAttenuator
|
|
52
52
|
backlight: Backlight
|
|
53
53
|
beamstop: Beamstop
|
|
54
|
-
dcm:
|
|
54
|
+
dcm: DoubleCrystalMonochromator
|
|
55
55
|
detector_motion: DetectorMotion
|
|
56
56
|
zebra_fast_grid_scan: ZebraFastGridScanThreeD
|
|
57
57
|
flux: Flux
|
|
@@ -109,7 +109,7 @@ class SpecifiedGrid(GridCommon, XyzStarts, WithScan, Generic[GridScanParamType])
|
|
|
109
109
|
|
|
110
110
|
@property
|
|
111
111
|
@abstractmethod
|
|
112
|
-
def
|
|
112
|
+
def fast_gridscan_params(self) -> GridScanParamType: ...
|
|
113
113
|
|
|
114
114
|
def do_set_stub_offsets(self, value: bool):
|
|
115
115
|
self._set_stub_offsets = value
|
|
@@ -167,7 +167,7 @@ class SpecifiedThreeDGridScan(
|
|
|
167
167
|
grid2_omega_deg: float = Field(default=GridscanParamConstants.OMEGA_2)
|
|
168
168
|
|
|
169
169
|
@property
|
|
170
|
-
def
|
|
170
|
+
def fast_gridscan_params(self) -> ZebraGridScanParamsThreeD:
|
|
171
171
|
return ZebraGridScanParamsThreeD(
|
|
172
172
|
x_steps=self.x_steps,
|
|
173
173
|
y_steps=self.y_steps,
|