mx-bluesky 1.4.6__py3-none-any.whl → 1.4.8__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 (95) hide show
  1. mx_bluesky/_version.py +2 -2
  2. mx_bluesky/beamlines/aithre_lasershaping/__init__.py +13 -0
  3. mx_bluesky/beamlines/aithre_lasershaping/check_goniometer_performance.py +29 -0
  4. mx_bluesky/beamlines/aithre_lasershaping/goniometer_controls.py +18 -0
  5. mx_bluesky/beamlines/i04/redis_to_murko_forwarder.py +35 -29
  6. mx_bluesky/beamlines/i04/thawing_plan.py +18 -3
  7. mx_bluesky/beamlines/i23/__init__.py +3 -0
  8. mx_bluesky/beamlines/i23/serial.py +71 -0
  9. mx_bluesky/beamlines/i24/serial/__init__.py +2 -0
  10. mx_bluesky/beamlines/i24/serial/extruder/EX-gui-edm/DiamondExtruder-I24-py3v1.edl +12 -12
  11. mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +36 -30
  12. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/pumpprobe-py3v1.edl +3 -3
  13. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +15 -66
  14. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +8 -10
  15. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py +10 -3
  16. mx_bluesky/beamlines/i24/serial/log.py +9 -9
  17. mx_bluesky/beamlines/i24/serial/parameters/utils.py +36 -7
  18. mx_bluesky/beamlines/i24/serial/set_visit_directory.sh +1 -1
  19. mx_bluesky/beamlines/i24/serial/setup_beamline/pv.py +16 -17
  20. mx_bluesky/beamlines/i24/serial/setup_beamline/pv_abstract.py +4 -4
  21. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +51 -52
  22. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +3 -2
  23. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +9 -7
  24. mx_bluesky/beamlines/i24/serial/web_gui_plans/general_plans.py +71 -11
  25. mx_bluesky/beamlines/i24/serial/write_nexus.py +6 -5
  26. mx_bluesky/{hyperion → common}/device_setup_plans/check_beamstop.py +1 -1
  27. mx_bluesky/{hyperion → common}/device_setup_plans/manipulate_sample.py +1 -1
  28. mx_bluesky/{hyperion → common}/device_setup_plans/setup_oav.py +12 -6
  29. mx_bluesky/common/device_setup_plans/xbpm_feedback.py +45 -0
  30. mx_bluesky/{hyperion → common}/experiment_plans/change_aperture_then_move_plan.py +13 -29
  31. mx_bluesky/{hyperion → common}/experiment_plans/oav_grid_detection_plan.py +6 -6
  32. mx_bluesky/common/external_interaction/callbacks/common/ispyb_callback_base.py +8 -9
  33. mx_bluesky/common/external_interaction/callbacks/common/ispyb_mapping.py +1 -1
  34. mx_bluesky/common/external_interaction/callbacks/common/zocalo_callback.py +18 -15
  35. mx_bluesky/{hyperion → common}/external_interaction/callbacks/sample_handling/sample_handling_callback.py +16 -4
  36. mx_bluesky/common/external_interaction/callbacks/xray_centre/ispyb_callback.py +50 -45
  37. mx_bluesky/common/external_interaction/callbacks/xray_centre/nexus_callback.py +2 -1
  38. mx_bluesky/common/external_interaction/ispyb/data_model.py +1 -0
  39. mx_bluesky/common/external_interaction/ispyb/ispyb_store.py +18 -2
  40. mx_bluesky/common/external_interaction/ispyb/ispyb_utils.py +4 -4
  41. mx_bluesky/common/external_interaction/nexus/nexus_utils.py +1 -1
  42. mx_bluesky/common/parameters/components.py +22 -2
  43. mx_bluesky/common/parameters/constants.py +6 -16
  44. mx_bluesky/common/parameters/gridscan.py +36 -32
  45. mx_bluesky/common/plans/common_flyscan_xray_centre_plan.py +316 -0
  46. mx_bluesky/common/plans/inner_plans/__init__ .py +0 -0
  47. mx_bluesky/common/plans/read_hardware.py +3 -3
  48. mx_bluesky/common/plans/write_sample_status.py +46 -0
  49. mx_bluesky/common/preprocessors/__init__.py +0 -0
  50. mx_bluesky/common/preprocessors/preprocessors.py +105 -0
  51. mx_bluesky/common/protocols/__init__.py +0 -0
  52. mx_bluesky/common/protocols/protocols.py +10 -0
  53. mx_bluesky/common/utils/log.py +15 -12
  54. mx_bluesky/hyperion/__main__.py +5 -24
  55. mx_bluesky/hyperion/baton_handler.py +84 -0
  56. mx_bluesky/hyperion/device_setup_plans/dcm_pitch_roll_mirror_adjuster.py +4 -4
  57. mx_bluesky/hyperion/device_setup_plans/setup_panda.py +5 -1
  58. mx_bluesky/hyperion/device_setup_plans/setup_zebra.py +0 -33
  59. mx_bluesky/hyperion/device_setup_plans/utils.py +4 -4
  60. mx_bluesky/hyperion/experiment_plans/__init__.py +0 -10
  61. mx_bluesky/hyperion/experiment_plans/experiment_registry.py +0 -16
  62. mx_bluesky/hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py +71 -88
  63. mx_bluesky/hyperion/experiment_plans/hyperion_flyscan_xray_centre_plan.py +183 -0
  64. mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +17 -8
  65. mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +29 -8
  66. mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +4 -4
  67. mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +6 -4
  68. mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +11 -3
  69. mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +9 -34
  70. mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +35 -68
  71. mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +27 -8
  72. mx_bluesky/hyperion/external_interaction/agamemnon.py +140 -10
  73. mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +17 -9
  74. mx_bluesky/hyperion/external_interaction/callbacks/snapshot_callback.py +259 -0
  75. mx_bluesky/hyperion/parameters/cli.py +2 -10
  76. mx_bluesky/hyperion/parameters/constants.py +0 -5
  77. mx_bluesky/hyperion/parameters/device_composites.py +40 -5
  78. mx_bluesky/hyperion/parameters/gridscan.py +9 -58
  79. mx_bluesky/hyperion/parameters/rotation.py +1 -5
  80. mx_bluesky/hyperion/utils/context.py +2 -5
  81. mx_bluesky/hyperion/utils/validation.py +13 -10
  82. {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info}/METADATA +10 -9
  83. {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info}/RECORD +92 -79
  84. {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info}/WHEEL +1 -1
  85. mx_bluesky/common/external_interaction/callbacks/common/aperture_change_callback.py +0 -22
  86. mx_bluesky/hyperion/device_setup_plans/xbpm_feedback.py +0 -103
  87. mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py +0 -466
  88. /mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/{short1-laser.png → s1l.png} +0 -0
  89. /mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/{short2-laser.png → s2l.png} +0 -0
  90. /mx_bluesky/{hyperion → common}/device_setup_plans/position_detector.py +0 -0
  91. /mx_bluesky/{hyperion → common}/external_interaction/callbacks/sample_handling/__init__.py +0 -0
  92. /mx_bluesky/common/plans/{do_fgs.py → inner_plans/do_fgs.py} +0 -0
  93. {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info}/entry_points.txt +0 -0
  94. {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info/licenses}/LICENSE +0 -0
  95. {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info}/top_level.txt +0 -0
mx_bluesky/_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '1.4.6'
21
- __version_tuple__ = version_tuple = (1, 4, 6)
20
+ __version__ = version = '1.4.8'
21
+ __version_tuple__ = version_tuple = (1, 4, 8)
@@ -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,11 +1,12 @@
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
7
8
  import zmq
8
- from dodal.beamlines.i04 import MURKO_REDIS_DB, REDIS_HOST, REDIS_PASSWORD
9
+ from dodal.devices.i04.constants import RedisConstants
9
10
  from numpy.typing import NDArray
10
11
  from PIL import Image
11
12
  from redis import StrictRedis
@@ -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) -> dict:
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 correlate_results_to_uuids(request: MurkoRequest, murko_results: dict) -> list:
45
- results = []
46
- uuids = request["prefix"]
47
-
48
- width, height = get_image_size(request["to_predict"][0])
49
-
50
- for uuid, prediction in zip(uuids, murko_results["descriptions"], strict=False):
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
- predictions = send_to_murko_and_get_results(request_arguments)
98
- results = correlate_results_to_uuids(request_arguments, predictions)
99
- self._send_murko_results_to_redis(sample_id, results)
100
-
101
- def _send_murko_results_to_redis(self, sample_id: str, results: list):
102
- for result in results:
103
- self.redis_client.hset(
104
- f"murko:{sample_id}:results", result["uuid"], json.dumps(result)
105
- )
106
- self.redis_client.publish("murko-results", json.dumps(results))
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."""
@@ -133,9 +139,9 @@ class RedisListener:
133
139
 
134
140
  def __init__(
135
141
  self,
136
- redis_host=REDIS_HOST,
137
- redis_password=REDIS_PASSWORD,
138
- db=MURKO_REDIS_DB,
142
+ redis_host=RedisConstants.REDIS_HOST,
143
+ redis_password=RedisConstants.REDIS_PASSWORD,
144
+ db=RedisConstants.MURKO_REDIS_DB,
139
145
  redis_channel="murko",
140
146
  ):
141
147
  self.redis_client = StrictRedis(
@@ -4,8 +4,8 @@ import bluesky.plan_stubs as bps
4
4
  import bluesky.preprocessors as bpp
5
5
  from bluesky.preprocessors import run_decorator, subs_decorator
6
6
  from bluesky.utils import MsgGenerator
7
- from dodal.beamlines.i04 import MURKO_REDIS_DB, REDIS_HOST, REDIS_PASSWORD
8
7
  from dodal.common import inject
8
+ from dodal.devices.i04.constants import RedisConstants
9
9
  from dodal.devices.oav.oav_detector import OAV
10
10
  from dodal.devices.oav.oav_to_redis_forwarder import OAVToRedisForwarder, Source
11
11
  from dodal.devices.robot import BartRobot
@@ -42,7 +42,13 @@ def thaw_and_stream_to_redis(
42
42
  beam_centre_i = yield from bps.rd(oav.beam_centre_i)
43
43
  beam_centre_j = yield from bps.rd(oav.beam_centre_j)
44
44
 
45
- @subs_decorator(MurkoCallback(REDIS_HOST, REDIS_PASSWORD, MURKO_REDIS_DB))
45
+ @subs_decorator(
46
+ MurkoCallback(
47
+ RedisConstants.REDIS_HOST,
48
+ RedisConstants.REDIS_PASSWORD,
49
+ RedisConstants.MURKO_REDIS_DB,
50
+ )
51
+ )
46
52
  @run_decorator(
47
53
  md={
48
54
  "microns_per_x_pixel": microns_per_pixel_x,
@@ -64,7 +70,7 @@ def thaw_and_stream_to_redis(
64
70
  yield from bps.kickoff(oav_to_redis_forwarder, wait=True)
65
71
  yield from bps.monitor(smargon.omega.user_readback, name="smargon")
66
72
  yield from bps.monitor(oav_to_redis_forwarder.uuid, name="oav")
67
- yield from thaw(
73
+ yield from _thaw(
68
74
  time_to_thaw, rotation, thawer, smargon, switch_forwarder_to_ROI
69
75
  )
70
76
  yield from bps.complete(oav_to_redis_forwarder)
@@ -83,6 +89,15 @@ def thaw(
83
89
  rotation: float = 360,
84
90
  thawer: Thawer = inject("thawer"),
85
91
  smargon: Smargon = inject("smargon"),
92
+ ) -> MsgGenerator:
93
+ yield from _thaw(time_to_thaw, rotation, thawer, smargon)
94
+
95
+
96
+ def _thaw(
97
+ time_to_thaw: float,
98
+ rotation: float = 360,
99
+ thawer: Thawer = inject("thawer"),
100
+ smargon: Smargon = inject("smargon"),
86
101
  plan_between_rotations: Callable[[], MsgGenerator] | None = None,
87
102
  ) -> MsgGenerator:
88
103
  """Rotates the sample and thaws it at the same time.
@@ -0,0 +1,3 @@
1
+ from mx_bluesky.beamlines.i23.serial import serial_collection
2
+
3
+ __all__ = ["serial_collection"]
@@ -0,0 +1,71 @@
1
+ from functools import partial
2
+
3
+ from bluesky import plan_stubs as bps
4
+ from bluesky.plans import rel_grid_scan
5
+ from bluesky.utils import short_uid
6
+ from dodal.beamlines.i23 import I23DetectorPositions
7
+ from dodal.common import inject
8
+ from dodal.devices.motors import SixAxisGonio
9
+ from dodal.devices.positioner import Positioner1D
10
+ from ophyd_async.epics.motor import Motor
11
+
12
+
13
+ def set_axis_to_max_velocity(axis: Motor):
14
+ max_vel = yield from bps.rd(axis.max_velocity)
15
+ yield from bps.mv(axis.velocity, max_vel)
16
+
17
+
18
+ def one_nd_step(
19
+ detectors,
20
+ step,
21
+ pos_cache,
22
+ omega_axis: Motor,
23
+ omega_rotation: float,
24
+ omega_velocity: float,
25
+ ):
26
+ def move():
27
+ yield from bps.checkpoint()
28
+ grp = short_uid("set")
29
+ for motor, pos in step.items():
30
+ yield from bps.abs_set(motor, pos, group=grp)
31
+ yield from set_axis_to_max_velocity(omega_axis)
32
+ yield from bps.abs_set(omega_axis, 0, group=grp)
33
+ yield from bps.wait(group=grp)
34
+
35
+ yield from move()
36
+ yield from bps.mv(omega_axis.velocity, omega_velocity)
37
+ yield from bps.mv(omega_axis, omega_rotation)
38
+
39
+
40
+ def serial_collection(
41
+ x_steps: int,
42
+ y_steps: int,
43
+ x_step_size: float,
44
+ y_step_size: float,
45
+ omega_rotation: float,
46
+ omega_velocity: float,
47
+ detector_motion: Positioner1D = inject("detector_motion"),
48
+ gonio: SixAxisGonio = inject("gonio"),
49
+ ):
50
+ """This plan runs a software controlled serial collection. i.e it moves in a snaked
51
+ grid and does a small rotation collection at each point."""
52
+
53
+ yield from bps.mv(detector_motion.stage_position, I23DetectorPositions.IN)
54
+ yield from rel_grid_scan(
55
+ [],
56
+ gonio.y,
57
+ 0,
58
+ y_step_size * (y_steps - 1),
59
+ y_steps,
60
+ gonio.x,
61
+ 0,
62
+ x_step_size * (x_steps - 1),
63
+ x_steps,
64
+ per_step=partial( # type: ignore
65
+ one_nd_step,
66
+ omega_axis=gonio.omega,
67
+ omega_rotation=omega_rotation,
68
+ omega_velocity=omega_velocity,
69
+ ),
70
+ snake_axes=True,
71
+ )
@@ -1,5 +1,6 @@
1
1
  from mx_bluesky.beamlines.i24.serial.web_gui_plans.general_plans import (
2
2
  gui_gonio_move_on_click,
3
+ gui_move_backlight,
3
4
  gui_move_detector,
4
5
  gui_set_parameters,
5
6
  gui_sleep,
@@ -57,4 +58,5 @@ __all__ = [
57
58
  "gui_sleep",
58
59
  "gui_move_detector",
59
60
  "gui_set_parameters",
61
+ "gui_move_backlight",
60
62
  ]
@@ -34,8 +34,8 @@ h 308
34
34
  lineColor index 26
35
35
  fill
36
36
  fillColor index 25
37
- alarmPv "BL24I-EA-IOC-12:GP6"
38
- visPv "BL24I-EA-IOC-12:GP6"
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-EA-IOC-12:GP9"
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-EA-IOC-12:GP10"
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-EA-IOC-12:GP2"
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-EA-IOC-12:GP3"
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-EA-IOC-12:GP4"
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-EA-IOC-12:GP5"
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-EA-IOC-12:GP7"
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-EA-IOC-12:GP1"
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-EA-IOC-12:GP15"
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-EA-IOC-12:GP6"
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.ioc12_gp1)
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.ioc12_gp2, "test")
81
- caput(pv.ioc12_gp3, "testrun")
82
- caput(pv.ioc12_gp4, "100")
83
- caput(pv.ioc12_gp5, "0.01")
84
- caput(pv.ioc12_gp6, 0)
85
- caput(pv.ioc12_gp8, 0) # status PV do not reuse gp8 for something else
86
- caput(pv.ioc12_gp9, 0)
87
- caput(pv.ioc12_gp10, 0)
88
- caput(pv.ioc12_gp15, det_type.name)
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()
@@ -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.ioc12_gp3)
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.ioc12_gp6)))
179
- pump_exp = float(caget(pv.ioc12_gp9)) if pump_status else 0.0
180
- pump_delay = float(caget(pv.ioc12_gp10)) if pump_status else 0.0
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.ioc12_gp2),
183
+ "directory": caget(pv.ioc13_gp2),
185
184
  "filename": filename,
186
- "exposure_time_s": float(caget(pv.ioc12_gp5)),
187
- "detector_distance_mm": float(caget(pv.ioc12_gp7)),
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.ioc12_gp4)),
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,
@@ -318,6 +317,7 @@ def main_extruder_plan(
318
317
  parameters.num_images,
319
318
  parameters.exposure_time_s,
320
319
  ],
320
+ dcm,
321
321
  )
322
322
  yield from setup_zebra_for_extruder_with_pump_probe_plan(
323
323
  zebra,
@@ -331,7 +331,7 @@ def main_extruder_plan(
331
331
  )
332
332
  else:
333
333
  SSX_LOGGER.info("Static experiment: no photoexcitation")
334
- sup.eiger(
334
+ yield from sup.eiger(
335
335
  "quickshot",
336
336
  [
337
337
  filepath,
@@ -339,6 +339,7 @@ def main_extruder_plan(
339
339
  parameters.num_images,
340
340
  parameters.exposure_time_s,
341
341
  ],
342
+ dcm,
342
343
  )
343
344
  yield from setup_zebra_for_quickshot_plan(
344
345
  zebra, parameters.exposure_time_s, parameters.num_images, wait=True
@@ -393,13 +394,15 @@ def main_extruder_plan(
393
394
  timeout_time = time.time() + parameters.num_images * parameters.exposure_time_s + 10
394
395
 
395
396
  yield from arm_zebra(zebra)
396
- sleep(GATE_START) # Sleep for the same length of gate_start, hard coded to 1
397
+ yield from bps.sleep(
398
+ GATE_START
399
+ ) # bps.sleep for the same length of gate_start, hard coded to 1
397
400
  i = 0
398
401
  text_list = ["|", "/", "-", "\\"]
399
402
  while True:
400
403
  line_of_text = "\r\t\t\t Waiting " + 30 * (f"{text_list[i % 4]}")
401
404
  flush_print(line_of_text)
402
- sleep(0.5)
405
+ yield from bps.sleep(0.5)
403
406
  i += 1
404
407
  zebra_arm_status = yield from bps.rd(zebra.pc.arm.armed)
405
408
  if zebra_arm_status == 0: # not zebra.pc.is_armed():
@@ -429,7 +432,7 @@ def collection_aborted_plan(
429
432
  caput(pv.pilat_acquire, 0)
430
433
  elif detector_name == "eiger":
431
434
  caput(pv.eiger_acquire, 0)
432
- sleep(0.5)
435
+ yield from bps.sleep(0.5)
433
436
  end_time = datetime.now()
434
437
  dcid.collection_complete(end_time, aborted=True)
435
438
 
@@ -440,6 +443,7 @@ def tidy_up_at_collection_end_plan(
440
443
  shutter: HutchShutter,
441
444
  parameters: ExtruderParameters,
442
445
  dcid: DCID,
446
+ dcm: DCM,
443
447
  ) -> MsgGenerator:
444
448
  """A plan to tidy up at the end of a collection, successful or aborted.
445
449
 
@@ -452,9 +456,9 @@ def tidy_up_at_collection_end_plan(
452
456
 
453
457
  # Clean Up
454
458
  if parameters.detector_name == "pilatus":
455
- sup.pilatus("return-to-normal", None)
459
+ yield from sup.pilatus("return-to-normal", None)
456
460
  elif parameters.detector_name == "eiger":
457
- sup.eiger("return-to-normal", None)
461
+ yield from sup.eiger("return-to-normal", None, dcm)
458
462
  SSX_LOGGER.debug(f"{parameters.filename}_{caget(pv.eiger_seqID)}")
459
463
  SSX_LOGGER.debug("End of Run")
460
464
  SSX_LOGGER.info("Close hutch shutter")
@@ -475,7 +479,7 @@ def collection_complete_plan(
475
479
  caput(pv.eiger_acquire, 0)
476
480
  caput(pv.eiger_ODcapture, "Done")
477
481
 
478
- sleep(0.5)
482
+ yield from bps.sleep(0.5)
479
483
 
480
484
  end_time = datetime.now()
481
485
  dcid.collection_complete(end_time, aborted=False)
@@ -533,7 +537,9 @@ def run_extruder_plan(
533
537
  )
534
538
  ),
535
539
  final_plan=lambda: (
536
- yield from tidy_up_at_collection_end_plan(zebra, shutter, parameters, dcid)
540
+ yield from tidy_up_at_collection_end_plan(
541
+ zebra, shutter, parameters, dcid, dcm
542
+ )
537
543
  ),
538
544
  auto_raise=False,
539
545
  )
@@ -1521,7 +1521,7 @@ x 275
1521
1521
  y 111
1522
1522
  w 175
1523
1523
  h 139
1524
- file "SCRIPTS_LOCATION/fixed_target/FT-gui-edm/short1-laser.png"
1524
+ file "SCRIPTS_LOCATION/fixed_target/FT-gui-edm/s1l.png"
1525
1525
  endObjectProperties
1526
1526
 
1527
1527
  # (PNG Image)
@@ -1534,7 +1534,7 @@ x 486
1534
1534
  y 111
1535
1535
  w 172
1536
1536
  h 139
1537
- file "SCRIPTS_LOCATION/fixed_target/FT-gui-edm/short2-laser.png"
1537
+ file "SCRIPTS_LOCATION/fixed_target/FT-gui-edm/s2l.png"
1538
1538
  endObjectProperties
1539
1539
 
1540
1540
  # (Static Text)
@@ -1600,7 +1600,7 @@ x 695
1600
1600
  y 111
1601
1601
  w 175
1602
1602
  h 139
1603
- file "SCRIPTS_LOCATION/fixed_target/FT-gui-edm/short1-laser.png"
1603
+ file "SCRIPTS_LOCATION/fixed_target/FT-gui-edm/s1l.png"
1604
1604
  endObjectProperties
1605
1605
 
1606
1606
  # (Static Text)