mx-bluesky 1.5.11__py3-none-any.whl → 1.5.14__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 (92) hide show
  1. mx_bluesky/Getting started.ipynb +170 -0
  2. mx_bluesky/_version.py +2 -2
  3. mx_bluesky/beamlines/aithre_lasershaping/experiment_plans/__init__.py +0 -0
  4. mx_bluesky/beamlines/aithre_lasershaping/experiment_plans/robot_load_plan.py +198 -0
  5. mx_bluesky/beamlines/aithre_lasershaping/parameters/__init__.py +0 -0
  6. mx_bluesky/beamlines/aithre_lasershaping/parameters/constants.py +17 -0
  7. mx_bluesky/beamlines/aithre_lasershaping/parameters/robot_load_parameters.py +13 -0
  8. mx_bluesky/beamlines/aithre_lasershaping/pin_tip_centring.py +31 -0
  9. mx_bluesky/beamlines/aithre_lasershaping/robot_load.py +74 -0
  10. mx_bluesky/beamlines/i04/__init__.py +6 -2
  11. mx_bluesky/beamlines/i04/callbacks/murko_callback.py +27 -12
  12. mx_bluesky/beamlines/i04/experiment_plans/i04_grid_detect_then_xray_centre_plan.py +88 -13
  13. mx_bluesky/beamlines/i04/external_interaction/__init__.py +0 -0
  14. mx_bluesky/beamlines/i04/external_interaction/config_server.py +15 -0
  15. mx_bluesky/beamlines/i04/oav_centering_plans/__init__.py +0 -0
  16. mx_bluesky/beamlines/i04/oav_centering_plans/oav_imaging.py +115 -0
  17. mx_bluesky/beamlines/i04/parameters/__init__.py +0 -0
  18. mx_bluesky/beamlines/i04/parameters/constants.py +21 -0
  19. mx_bluesky/beamlines/i04/redis_to_murko_forwarder.py +24 -1
  20. mx_bluesky/beamlines/i04/thawing_plan.py +147 -152
  21. mx_bluesky/beamlines/i24/serial/dcid.py +4 -5
  22. mx_bluesky/beamlines/i24/serial/extruder/i24ssx_extruder_collect_py3v2.py +5 -2
  23. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/CustomChip_py3v1.edl +11 -11
  24. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/DetStage.edl +3 -3
  25. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/DiamondChipI24-py3v1.edl +142 -142
  26. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/MappingLite-oxford_py3v1.edl +135 -135
  27. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/PMAC_Command.edl +8 -8
  28. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/pumpprobe-py3v1.edl +13 -13
  29. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_chip_collect_py3v1.py +7 -4
  30. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_chip_manager_py3v1.py +35 -32
  31. mx_bluesky/beamlines/i24/serial/parameters/utils.py +5 -5
  32. mx_bluesky/beamlines/i24/serial/setup_beamline/pv.py +113 -306
  33. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +8 -2
  34. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +1 -1
  35. mx_bluesky/beamlines/i24/serial/web_gui_plans/general_plans.py +6 -6
  36. mx_bluesky/beamlines/i24/serial/web_gui_plans/oav_plans.py +64 -0
  37. mx_bluesky/{hyperion/device_setup_plans/smargon.py → common/device_setup_plans/gonio.py} +9 -6
  38. mx_bluesky/common/device_setup_plans/manipulate_sample.py +8 -1
  39. mx_bluesky/common/device_setup_plans/robot_load_unload.py +1 -1
  40. mx_bluesky/common/device_setup_plans/setup_oav.py +8 -0
  41. mx_bluesky/common/device_setup_plans/setup_zebra_and_shutter.py +0 -5
  42. mx_bluesky/common/device_setup_plans/xbpm_feedback.py +8 -1
  43. mx_bluesky/common/experiment_plans/beamstop_check.py +229 -0
  44. mx_bluesky/common/experiment_plans/common_flyscan_xray_centre_plan.py +2 -0
  45. mx_bluesky/common/experiment_plans/inner_plans/read_hardware.py +5 -2
  46. mx_bluesky/common/experiment_plans/oav_snapshot_plan.py +0 -1
  47. mx_bluesky/{hyperion → common}/experiment_plans/pin_tip_centring_plan.py +20 -21
  48. mx_bluesky/common/external_interaction/callbacks/common/grid_detection_callback.py +5 -0
  49. mx_bluesky/common/external_interaction/callbacks/common/ispyb_callback_base.py +10 -12
  50. mx_bluesky/common/external_interaction/callbacks/common/ispyb_mapping.py +3 -5
  51. mx_bluesky/common/external_interaction/callbacks/xray_centre/ispyb_callback.py +5 -5
  52. mx_bluesky/common/external_interaction/config_server.py +2 -2
  53. mx_bluesky/common/external_interaction/ispyb/data_model.py +11 -4
  54. mx_bluesky/common/external_interaction/ispyb/exp_eye_store.py +159 -2
  55. mx_bluesky/common/external_interaction/ispyb/ispyb_store.py +76 -166
  56. mx_bluesky/common/external_interaction/ispyb/ispyb_utils.py +0 -14
  57. mx_bluesky/common/parameters/components.py +1 -0
  58. mx_bluesky/common/parameters/constants.py +5 -2
  59. mx_bluesky/common/parameters/device_composites.py +4 -2
  60. mx_bluesky/common/utils/exceptions.py +15 -0
  61. mx_bluesky/common/utils/log.py +9 -0
  62. mx_bluesky/common/utils/utils.py +48 -0
  63. mx_bluesky/hyperion/__main__.py +3 -13
  64. mx_bluesky/hyperion/baton_handler.py +23 -6
  65. mx_bluesky/hyperion/experiment_plans/hyperion_flyscan_xray_centre_plan.py +1 -0
  66. mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +5 -6
  67. mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +3 -10
  68. mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +4 -2
  69. mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +8 -2
  70. mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +2 -2
  71. mx_bluesky/hyperion/experiment_plans/udc_default_state.py +166 -0
  72. mx_bluesky/hyperion/external_interaction/agamemnon.py +1 -1
  73. mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +48 -21
  74. mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_callback.py +2 -2
  75. mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_mapping.py +1 -0
  76. mx_bluesky/hyperion/external_interaction/callbacks/rotation/nexus_callback.py +1 -4
  77. mx_bluesky/hyperion/external_interaction/config_server.py +5 -5
  78. mx_bluesky/hyperion/parameters/constants.py +10 -3
  79. mx_bluesky/hyperion/parameters/device_composites.py +4 -2
  80. mx_bluesky/hyperion/parameters/robot_load.py +1 -9
  81. mx_bluesky/hyperion/plan_runner.py +31 -0
  82. mx_bluesky/hyperion/plan_runner_api.py +14 -1
  83. mx_bluesky/hyperion/utils/context.py +2 -2
  84. mx_bluesky/jupyter_example.ipynb +9 -1
  85. {mx_bluesky-1.5.11.dist-info → mx_bluesky-1.5.14.dist-info}/METADATA +7 -6
  86. {mx_bluesky-1.5.11.dist-info → mx_bluesky-1.5.14.dist-info}/RECORD +90 -75
  87. mx_bluesky/common/experiment_plans/inner_plans/udc_default_state.py +0 -86
  88. mx_bluesky/common/external_interaction/callbacks/common/logging_callback.py +0 -29
  89. {mx_bluesky-1.5.11.dist-info → mx_bluesky-1.5.14.dist-info}/WHEEL +0 -0
  90. {mx_bluesky-1.5.11.dist-info → mx_bluesky-1.5.14.dist-info}/entry_points.txt +0 -0
  91. {mx_bluesky-1.5.11.dist-info → mx_bluesky-1.5.14.dist-info}/licenses/LICENSE +0 -0
  92. {mx_bluesky-1.5.11.dist-info → mx_bluesky-1.5.14.dist-info}/top_level.txt +0 -0
@@ -1,18 +1,15 @@
1
- from collections.abc import Callable
2
- from functools import partial
3
-
4
1
  import bluesky.plan_stubs as bps
5
2
  import bluesky.preprocessors as bpp
6
- from bluesky.preprocessors import run_decorator, subs_decorator
3
+ from bluesky.preprocessors import contingency_decorator, run_decorator, subs_decorator
7
4
  from bluesky.utils import MsgGenerator
8
5
  from dodal.common import inject
9
6
  from dodal.devices.i04.constants import RedisConstants
10
7
  from dodal.devices.i04.murko_results import MurkoResultsDevice
11
- from dodal.devices.oav.oav_detector import OAV
12
8
  from dodal.devices.oav.oav_to_redis_forwarder import OAVToRedisForwarder, Source
13
9
  from dodal.devices.robot import BartRobot
14
10
  from dodal.devices.smargon import Smargon
15
11
  from dodal.devices.thawer import OnOff, Thawer
12
+ from dodal.log import LOGGER
16
13
 
17
14
  from mx_bluesky.beamlines.i04.callbacks.murko_callback import MurkoCallback
18
15
 
@@ -29,53 +26,26 @@ def thaw(
29
26
 
30
27
  Args:
31
28
  time_to_thaw (float): Time to thaw for, in seconds.
32
- rotation (float, optional): How much to rotate by whilst thawing, in degrees.
33
- Defaults to 360.
34
- ... devices: These are the specific ophyd-devices used for the plan, the
35
- defaults are always correct.
29
+ rotation (float): How much to rotate by whilst thawing, in degrees.
30
+ thawer (Thawer): The thawing device.
31
+ smargon (Smargon): The smargon used to rotate.
36
32
  """
37
- yield from _thaw(time_to_thaw, rotation, thawer, smargon)
38
-
39
-
40
- def thaw_and_stream_to_redis(
41
- time_to_thaw: float,
42
- rotation: float = 360,
43
- robot: BartRobot = inject("robot"),
44
- thawer: Thawer = inject("thawer"),
45
- smargon: Smargon = inject("smargon"),
46
- oav: OAV = inject("oav_full_screen"),
47
- oav_to_redis_forwarder: OAVToRedisForwarder = inject("oav_to_redis_forwarder"),
48
- ) -> MsgGenerator:
49
- """Turns on the thawer and rotates the sample by {rotation} degrees to thaw it, then
50
- rotates {rotation} degrees back and turns the thawer off. The speed of the goniometer
51
- is set such that the process takes whole process will take {time_to_thaw} time.
33
+ initial_velocity = yield from bps.rd(smargon.omega.velocity)
34
+ new_velocity = abs(rotation / time_to_thaw) * 2.0
52
35
 
53
- At the same time streams OAV images to redis for later processing (e.g. by murko).
54
- On the first rotation the images from the large ROI are streamed, on the second the
55
- smaller ROI is used.
36
+ def do_thaw():
37
+ yield from bps.abs_set(smargon.omega.velocity, new_velocity, wait=True)
38
+ yield from bps.abs_set(thawer, OnOff.ON, wait=True)
39
+ yield from bps.rel_set(smargon.omega, rotation, wait=True)
40
+ yield from bps.rel_set(smargon.omega, -rotation, wait=True)
56
41
 
57
- Args:
58
- time_to_thaw (float): Time to thaw for, in seconds.
59
- rotation (float, optional): How much to rotate by whilst thawing, in degrees.
60
- Defaults to 360.
61
- ... devices: These are the specific ophyd-devices used for the plan, the
62
- defaults are always correct
63
- """
42
+ def cleanup():
43
+ yield from bps.abs_set(smargon.omega.velocity, initial_velocity, wait=True)
44
+ yield from bps.abs_set(thawer, OnOff.OFF, wait=True)
64
45
 
65
- def switch_forwarder_to_roi() -> MsgGenerator:
66
- yield from bps.complete(oav_to_redis_forwarder, wait=True)
67
- yield from bps.mv(oav_to_redis_forwarder.selected_source, Source.ROI.value)
68
- yield from bps.kickoff(oav_to_redis_forwarder, wait=True)
69
-
70
- yield from _thaw_and_stream_to_redis(
71
- time_to_thaw,
72
- rotation,
73
- robot,
74
- thawer,
75
- smargon,
76
- oav,
77
- oav_to_redis_forwarder,
78
- switch_forwarder_to_roi,
46
+ yield from bpp.contingency_wrapper(
47
+ do_thaw(),
48
+ final_plan=cleanup,
79
49
  )
80
50
 
81
51
 
@@ -85,14 +55,13 @@ def thaw_and_murko_centre(
85
55
  robot: BartRobot = inject("robot"),
86
56
  thawer: Thawer = inject("thawer"),
87
57
  smargon: Smargon = inject("smargon"),
88
- oav: OAV = inject("oav_full_screen"),
89
58
  murko_results: MurkoResultsDevice = inject("murko_results"),
90
59
  oav_to_redis_forwarder: OAVToRedisForwarder = inject("oav_to_redis_forwarder"),
91
60
  ) -> MsgGenerator:
92
61
  """Thaws the sample and centres it using murko by:
93
62
  1. Turns on the thawer
94
63
  2. Rotates the sample by {rotation} degrees, whilst this is happening images from
95
- the large ROI of the OAV are being fed to murko
64
+ the full screen OAV are being fed to murko
96
65
  3. After the rotation has completed moves to the average centre returned by murko
97
66
  from these images
98
67
  4. Rotate {rotation} degrees back to the start, whilst this is happening images
@@ -109,147 +78,173 @@ def thaw_and_murko_centre(
109
78
  ... devices: These are the specific ophyd-devices used for the plan, the
110
79
  defaults are always correct
111
80
  """
112
-
113
81
  murko_results_group = "get_results"
114
82
 
115
- def centre_then_switch_forwarder_to_roi() -> MsgGenerator:
116
- yield from bps.complete(oav_to_redis_forwarder, wait=True)
83
+ sample_id = yield from bps.rd(robot.sample_id)
84
+ sample_id = int(sample_id)
117
85
 
118
- yield from bps.mv(oav_to_redis_forwarder.selected_source, Source.ROI.value)
86
+ oav_fs = oav_to_redis_forwarder.sources[Source.FULL_SCREEN].oav_ref()
119
87
 
88
+ initial_zoom_level = yield from bps.rd(oav_fs.zoom_controller.level)
89
+ initial_velocity = yield from bps.rd(smargon.omega.velocity)
90
+ new_velocity = abs(rotation / time_to_thaw) * 2.0
91
+ murko_callback = MurkoCallback(
92
+ RedisConstants.REDIS_HOST,
93
+ RedisConstants.REDIS_PASSWORD,
94
+ RedisConstants.MURKO_REDIS_DB,
95
+ )
96
+
97
+ def cleanup():
98
+ yield from bps.mv(oav_fs.zoom_controller.level, initial_zoom_level)
99
+ yield from bps.abs_set(smargon.omega.velocity, initial_velocity, wait=True)
100
+ yield from bps.abs_set(thawer, OnOff.OFF, wait=True)
101
+
102
+ def centre_from_murko():
120
103
  yield from bps.wait(murko_results_group)
104
+
121
105
  x_predict = yield from bps.rd(murko_results.x_mm)
122
106
  y_predict = yield from bps.rd(murko_results.y_mm)
123
107
  z_predict = yield from bps.rd(murko_results.z_mm)
124
108
 
109
+ LOGGER.info(f"Got results: {x_predict, y_predict, z_predict}")
110
+
125
111
  yield from bps.rel_set(smargon.x, x_predict)
126
112
  yield from bps.rel_set(smargon.y, y_predict)
127
113
  yield from bps.rel_set(smargon.z, z_predict)
128
114
 
129
- yield from bps.kickoff(oav_to_redis_forwarder, wait=True)
115
+ @subs_decorator(murko_callback)
116
+ @contingency_decorator(final_plan=cleanup)
117
+ def do_thaw_and_murko_centre():
118
+ yield from bps.mv(
119
+ murko_results.sample_id,
120
+ str(sample_id),
121
+ oav_to_redis_forwarder.sample_id,
122
+ sample_id,
123
+ oav_fs.zoom_controller.level,
124
+ "1.0x",
125
+ )
126
+ yield from bps.abs_set(smargon.omega.velocity, new_velocity, wait=True)
127
+ yield from bps.abs_set(thawer, OnOff.ON, wait=True)
130
128
 
131
- sample_id = yield from bps.rd(robot.sample_id)
132
- yield from bps.mv(murko_results.sample_id, str(sample_id))
129
+ def rotate_in_one_direction_then_murko_centre(
130
+ rotation: float, oav_mode: Source
131
+ ):
132
+ @run_decorator(md={"sample_id": sample_id})
133
+ def rotate_in_one_direction_and_start_murko_and_stream_to_redis():
134
+ yield from bps.stage(murko_results, wait=True)
135
+ yield from bps.trigger(murko_results, group=murko_results_group)
133
136
 
134
- yield from bps.stage(murko_results, wait=True)
135
- yield from bps.trigger(murko_results, group=murko_results_group)
137
+ yield from _rotate_in_one_direction_and_stream_to_redis(
138
+ smargon, oav_to_redis_forwarder, oav_mode, rotation
139
+ )
136
140
 
137
- yield from bpp.contingency_wrapper(
138
- _thaw_and_stream_to_redis(
139
- time_to_thaw,
140
- rotation,
141
- robot,
142
- thawer,
143
- smargon,
144
- oav,
145
- oav_to_redis_forwarder,
146
- centre_then_switch_forwarder_to_roi,
147
- ),
148
- final_plan=partial(bps.unstage, murko_results, wait=True),
149
- )
141
+ yield from rotate_in_one_direction_and_start_murko_and_stream_to_redis()
142
+
143
+ yield from centre_from_murko()
144
+ yield from bps.unstage(murko_results, wait=True)
150
145
 
146
+ yield from rotate_in_one_direction_then_murko_centre(
147
+ rotation, Source.FULL_SCREEN
148
+ )
149
+ yield from rotate_in_one_direction_then_murko_centre(-rotation, Source.ROI)
150
+
151
+ yield from do_thaw_and_murko_centre()
151
152
 
152
- def _thaw(
153
+
154
+ def thaw_and_stream_to_redis(
153
155
  time_to_thaw: float,
154
- rotation: float,
155
- thawer: Thawer,
156
- smargon: Smargon,
157
- plan_between_rotations: Callable[[], MsgGenerator] | None = None,
156
+ rotation: float = 360,
157
+ robot: BartRobot = inject("robot"),
158
+ thawer: Thawer = inject("thawer"),
159
+ smargon: Smargon = inject("smargon"),
160
+ oav_to_redis_forwarder: OAVToRedisForwarder = inject("oav_to_redis_forwarder"),
158
161
  ) -> MsgGenerator:
159
162
  """Turns on the thawer and rotates the sample by {rotation} degrees to thaw it, then
160
163
  rotates {rotation} degrees back and turns the thawer off. The speed of the goniometer
161
164
  is set such that the process takes whole process will take {time_to_thaw} time.
162
165
 
166
+ At the same time streams OAV images to redis for later processing (e.g. by murko).
167
+ On the first rotation the images from the large ROI are streamed, on the second the
168
+ smaller ROI is used.
169
+
163
170
  Args:
164
171
  time_to_thaw (float): Time to thaw for, in seconds.
165
- rotation (float): How much to rotate by whilst thawing, in degrees.
166
- thawer (Thawer): The thawing device.
167
- smargon (Smargon): The smargon used to rotate.
168
- plan_between_rotations (MsgGenerator, optional): A plan to run between rotations
169
- of the smargon. Defaults to no plan.
172
+ rotation (float, optional): How much to rotate by whilst thawing, in degrees.
173
+ Defaults to 360.
174
+ ... devices: These are the specific ophyd-devices used for the plan, the
175
+ defaults are always correct
170
176
  """
177
+ sample_id = yield from bps.rd(robot.sample_id)
178
+ sample_id = int(sample_id)
179
+
180
+ oav_fs = oav_to_redis_forwarder.sources[Source.FULL_SCREEN].oav_ref()
181
+
182
+ initial_zoom_level = yield from bps.rd(oav_fs.zoom_controller.level)
171
183
  initial_velocity = yield from bps.rd(smargon.omega.velocity)
172
184
  new_velocity = abs(rotation / time_to_thaw) * 2.0
173
185
 
174
- def do_thaw():
175
- yield from bps.abs_set(smargon.omega.velocity, new_velocity, wait=True)
176
- yield from bps.abs_set(thawer.control, OnOff.ON, wait=True)
177
- yield from bps.rel_set(smargon.omega, rotation, wait=True)
178
- if plan_between_rotations:
179
- yield from plan_between_rotations()
180
- yield from bps.rel_set(smargon.omega, -rotation, wait=True)
186
+ murko_callback = MurkoCallback(
187
+ RedisConstants.REDIS_HOST,
188
+ RedisConstants.REDIS_PASSWORD,
189
+ RedisConstants.MURKO_REDIS_DB,
190
+ )
181
191
 
182
192
  def cleanup():
193
+ yield from bps.mv(oav_fs.zoom_controller.level, initial_zoom_level)
183
194
  yield from bps.abs_set(smargon.omega.velocity, initial_velocity, wait=True)
184
- yield from bps.abs_set(thawer.control, OnOff.OFF, wait=True)
195
+ yield from bps.abs_set(thawer, OnOff.OFF, wait=True)
185
196
 
186
- # Always cleanup even if there is a failure
187
- yield from bpp.contingency_wrapper(
188
- do_thaw(),
189
- final_plan=cleanup,
190
- )
191
-
192
-
193
- def _thaw_and_stream_to_redis(
194
- time_to_thaw: float,
195
- rotation: float,
196
- robot: BartRobot,
197
- thawer: Thawer,
198
- smargon: Smargon,
199
- oav: OAV,
200
- oav_to_redis_forwarder: OAVToRedisForwarder,
201
- plan_between_rotations: Callable[[], MsgGenerator],
202
- ) -> MsgGenerator:
203
- zoom_percentage = yield from bps.rd(oav.zoom_controller.percentage)
204
- sample_id = yield from bps.rd(robot.sample_id)
205
-
206
- sample_id = int(sample_id)
207
- zoom_level_before_thawing = yield from bps.rd(oav.zoom_controller.level)
208
-
209
- yield from bps.mv(oav.zoom_controller.level, "1.0x")
210
-
211
- microns_per_pixel_x = yield from bps.rd(oav.microns_per_pixel_x)
212
- microns_per_pixel_y = yield from bps.rd(oav.microns_per_pixel_y)
213
- beam_centre_i = yield from bps.rd(oav.beam_centre_i)
214
- beam_centre_j = yield from bps.rd(oav.beam_centre_j)
215
-
216
- @subs_decorator(
217
- MurkoCallback(
218
- RedisConstants.REDIS_HOST,
219
- RedisConstants.REDIS_PASSWORD,
220
- RedisConstants.MURKO_REDIS_DB,
221
- )
222
- )
223
- @run_decorator(
224
- md={
225
- "microns_per_x_pixel": microns_per_pixel_x,
226
- "microns_per_y_pixel": microns_per_pixel_y,
227
- "beam_centre_i": beam_centre_i,
228
- "beam_centre_j": beam_centre_j,
229
- "zoom_percentage": zoom_percentage,
230
- "sample_id": sample_id,
231
- }
232
- )
233
- def _main_plan():
197
+ @subs_decorator(murko_callback)
198
+ @contingency_decorator(final_plan=cleanup)
199
+ def do_thaw_and_stream_to_redis():
234
200
  yield from bps.mv(
235
201
  oav_to_redis_forwarder.sample_id,
236
202
  sample_id,
237
- oav_to_redis_forwarder.selected_source,
238
- Source.FULL_SCREEN.value,
203
+ oav_fs.zoom_controller.level,
204
+ "1.0x",
239
205
  )
240
-
241
- yield from bps.kickoff(oav_to_redis_forwarder, wait=True)
242
- yield from bps.monitor(smargon.omega.user_readback, name="smargon")
243
- yield from bps.monitor(oav_to_redis_forwarder.uuid, name="oav")
244
- yield from _thaw(
245
- time_to_thaw, rotation, thawer, smargon, plan_between_rotations
206
+ yield from bps.abs_set(smargon.omega.velocity, new_velocity, wait=True)
207
+ yield from bps.abs_set(thawer, OnOff.ON, wait=True)
208
+
209
+ @run_decorator(md={"sample_id": sample_id})
210
+ def rotate_in_one_direction_and_stream_to_redis(
211
+ rotation: float, oav_mode: Source
212
+ ):
213
+ yield from _rotate_in_one_direction_and_stream_to_redis(
214
+ smargon, oav_to_redis_forwarder, oav_mode, rotation
215
+ )
216
+
217
+ yield from rotate_in_one_direction_and_stream_to_redis(
218
+ rotation, Source.FULL_SCREEN
246
219
  )
247
- yield from bps.complete(oav_to_redis_forwarder)
220
+ yield from rotate_in_one_direction_and_stream_to_redis(-rotation, Source.ROI)
248
221
 
249
- def cleanup():
250
- yield from bps.mv(oav.zoom_controller.level, zoom_level_before_thawing)
222
+ yield from do_thaw_and_stream_to_redis()
251
223
 
252
- yield from bpp.contingency_wrapper(
253
- _main_plan(),
254
- final_plan=cleanup,
224
+
225
+ def _rotate_in_one_direction_and_stream_to_redis(
226
+ smargon: Smargon,
227
+ oav_to_redis_forwarder: OAVToRedisForwarder,
228
+ oav_mode: Source,
229
+ rotation: float,
230
+ ):
231
+ def get_metadata_from_current_oav():
232
+ current_source_idx = yield from bps.rd(oav_to_redis_forwarder.selected_source)
233
+ oav = oav_to_redis_forwarder.sources[current_source_idx].oav_ref()
234
+ yield from bps.create()
235
+ oav_info = yield from bps.read(oav)
236
+ LOGGER.info(f"Got oav information: {oav_info}")
237
+ yield from bps.save()
238
+
239
+ yield from bps.mv(
240
+ oav_to_redis_forwarder.selected_source,
241
+ oav_mode.value,
255
242
  )
243
+
244
+ yield from get_metadata_from_current_oav()
245
+ yield from bps.monitor(smargon.omega.user_readback, name="smargon")
246
+ yield from bps.monitor(oav_to_redis_forwarder.uuid, name="oav")
247
+
248
+ yield from bps.kickoff(oav_to_redis_forwarder, wait=True)
249
+ yield from bps.rel_set(smargon.omega, rotation, wait=True)
250
+ yield from bps.complete(oav_to_redis_forwarder, wait=True)
@@ -112,6 +112,8 @@ class DCID:
112
112
  match expt_params.detector_name:
113
113
  case "eiger":
114
114
  self.detector = Eiger()
115
+ case _:
116
+ raise ValueError("Unknown detector:", expt_params.detector_name)
115
117
 
116
118
  self.server = server or DEFAULT_ISPYB_SERVER
117
119
  self.emit_errors = emit_errors
@@ -144,7 +146,7 @@ class DCID:
144
146
  try:
145
147
  if not start_time:
146
148
  start_time = datetime.datetime.now().astimezone()
147
- elif not start_time.timetz:
149
+ else:
148
150
  start_time = start_time.astimezone()
149
151
 
150
152
  resolution = get_resolution(
@@ -156,10 +158,7 @@ class DCID:
156
158
  transmission = self.parameters.transmission * 100
157
159
  xbeam, ybeam = beam_settings.beam_center_in_mm
158
160
 
159
- if isinstance(self.detector, Eiger):
160
- start_image_number = 1
161
- else:
162
- raise ValueError("Unknown detector:", self.detector)
161
+ start_image_number = 1
163
162
 
164
163
  events = [
165
164
  {
@@ -253,6 +253,7 @@ def main_extruder_plan(
253
253
  parameters.exposure_time_s,
254
254
  ],
255
255
  dcm,
256
+ detector_stage,
256
257
  )
257
258
  yield from setup_zebra_for_extruder_with_pump_probe_plan(
258
259
  zebra,
@@ -275,6 +276,7 @@ def main_extruder_plan(
275
276
  parameters.exposure_time_s,
276
277
  ],
277
278
  dcm,
279
+ detector_stage,
278
280
  )
279
281
  yield from setup_zebra_for_quickshot_plan(
280
282
  zebra, parameters.exposure_time_s, parameters.num_images, wait=True
@@ -374,6 +376,7 @@ def tidy_up_at_collection_end_plan(
374
376
  parameters: ExtruderParameters,
375
377
  dcid: DCID,
376
378
  dcm: DCM,
379
+ detector_stage: YZStage,
377
380
  ) -> MsgGenerator:
378
381
  """A plan to tidy up at the end of a collection, successful or aborted.
379
382
 
@@ -386,7 +389,7 @@ def tidy_up_at_collection_end_plan(
386
389
 
387
390
  # Clean Up
388
391
  if parameters.detector_name == "eiger":
389
- yield from sup.eiger("return-to-normal", None, dcm)
392
+ yield from sup.eiger("return-to-normal", None, dcm, detector_stage)
390
393
  SSX_LOGGER.debug(f"{parameters.filename}_{caget(pv.eiger_seq_id)}")
391
394
  SSX_LOGGER.debug("End of Run")
392
395
  SSX_LOGGER.info("Close hutch shutter")
@@ -452,7 +455,7 @@ def run_plan_in_wrapper(
452
455
  ),
453
456
  final_plan=lambda: (
454
457
  yield from tidy_up_at_collection_end_plan(
455
- zebra, shutter, parameters, dcid, dcm
458
+ zebra, shutter, parameters, dcid, dcm, detector_stage
456
459
  )
457
460
  ),
458
461
  auto_raise=False,
@@ -4,7 +4,7 @@ major 4
4
4
  minor 0
5
5
  release 1
6
6
  x 1203
7
- y 544
7
+ y 581
8
8
  w 550
9
9
  h 380
10
10
  font "arial-medium-r-18.0"
@@ -89,7 +89,7 @@ x 143
89
89
  y 82
90
90
  w 110
91
91
  h 30
92
- controlPv "BL24I-MO-IOC-01:GP6"
92
+ controlPv "BL24I-MO-IOC-13:GP6"
93
93
  font "arial-medium-r-18.0"
94
94
  fontAlign "right"
95
95
  fgColor index 25
@@ -180,7 +180,7 @@ x 144
180
180
  y 126
181
181
  w 110
182
182
  h 30
183
- controlPv "BL24I-MO-IOC-01:GP7"
183
+ controlPv "BL24I-MO-IOC-13:GP7"
184
184
  font "arial-medium-r-18.0"
185
185
  fontAlign "right"
186
186
  fgColor index 25
@@ -464,7 +464,7 @@ x 145
464
464
  y 171
465
465
  w 110
466
466
  h 30
467
- controlPv "BL24I-MO-IOC-01:GP8"
467
+ controlPv "BL24I-MO-IOC-13:GP8"
468
468
  font "arial-medium-r-18.0"
469
469
  fontAlign "right"
470
470
  fgColor index 25
@@ -580,7 +580,7 @@ h 144
580
580
  lineColor index 7
581
581
  fill
582
582
  fillColor index 7
583
- visPv "BL24I-MO-IOC-01:GP1"
583
+ visPv "BL24I-MO-IOC-13:GP1"
584
584
  visMin "0"
585
585
  visMax "2"
586
586
  endObjectProperties
@@ -598,7 +598,7 @@ h 143
598
598
  lineColor index 7
599
599
  fill
600
600
  fillColor index 7
601
- visPv "BL24I-MO-IOC-01:GP1"
601
+ visPv "BL24I-MO-IOC-13:GP1"
602
602
  visMin "0"
603
603
  visMax "2"
604
604
  endObjectProperties
@@ -618,7 +618,7 @@ fontAlign "center"
618
618
  fgColor index 14
619
619
  bgColor index 0
620
620
  useDisplayBg
621
- visPv "BL24I-MO-IOC-01:GP1"
621
+ visPv "BL24I-MO-IOC-13:GP1"
622
622
  visMin "0"
623
623
  visMax "2"
624
624
  value {
@@ -648,7 +648,7 @@ botShadowColor index 11
648
648
  font "arial-medium-r-18.0"
649
649
  numCmds 1
650
650
  command {
651
- 0 "caput BL24I-EA-CHIP-01:PMAC_STRING \\#5hmz\\#6hmz\\#7hmz"
651
+ 0 "caput BL24I-MO-IOC-13:PMAC:console \\#5hmz\\#6hmz\\#7hmz"
652
652
  }
653
653
  endObjectProperties
654
654
 
@@ -728,7 +728,7 @@ h 143
728
728
  lineColor index 7
729
729
  fill
730
730
  fillColor index 7
731
- visPv "BL24I-MO-IOC-01:GP1"
731
+ visPv "BL24I-MO-IOC-13:GP1"
732
732
  visMin "0"
733
733
  visMax "2"
734
734
  endObjectProperties
@@ -748,7 +748,7 @@ fontAlign "center"
748
748
  fgColor index 14
749
749
  bgColor index 0
750
750
  useDisplayBg
751
- visPv "BL24I-MO-IOC-01:GP1"
751
+ visPv "BL24I-MO-IOC-13:GP1"
752
752
  visMin "0"
753
753
  visMax "2"
754
754
  value {
@@ -792,7 +792,7 @@ x 146
792
792
  y 209
793
793
  w 110
794
794
  h 25
795
- controlPv "BL24I-MO-IOC-01:GP99"
795
+ controlPv "BL24I-MO-IOC-13:GP99"
796
796
  font "arial-medium-r-18.0"
797
797
  fontAlign "right"
798
798
  fgColor index 25
@@ -4,7 +4,7 @@ major 4
4
4
  minor 0
5
5
  release 1
6
6
  x 1205
7
- y 616
7
+ y 653
8
8
  w 450
9
9
  h 180
10
10
  font "arial-medium-r-18.0"
@@ -78,9 +78,9 @@ fgColour index 14
78
78
  bgColour index 4
79
79
  topShadowColour index 1
80
80
  botShadowColour index 8
81
- controlPv "BL24I-MO-IOC-01:GP101"
81
+ controlPv "BL24I-MO-IOC-13:GP101"
82
82
  font "arial-medium-r-18.0"
83
- numItems 2
83
+ numItems 1
84
84
  symbolTag {
85
85
  0 "Eiger"
86
86
  }