mx-bluesky 1.4.5__py3-none-any.whl → 1.4.7__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 +9 -4
- mx_bluesky/beamlines/aithre_lasershaping/__init__.py +13 -0
- mx_bluesky/beamlines/aithre_lasershaping/check_goniometer_performance.py +29 -0
- mx_bluesky/beamlines/aithre_lasershaping/goniometer_controls.py +18 -0
- mx_bluesky/beamlines/i04/redis_to_murko_forwarder.py +45 -28
- mx_bluesky/beamlines/i04/thawing_plan.py +19 -14
- mx_bluesky/beamlines/i24/serial/__init__.py +14 -0
- mx_bluesky/beamlines/i24/serial/dcid.py +3 -1
- mx_bluesky/beamlines/i24/serial/extruder/EX-gui-edm/DiamondExtruder-I24-py3v1.edl +12 -12
- mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +31 -30
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +16 -14
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +19 -21
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py +11 -4
- mx_bluesky/beamlines/i24/serial/parameters/constants.py +1 -1
- mx_bluesky/beamlines/i24/serial/set_visit_directory.sh +1 -1
- mx_bluesky/beamlines/i24/serial/setup_beamline/pv.py +16 -16
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +48 -49
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +2 -2
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +11 -9
- mx_bluesky/beamlines/i24/serial/web_gui_plans/general_plans.py +109 -0
- mx_bluesky/beamlines/i24/serial/write_nexus.py +5 -4
- mx_bluesky/common/device_setup_plans/xbpm_feedback.py +45 -0
- mx_bluesky/common/external_interaction/callbacks/common/ispyb_callback_base.py +2 -4
- mx_bluesky/common/external_interaction/callbacks/common/ispyb_mapping.py +1 -1
- mx_bluesky/common/external_interaction/callbacks/common/plan_reactive_callback.py +2 -2
- mx_bluesky/common/external_interaction/callbacks/common/zocalo_callback.py +18 -15
- mx_bluesky/common/external_interaction/callbacks/sample_handling/__init__.py +0 -0
- mx_bluesky/{hyperion → common}/external_interaction/callbacks/sample_handling/sample_handling_callback.py +29 -12
- mx_bluesky/common/external_interaction/callbacks/xray_centre/ispyb_callback.py +43 -7
- mx_bluesky/common/external_interaction/callbacks/xray_centre/ispyb_mapping.py +1 -1
- mx_bluesky/common/external_interaction/callbacks/xray_centre/nexus_callback.py +2 -1
- mx_bluesky/common/external_interaction/ispyb/data_model.py +1 -0
- mx_bluesky/common/external_interaction/ispyb/exp_eye_store.py +6 -2
- mx_bluesky/common/external_interaction/ispyb/ispyb_store.py +21 -1
- mx_bluesky/common/external_interaction/nexus/nexus_utils.py +1 -1
- mx_bluesky/common/parameters/constants.py +3 -1
- mx_bluesky/common/parameters/gridscan.py +36 -1
- mx_bluesky/common/plans/do_fgs.py +4 -6
- mx_bluesky/common/plans/read_hardware.py +78 -0
- mx_bluesky/common/plans/write_sample_status.py +46 -0
- mx_bluesky/common/preprocessors/__init__.py +0 -0
- mx_bluesky/common/preprocessors/preprocessors.py +105 -0
- mx_bluesky/common/protocols/__init__.py +0 -0
- mx_bluesky/common/protocols/protocols.py +10 -0
- mx_bluesky/common/utils/context.py +68 -0
- mx_bluesky/{hyperion/experiment_plans/common → common}/xrc_result.py +16 -0
- mx_bluesky/hyperion/__main__.py +7 -9
- mx_bluesky/hyperion/baton_handler.py +84 -0
- mx_bluesky/hyperion/device_setup_plans/setup_oav.py +5 -5
- mx_bluesky/hyperion/device_setup_plans/setup_panda.py +5 -1
- mx_bluesky/hyperion/device_setup_plans/setup_zebra.py +2 -2
- mx_bluesky/hyperion/device_setup_plans/smargon.py +6 -6
- mx_bluesky/hyperion/device_setup_plans/utils.py +2 -2
- mx_bluesky/hyperion/experiment_plans/__init__.py +0 -4
- mx_bluesky/hyperion/experiment_plans/change_aperture_then_move_plan.py +12 -31
- mx_bluesky/hyperion/experiment_plans/experiment_registry.py +0 -7
- mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py +44 -97
- mx_bluesky/hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py +6 -6
- mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +8 -6
- mx_bluesky/hyperion/experiment_plans/oav_grid_detection_plan.py +11 -11
- mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +5 -5
- mx_bluesky/hyperion/experiment_plans/optimise_attenuation_plan.py +1 -1
- mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +2 -4
- mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +15 -13
- mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +10 -10
- mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +1 -29
- mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +30 -27
- mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +25 -6
- mx_bluesky/hyperion/external_interaction/agamemnon.py +242 -0
- mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +12 -6
- mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_callback.py +1 -1
- mx_bluesky/hyperion/external_interaction/callbacks/snapshot_callback.py +107 -0
- mx_bluesky/hyperion/external_interaction/config_server.py +6 -6
- mx_bluesky/hyperion/parameters/device_composites.py +49 -0
- mx_bluesky/hyperion/parameters/gridscan.py +3 -3
- mx_bluesky/hyperion/parameters/rotation.py +1 -1
- mx_bluesky/hyperion/utils/__init__.py +1 -0
- mx_bluesky/hyperion/utils/context.py +0 -65
- mx_bluesky/hyperion/utils/validation.py +3 -3
- {mx_bluesky-1.4.5.dist-info → mx_bluesky-1.4.7.dist-info}/METADATA +6 -5
- {mx_bluesky-1.4.5.dist-info → mx_bluesky-1.4.7.dist-info}/RECORD +86 -72
- {mx_bluesky-1.4.5.dist-info → mx_bluesky-1.4.7.dist-info}/WHEEL +1 -1
- {mx_bluesky-1.4.5.dist-info → mx_bluesky-1.4.7.dist-info}/entry_points.txt +1 -0
- mx_bluesky/common/device_setup_plans/read_hardware_for_setup.py +0 -14
- mx_bluesky/common/external_interaction/callbacks/common/aperture_change_callback.py +0 -22
- mx_bluesky/hyperion/device_setup_plans/read_hardware_for_setup.py +0 -54
- mx_bluesky/hyperion/device_setup_plans/xbpm_feedback.py +0 -103
- /mx_bluesky/{hyperion/external_interaction/callbacks/sample_handling → beamlines/i24/serial/web_gui_plans}/__init__.py +0 -0
- {mx_bluesky-1.4.5.dist-info → mx_bluesky-1.4.7.dist-info/licenses}/LICENSE +0 -0
- {mx_bluesky-1.4.5.dist-info → mx_bluesky-1.4.7.dist-info}/top_level.txt +0 -0
mx_bluesky/_version.py
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
# file generated by
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
2
|
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
|
|
5
|
+
|
|
3
6
|
TYPE_CHECKING = False
|
|
4
7
|
if TYPE_CHECKING:
|
|
5
|
-
from typing import Tuple
|
|
8
|
+
from typing import Tuple
|
|
9
|
+
from typing import Union
|
|
10
|
+
|
|
6
11
|
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
7
12
|
else:
|
|
8
13
|
VERSION_TUPLE = object
|
|
@@ -12,5 +17,5 @@ __version__: str
|
|
|
12
17
|
__version_tuple__: VERSION_TUPLE
|
|
13
18
|
version_tuple: VERSION_TUPLE
|
|
14
19
|
|
|
15
|
-
__version__ = version = '1.4.
|
|
16
|
-
__version_tuple__ = version_tuple = (1, 4,
|
|
20
|
+
__version__ = version = '1.4.7'
|
|
21
|
+
__version_tuple__ = version_tuple = (1, 4, 7)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from mx_bluesky.beamlines.aithre_lasershaping.check_goniometer_performance import (
|
|
2
|
+
check_omega_performance,
|
|
3
|
+
)
|
|
4
|
+
from mx_bluesky.beamlines.aithre_lasershaping.goniometer_controls import (
|
|
5
|
+
change_goniometer_turn_speed,
|
|
6
|
+
rotate_goniometer_relative,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"check_omega_performance",
|
|
11
|
+
"change_goniometer_turn_speed",
|
|
12
|
+
"rotate_goniometer_relative",
|
|
13
|
+
]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import bluesky.plan_stubs as bps
|
|
2
|
+
from bluesky.utils import MsgGenerator
|
|
3
|
+
from dodal.devices.aithre_lasershaping.goniometer import Goniometer
|
|
4
|
+
|
|
5
|
+
DEFAULT_VELOCITIES = [5.0, 10.0, 20.0, 40.0, 80.0, 90.0]
|
|
6
|
+
DEFAULT_POSITIONS = [
|
|
7
|
+
300.0,
|
|
8
|
+
-300.0,
|
|
9
|
+
600.0,
|
|
10
|
+
-600.0,
|
|
11
|
+
1200.0,
|
|
12
|
+
-1200.0,
|
|
13
|
+
2400.0,
|
|
14
|
+
-2400.0,
|
|
15
|
+
3600.0,
|
|
16
|
+
-3600.0,
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def check_omega_performance(
|
|
21
|
+
goniometer: Goniometer,
|
|
22
|
+
velocities: list[float] = DEFAULT_VELOCITIES,
|
|
23
|
+
values: list[float] = DEFAULT_POSITIONS,
|
|
24
|
+
) -> MsgGenerator:
|
|
25
|
+
"""Move the goniometer from positive to negative to check omega performance"""
|
|
26
|
+
for omega_velocity in velocities:
|
|
27
|
+
yield from bps.abs_set(goniometer.omega.velocity, omega_velocity, wait=True)
|
|
28
|
+
for omega_value in values:
|
|
29
|
+
yield from bps.abs_set(goniometer.omega, omega_value, wait=True)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import bluesky.plan_stubs as bps
|
|
2
|
+
from bluesky.utils import MsgGenerator
|
|
3
|
+
from dodal.common import inject
|
|
4
|
+
from dodal.devices.aithre_lasershaping.goniometer import Goniometer
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def rotate_goniometer_relative(
|
|
8
|
+
value: float, goniometer: Goniometer = inject("goniometer")
|
|
9
|
+
) -> MsgGenerator:
|
|
10
|
+
"""Adjust the goniometer position incrementally"""
|
|
11
|
+
yield from bps.rel_set(goniometer.omega, value, wait=True)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def change_goniometer_turn_speed(
|
|
15
|
+
velocity: float, goniometer: Goniometer = inject("goniometer")
|
|
16
|
+
) -> MsgGenerator:
|
|
17
|
+
"""Set the velocity of the goniometer"""
|
|
18
|
+
yield from bps.mv(goniometer.omega.velocity, velocity)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import io
|
|
2
2
|
import json
|
|
3
3
|
import pickle
|
|
4
|
+
from datetime import timedelta
|
|
4
5
|
from typing import TypedDict
|
|
5
6
|
|
|
6
7
|
import numpy as np
|
|
@@ -14,13 +15,20 @@ from mx_bluesky.common.utils.log import LOGGER
|
|
|
14
15
|
|
|
15
16
|
MURKO_ADDRESS = "tcp://i04-murko-prod.diamond.ac.uk:8008"
|
|
16
17
|
|
|
18
|
+
MurkoResult = dict
|
|
19
|
+
FullMurkoResults = dict[str, list[MurkoResult]]
|
|
20
|
+
|
|
17
21
|
|
|
18
22
|
class MurkoRequest(TypedDict):
|
|
23
|
+
"""See https://github.com/MartinSavko/murko#usage for more information."""
|
|
24
|
+
|
|
19
25
|
to_predict: NDArray
|
|
20
26
|
model_img_size: tuple[int, int]
|
|
21
27
|
save: bool
|
|
22
28
|
min_size: int
|
|
23
29
|
description: list
|
|
30
|
+
|
|
31
|
+
# The identifier for each image
|
|
24
32
|
prefix: list[str]
|
|
25
33
|
|
|
26
34
|
|
|
@@ -29,32 +37,26 @@ def get_image_size(image: NDArray) -> tuple[int, int]:
|
|
|
29
37
|
return image.shape[1], image.shape[0]
|
|
30
38
|
|
|
31
39
|
|
|
32
|
-
def send_to_murko_and_get_results(request: MurkoRequest) ->
|
|
40
|
+
def send_to_murko_and_get_results(request: MurkoRequest) -> FullMurkoResults:
|
|
33
41
|
LOGGER.info(f"Sending {request['prefix']} to murko")
|
|
34
42
|
context = zmq.Context()
|
|
35
43
|
socket = context.socket(zmq.REQ)
|
|
36
44
|
socket.connect(MURKO_ADDRESS)
|
|
37
45
|
socket.send(pickle.dumps(request))
|
|
38
46
|
raw_results = socket.recv()
|
|
47
|
+
assert isinstance(raw_results, bytes)
|
|
39
48
|
results = pickle.loads(raw_results)
|
|
40
49
|
LOGGER.info(f"Got {len(results['descriptions'])} results")
|
|
41
50
|
return results
|
|
42
51
|
|
|
43
52
|
|
|
44
|
-
def
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
coords = prediction["most_likely_click"]
|
|
52
|
-
y_coord = coords[0] * height
|
|
53
|
-
x_coord = coords[1] * width
|
|
54
|
-
results.append(
|
|
55
|
-
{"uuid": uuid, "x_pixel_coord": x_coord, "y_pixel_coord": y_coord}
|
|
56
|
-
)
|
|
57
|
-
return results
|
|
53
|
+
def _correlate_results_to_uuids(
|
|
54
|
+
request: MurkoRequest, murko_results: FullMurkoResults
|
|
55
|
+
) -> list[tuple[str, MurkoResult]]:
|
|
56
|
+
"""We send a batch of images to murko, with each having a 'prefix' of the uuid that
|
|
57
|
+
we're using to keep track of the image. Murko sends back an ordered list of these,
|
|
58
|
+
which we match to the supplied prefix here."""
|
|
59
|
+
return list(zip(request["prefix"], murko_results["descriptions"], strict=False))
|
|
58
60
|
|
|
59
61
|
|
|
60
62
|
class BatchMurkoForwarder:
|
|
@@ -94,16 +96,20 @@ class BatchMurkoForwarder:
|
|
|
94
96
|
],
|
|
95
97
|
"prefix": uuids,
|
|
96
98
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
self._send_murko_results_to_redis(sample_id,
|
|
100
|
-
|
|
101
|
-
def _send_murko_results_to_redis(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
99
|
+
results = send_to_murko_and_get_results(request_arguments)
|
|
100
|
+
results_with_uuids = _correlate_results_to_uuids(request_arguments, results)
|
|
101
|
+
self._send_murko_results_to_redis(sample_id, results_with_uuids)
|
|
102
|
+
|
|
103
|
+
def _send_murko_results_to_redis(
|
|
104
|
+
self, sample_id: str, results: list[tuple[str, MurkoResult]]
|
|
105
|
+
):
|
|
106
|
+
"""Stores the results into a redis hash (for longer term storage) and publishes
|
|
107
|
+
them as well so that downstream clients can get notified."""
|
|
108
|
+
for uuid, result in results:
|
|
109
|
+
redis_key = f"murko:{sample_id}:results"
|
|
110
|
+
self.redis_client.hset(redis_key, uuid, str(pickle.dumps(result)))
|
|
111
|
+
self.redis_client.expire(redis_key, timedelta(days=7))
|
|
112
|
+
self.redis_client.publish("murko-results", pickle.dumps(results))
|
|
107
113
|
|
|
108
114
|
def add(self, sample_id: str, uuid: str, image: NDArray):
|
|
109
115
|
"""Add an image to the batch to send to murko."""
|
|
@@ -156,8 +162,15 @@ class RedisListener:
|
|
|
156
162
|
sample_id = data["sample_id"]
|
|
157
163
|
|
|
158
164
|
# Images are put in redis as raw jpeg bytes, murko needs numpy arrays
|
|
159
|
-
|
|
160
|
-
|
|
165
|
+
image_key = f"murko:{sample_id}:raw"
|
|
166
|
+
raw_image = self.redis_client.hget(image_key, uuid)
|
|
167
|
+
|
|
168
|
+
if not isinstance(raw_image, bytes):
|
|
169
|
+
LOGGER.warning(
|
|
170
|
+
f"Image at {image_key}:{uuid} is {raw_image}, expected bytes. Ignoring the data"
|
|
171
|
+
)
|
|
172
|
+
return
|
|
173
|
+
|
|
161
174
|
image = Image.open(io.BytesIO(raw_image))
|
|
162
175
|
image = np.asarray(image)
|
|
163
176
|
|
|
@@ -173,6 +186,10 @@ class RedisListener:
|
|
|
173
186
|
self._get_and_handle_message()
|
|
174
187
|
|
|
175
188
|
|
|
176
|
-
|
|
189
|
+
def main():
|
|
177
190
|
client = RedisListener()
|
|
178
191
|
client.listen_for_image_data_forever()
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
if __name__ == "__main__":
|
|
195
|
+
main()
|
|
@@ -24,21 +24,17 @@ def thaw_and_stream_to_redis(
|
|
|
24
24
|
oav: OAV = inject("oav"),
|
|
25
25
|
oav_to_redis_forwarder: OAVToRedisForwarder = inject("oav_to_redis_forwarder"),
|
|
26
26
|
) -> MsgGenerator:
|
|
27
|
-
zoom_percentage = yield from bps.rd(oav.zoom_controller.percentage)
|
|
27
|
+
zoom_percentage = yield from bps.rd(oav.zoom_controller.percentage)
|
|
28
28
|
sample_id = yield from bps.rd(robot.sample_id)
|
|
29
29
|
|
|
30
30
|
sample_id = int(sample_id)
|
|
31
|
-
zoom_level_before_thawing = yield from bps.rd(oav.zoom_controller.level)
|
|
31
|
+
zoom_level_before_thawing = yield from bps.rd(oav.zoom_controller.level)
|
|
32
32
|
|
|
33
|
-
yield from bps.mv(oav.zoom_controller.level, "1.0x")
|
|
33
|
+
yield from bps.mv(oav.zoom_controller.level, "1.0x")
|
|
34
34
|
|
|
35
35
|
def switch_forwarder_to_ROI() -> MsgGenerator:
|
|
36
36
|
yield from bps.complete(oav_to_redis_forwarder, wait=True)
|
|
37
|
-
yield from bps.mv(
|
|
38
|
-
# See: https://github.com/bluesky/bluesky/issues/1809
|
|
39
|
-
oav_to_redis_forwarder.selected_source, # type: ignore
|
|
40
|
-
Source.ROI.value, # type: ignore
|
|
41
|
-
)
|
|
37
|
+
yield from bps.mv(oav_to_redis_forwarder.selected_source, Source.ROI.value)
|
|
42
38
|
yield from bps.kickoff(oav_to_redis_forwarder, wait=True)
|
|
43
39
|
|
|
44
40
|
microns_per_pixel_x = yield from bps.rd(oav.microns_per_pixel_x)
|
|
@@ -59,22 +55,22 @@ def thaw_and_stream_to_redis(
|
|
|
59
55
|
)
|
|
60
56
|
def _thaw_and_stream_to_redis():
|
|
61
57
|
yield from bps.mv(
|
|
62
|
-
oav_to_redis_forwarder.sample_id,
|
|
63
|
-
sample_id,
|
|
64
|
-
oav_to_redis_forwarder.selected_source,
|
|
65
|
-
Source.FULL_SCREEN.value,
|
|
58
|
+
oav_to_redis_forwarder.sample_id,
|
|
59
|
+
sample_id,
|
|
60
|
+
oav_to_redis_forwarder.selected_source,
|
|
61
|
+
Source.FULL_SCREEN.value,
|
|
66
62
|
)
|
|
67
63
|
|
|
68
64
|
yield from bps.kickoff(oav_to_redis_forwarder, wait=True)
|
|
69
65
|
yield from bps.monitor(smargon.omega.user_readback, name="smargon")
|
|
70
66
|
yield from bps.monitor(oav_to_redis_forwarder.uuid, name="oav")
|
|
71
|
-
yield from
|
|
67
|
+
yield from _thaw(
|
|
72
68
|
time_to_thaw, rotation, thawer, smargon, switch_forwarder_to_ROI
|
|
73
69
|
)
|
|
74
70
|
yield from bps.complete(oav_to_redis_forwarder)
|
|
75
71
|
|
|
76
72
|
def cleanup():
|
|
77
|
-
yield from bps.mv(oav.zoom_controller.level, zoom_level_before_thawing)
|
|
73
|
+
yield from bps.mv(oav.zoom_controller.level, zoom_level_before_thawing)
|
|
78
74
|
|
|
79
75
|
yield from bpp.contingency_wrapper(
|
|
80
76
|
_thaw_and_stream_to_redis(),
|
|
@@ -87,6 +83,15 @@ def thaw(
|
|
|
87
83
|
rotation: float = 360,
|
|
88
84
|
thawer: Thawer = inject("thawer"),
|
|
89
85
|
smargon: Smargon = inject("smargon"),
|
|
86
|
+
) -> MsgGenerator:
|
|
87
|
+
yield from _thaw(time_to_thaw, rotation, thawer, smargon)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _thaw(
|
|
91
|
+
time_to_thaw: float,
|
|
92
|
+
rotation: float = 360,
|
|
93
|
+
thawer: Thawer = inject("thawer"),
|
|
94
|
+
smargon: Smargon = inject("smargon"),
|
|
90
95
|
plan_between_rotations: Callable[[], MsgGenerator] | None = None,
|
|
91
96
|
) -> MsgGenerator:
|
|
92
97
|
"""Rotates the sample and thaws it at the same time.
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
from mx_bluesky.beamlines.i24.serial.web_gui_plans.general_plans import (
|
|
2
|
+
gui_gonio_move_on_click,
|
|
3
|
+
gui_move_detector,
|
|
4
|
+
gui_set_parameters,
|
|
5
|
+
gui_sleep,
|
|
6
|
+
gui_stage_move_on_click,
|
|
7
|
+
)
|
|
8
|
+
|
|
1
9
|
from .extruder.i24ssx_Extruder_Collect_py3v2 import (
|
|
2
10
|
enter_hutch,
|
|
3
11
|
initialise_extruder,
|
|
@@ -43,4 +51,10 @@ __all__ = [
|
|
|
43
51
|
"pumpprobe_calc",
|
|
44
52
|
"setup_collection_logs",
|
|
45
53
|
"clean_up_log_config_at_end",
|
|
54
|
+
# GUI plans
|
|
55
|
+
"gui_stage_move_on_click",
|
|
56
|
+
"gui_gonio_move_on_click",
|
|
57
|
+
"gui_sleep",
|
|
58
|
+
"gui_move_detector",
|
|
59
|
+
"gui_set_parameters",
|
|
46
60
|
]
|
|
@@ -213,7 +213,9 @@ class DCID:
|
|
|
213
213
|
"transmission": transmission,
|
|
214
214
|
"visit": self.parameters.visit.name,
|
|
215
215
|
"wavelength": beam_settings.wavelength_in_a,
|
|
216
|
-
"group": {
|
|
216
|
+
"group": {
|
|
217
|
+
"experimentType": self.parameters.ispyb_experiment_type.value
|
|
218
|
+
},
|
|
217
219
|
"xBeam": xbeam,
|
|
218
220
|
"yBeam": ybeam,
|
|
219
221
|
"ssx": {
|
|
@@ -34,8 +34,8 @@ h 308
|
|
|
34
34
|
lineColor index 26
|
|
35
35
|
fill
|
|
36
36
|
fillColor index 25
|
|
37
|
-
alarmPv "BL24I-
|
|
38
|
-
visPv "BL24I-
|
|
37
|
+
alarmPv "BL24I-MO-IOC-13:GP6"
|
|
38
|
+
visPv "BL24I-MO-IOC-13:GP6"
|
|
39
39
|
visMin "1"
|
|
40
40
|
visMax "10"
|
|
41
41
|
endObjectProperties
|
|
@@ -65,7 +65,7 @@ x 145
|
|
|
65
65
|
y 328
|
|
66
66
|
w 97
|
|
67
67
|
h 30
|
|
68
|
-
controlPv "BL24I-
|
|
68
|
+
controlPv "BL24I-MO-IOC-13:GP9"
|
|
69
69
|
fgColor index 25
|
|
70
70
|
fgAlarm
|
|
71
71
|
bgColor index 3
|
|
@@ -83,7 +83,7 @@ x 145
|
|
|
83
83
|
y 366
|
|
84
84
|
w 97
|
|
85
85
|
h 30
|
|
86
|
-
controlPv "BL24I-
|
|
86
|
+
controlPv "BL24I-MO-IOC-13:GP10"
|
|
87
87
|
fgColor index 25
|
|
88
88
|
fgAlarm
|
|
89
89
|
bgColor index 3
|
|
@@ -192,7 +192,7 @@ x 394
|
|
|
192
192
|
y 124
|
|
193
193
|
w 273
|
|
194
194
|
h 30
|
|
195
|
-
controlPv "BL24I-
|
|
195
|
+
controlPv "BL24I-MO-IOC-13:GP2"
|
|
196
196
|
fgColor index 25
|
|
197
197
|
fgAlarm
|
|
198
198
|
bgColor index 3
|
|
@@ -210,7 +210,7 @@ x 394
|
|
|
210
210
|
y 163
|
|
211
211
|
w 273
|
|
212
212
|
h 30
|
|
213
|
-
controlPv "BL24I-
|
|
213
|
+
controlPv "BL24I-MO-IOC-13:GP3"
|
|
214
214
|
fgColor index 25
|
|
215
215
|
fgAlarm
|
|
216
216
|
bgColor index 3
|
|
@@ -268,7 +268,7 @@ x 449
|
|
|
268
268
|
y 200
|
|
269
269
|
w 125
|
|
270
270
|
h 30
|
|
271
|
-
controlPv "BL24I-
|
|
271
|
+
controlPv "BL24I-MO-IOC-13:GP4"
|
|
272
272
|
fgColor index 25
|
|
273
273
|
fgAlarm
|
|
274
274
|
bgColor index 3
|
|
@@ -286,7 +286,7 @@ x 448
|
|
|
286
286
|
y 237
|
|
287
287
|
w 125
|
|
288
288
|
h 30
|
|
289
|
-
controlPv "BL24I-
|
|
289
|
+
controlPv "BL24I-MO-IOC-13:GP5"
|
|
290
290
|
fgColor index 25
|
|
291
291
|
fgAlarm
|
|
292
292
|
bgColor index 3
|
|
@@ -636,7 +636,7 @@ x 448
|
|
|
636
636
|
y 315
|
|
637
637
|
w 125
|
|
638
638
|
h 30
|
|
639
|
-
controlPv "BL24I-
|
|
639
|
+
controlPv "BL24I-MO-IOC-13:GP7"
|
|
640
640
|
fgColor index 25
|
|
641
641
|
fgAlarm
|
|
642
642
|
bgColor index 3
|
|
@@ -1374,7 +1374,7 @@ x 393
|
|
|
1374
1374
|
y 99
|
|
1375
1375
|
w 253
|
|
1376
1376
|
h 18
|
|
1377
|
-
controlPv "BL24I-
|
|
1377
|
+
controlPv "BL24I-MO-IOC-13:GP1"
|
|
1378
1378
|
format "decimal"
|
|
1379
1379
|
font "arial-medium-r-16.0"
|
|
1380
1380
|
fgColor index 25
|
|
@@ -1896,7 +1896,7 @@ x 430
|
|
|
1896
1896
|
y 662
|
|
1897
1897
|
w 86
|
|
1898
1898
|
h 18
|
|
1899
|
-
controlPv "BL24I-
|
|
1899
|
+
controlPv "BL24I-MO-IOC-13:GP15"
|
|
1900
1900
|
format "decimal"
|
|
1901
1901
|
font "arial-medium-r-16.0"
|
|
1902
1902
|
fgColor index 16
|
|
@@ -1963,7 +1963,7 @@ fgColor index 14
|
|
|
1963
1963
|
bgColor index 3
|
|
1964
1964
|
topShadowColor index 1
|
|
1965
1965
|
botShadowColor index 8
|
|
1966
|
-
controlPv "BL24I-
|
|
1966
|
+
controlPv "BL24I-MO-IOC-13:GP6"
|
|
1967
1967
|
font "arial-medium-r-18.0"
|
|
1968
1968
|
numItems 2
|
|
1969
1969
|
symbolTag {
|
|
@@ -10,7 +10,6 @@ import time
|
|
|
10
10
|
from datetime import datetime
|
|
11
11
|
from pathlib import Path
|
|
12
12
|
from pprint import pformat
|
|
13
|
-
from time import sleep
|
|
14
13
|
|
|
15
14
|
import bluesky.plan_stubs as bps
|
|
16
15
|
import bluesky.preprocessors as bpp
|
|
@@ -71,21 +70,21 @@ def initialise_extruder(
|
|
|
71
70
|
) -> MsgGenerator:
|
|
72
71
|
SSX_LOGGER.info("Initialise Parameters for extruder data collection on I24.")
|
|
73
72
|
|
|
74
|
-
visit = caget(pv.
|
|
73
|
+
visit = caget(pv.ioc13_gp1)
|
|
75
74
|
SSX_LOGGER.info(f"Visit defined {visit}")
|
|
76
75
|
|
|
77
76
|
# Define detector in use
|
|
78
77
|
det_type = yield from get_detector_type(detector_stage)
|
|
79
78
|
|
|
80
|
-
caput(pv.
|
|
81
|
-
caput(pv.
|
|
82
|
-
caput(pv.
|
|
83
|
-
caput(pv.
|
|
84
|
-
caput(pv.
|
|
85
|
-
caput(pv.
|
|
86
|
-
caput(pv.
|
|
87
|
-
caput(pv.
|
|
88
|
-
caput(pv.
|
|
79
|
+
caput(pv.ioc13_gp2, "test")
|
|
80
|
+
caput(pv.ioc13_gp3, "testrun")
|
|
81
|
+
caput(pv.ioc13_gp4, "100")
|
|
82
|
+
caput(pv.ioc13_gp5, "0.01")
|
|
83
|
+
caput(pv.ioc13_gp6, 0)
|
|
84
|
+
caput(pv.ioc13_gp8, 0) # status PV do not reuse gp8 for something else
|
|
85
|
+
caput(pv.ioc13_gp9, 0)
|
|
86
|
+
caput(pv.ioc13_gp10, 0)
|
|
87
|
+
caput(pv.ioc13_gp15, det_type.name)
|
|
89
88
|
caput(pv.pilat_cbftemplate, 0)
|
|
90
89
|
SSX_LOGGER.info("Initialisation complete.")
|
|
91
90
|
yield from bps.null()
|
|
@@ -138,7 +137,7 @@ def enter_hutch(
|
|
|
138
137
|
detector_stage: DetectorMotion = inject("detector_motion"),
|
|
139
138
|
) -> MsgGenerator:
|
|
140
139
|
"""Move the detector stage before entering hutch."""
|
|
141
|
-
yield from bps.mv(detector_stage.z, SAFE_DET_Z)
|
|
140
|
+
yield from bps.mv(detector_stage.z, SAFE_DET_Z)
|
|
142
141
|
SSX_LOGGER.debug("Detector moved.")
|
|
143
142
|
|
|
144
143
|
|
|
@@ -160,7 +159,7 @@ def read_parameters(detector_stage: DetectorMotion, attenuator: ReadOnlyAttenuat
|
|
|
160
159
|
|
|
161
160
|
det_type = yield from get_detector_type(detector_stage)
|
|
162
161
|
SSX_LOGGER.warning(f"DETECTOR TYPE: {det_type}")
|
|
163
|
-
filename = caget(pv.
|
|
162
|
+
filename = caget(pv.ioc13_gp3)
|
|
164
163
|
# If file name ends in a digit this causes processing/pilatus pain.
|
|
165
164
|
# Append an underscore
|
|
166
165
|
if det_type.name == "pilatus":
|
|
@@ -175,19 +174,19 @@ def read_parameters(detector_stage: DetectorMotion, attenuator: ReadOnlyAttenuat
|
|
|
175
174
|
|
|
176
175
|
transmission = yield from bps.rd(attenuator.actual_transmission)
|
|
177
176
|
|
|
178
|
-
pump_status = bool(int(caget(pv.
|
|
179
|
-
pump_exp = float(caget(pv.
|
|
180
|
-
pump_delay = float(caget(pv.
|
|
177
|
+
pump_status = bool(int(caget(pv.ioc13_gp6)))
|
|
178
|
+
pump_exp = float(caget(pv.ioc13_gp9)) if pump_status else 0.0
|
|
179
|
+
pump_delay = float(caget(pv.ioc13_gp10)) if pump_status else 0.0
|
|
181
180
|
|
|
182
181
|
params_dict = {
|
|
183
182
|
"visit": _read_visit_directory_from_file().as_posix(), # noqa
|
|
184
|
-
"directory": caget(pv.
|
|
183
|
+
"directory": caget(pv.ioc13_gp2),
|
|
185
184
|
"filename": filename,
|
|
186
|
-
"exposure_time_s": float(caget(pv.
|
|
187
|
-
"detector_distance_mm": float(caget(pv.
|
|
185
|
+
"exposure_time_s": float(caget(pv.ioc13_gp5)),
|
|
186
|
+
"detector_distance_mm": float(caget(pv.ioc13_gp7)),
|
|
188
187
|
"detector_name": str(det_type),
|
|
189
188
|
"transmission": transmission,
|
|
190
|
-
"num_images": int(caget(pv.
|
|
189
|
+
"num_images": int(caget(pv.ioc13_gp4)),
|
|
191
190
|
"pump_status": pump_status,
|
|
192
191
|
"laser_dwell_s": pump_exp,
|
|
193
192
|
"laser_delay_s": pump_delay,
|
|
@@ -257,7 +256,7 @@ def main_extruder_plan(
|
|
|
257
256
|
SSX_LOGGER.info("Pump probe extruder data collection")
|
|
258
257
|
SSX_LOGGER.info(f"Pump exposure time {parameters.laser_dwell_s}")
|
|
259
258
|
SSX_LOGGER.info(f"Pump delay time {parameters.laser_delay_s}")
|
|
260
|
-
sup.pilatus(
|
|
259
|
+
yield from sup.pilatus(
|
|
261
260
|
"fastchip",
|
|
262
261
|
[
|
|
263
262
|
filepath,
|
|
@@ -278,7 +277,7 @@ def main_extruder_plan(
|
|
|
278
277
|
)
|
|
279
278
|
else:
|
|
280
279
|
SSX_LOGGER.info("Static experiment: no photoexcitation")
|
|
281
|
-
sup.pilatus(
|
|
280
|
+
yield from sup.pilatus(
|
|
282
281
|
"quickshot",
|
|
283
282
|
[
|
|
284
283
|
filepath,
|
|
@@ -310,7 +309,7 @@ def main_extruder_plan(
|
|
|
310
309
|
SSX_LOGGER.info("Pump probe extruder data collection")
|
|
311
310
|
SSX_LOGGER.debug(f"Pump exposure time {parameters.laser_dwell_s}")
|
|
312
311
|
SSX_LOGGER.debug(f"Pump delay time {parameters.laser_delay_s}")
|
|
313
|
-
sup.eiger(
|
|
312
|
+
yield from sup.eiger(
|
|
314
313
|
"triggered",
|
|
315
314
|
[
|
|
316
315
|
filepath,
|
|
@@ -331,7 +330,7 @@ def main_extruder_plan(
|
|
|
331
330
|
)
|
|
332
331
|
else:
|
|
333
332
|
SSX_LOGGER.info("Static experiment: no photoexcitation")
|
|
334
|
-
sup.eiger(
|
|
333
|
+
yield from sup.eiger(
|
|
335
334
|
"quickshot",
|
|
336
335
|
[
|
|
337
336
|
filepath,
|
|
@@ -393,13 +392,15 @@ def main_extruder_plan(
|
|
|
393
392
|
timeout_time = time.time() + parameters.num_images * parameters.exposure_time_s + 10
|
|
394
393
|
|
|
395
394
|
yield from arm_zebra(zebra)
|
|
396
|
-
sleep(
|
|
395
|
+
yield from bps.sleep(
|
|
396
|
+
GATE_START
|
|
397
|
+
) # bps.sleep for the same length of gate_start, hard coded to 1
|
|
397
398
|
i = 0
|
|
398
399
|
text_list = ["|", "/", "-", "\\"]
|
|
399
400
|
while True:
|
|
400
401
|
line_of_text = "\r\t\t\t Waiting " + 30 * (f"{text_list[i % 4]}")
|
|
401
402
|
flush_print(line_of_text)
|
|
402
|
-
sleep(0.5)
|
|
403
|
+
yield from bps.sleep(0.5)
|
|
403
404
|
i += 1
|
|
404
405
|
zebra_arm_status = yield from bps.rd(zebra.pc.arm.armed)
|
|
405
406
|
if zebra_arm_status == 0: # not zebra.pc.is_armed():
|
|
@@ -429,7 +430,7 @@ def collection_aborted_plan(
|
|
|
429
430
|
caput(pv.pilat_acquire, 0)
|
|
430
431
|
elif detector_name == "eiger":
|
|
431
432
|
caput(pv.eiger_acquire, 0)
|
|
432
|
-
sleep(0.5)
|
|
433
|
+
yield from bps.sleep(0.5)
|
|
433
434
|
end_time = datetime.now()
|
|
434
435
|
dcid.collection_complete(end_time, aborted=True)
|
|
435
436
|
|
|
@@ -452,9 +453,9 @@ def tidy_up_at_collection_end_plan(
|
|
|
452
453
|
|
|
453
454
|
# Clean Up
|
|
454
455
|
if parameters.detector_name == "pilatus":
|
|
455
|
-
sup.pilatus("return-to-normal", None)
|
|
456
|
+
yield from sup.pilatus("return-to-normal", None)
|
|
456
457
|
elif parameters.detector_name == "eiger":
|
|
457
|
-
sup.eiger("return-to-normal", None)
|
|
458
|
+
yield from sup.eiger("return-to-normal", None)
|
|
458
459
|
SSX_LOGGER.debug(f"{parameters.filename}_{caget(pv.eiger_seqID)}")
|
|
459
460
|
SSX_LOGGER.debug("End of Run")
|
|
460
461
|
SSX_LOGGER.info("Close hutch shutter")
|
|
@@ -475,7 +476,7 @@ def collection_complete_plan(
|
|
|
475
476
|
caput(pv.eiger_acquire, 0)
|
|
476
477
|
caput(pv.eiger_ODcapture, "Done")
|
|
477
478
|
|
|
478
|
-
sleep(0.5)
|
|
479
|
+
yield from bps.sleep(0.5)
|
|
479
480
|
|
|
480
481
|
end_time = datetime.now()
|
|
481
482
|
dcid.collection_complete(end_time, aborted=False)
|