mx-bluesky 1.4.0__py3-none-any.whl → 1.4.1__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/i04/redis_to_murko_forwarder.py +178 -0
- mx_bluesky/beamlines/i04/thawing_plan.py +1 -1
- mx_bluesky/beamlines/i24/serial/dcid.py +143 -171
- mx_bluesky/beamlines/i24/serial/extruder/EX-gui-edm/DiamondExtruder-I24-py3v1.edl +1 -1
- mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +54 -21
- mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/DiamondChipI24-py3v1.edl +2 -5
- mx_bluesky/beamlines/i24/serial/fixed_target/ft_utils.py +0 -1
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +67 -50
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +26 -79
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_StartUp_py3v1.py +0 -199
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py +4 -6
- mx_bluesky/beamlines/i24/serial/log.py +1 -1
- mx_bluesky/beamlines/i24/serial/parameters/__init__.py +4 -0
- mx_bluesky/beamlines/i24/serial/parameters/constants.py +6 -1
- mx_bluesky/beamlines/i24/serial/parameters/experiment_parameters.py +42 -15
- mx_bluesky/beamlines/i24/serial/run_fixed_target.sh +4 -3
- mx_bluesky/beamlines/i24/serial/setup_beamline/pv.py +2 -0
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +103 -81
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +1 -2
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +24 -26
- mx_bluesky/beamlines/i24/serial/write_nexus.py +74 -72
- mx_bluesky/common/external_interaction/config_server.py +46 -0
- mx_bluesky/common/parameters/components.py +52 -15
- mx_bluesky/common/parameters/constants.py +11 -1
- mx_bluesky/common/parameters/gridscan.py +94 -0
- mx_bluesky/{hyperion → common}/parameters/robot_load.py +2 -2
- mx_bluesky/common/plans/do_fgs.py +2 -2
- mx_bluesky/common/utils/log.py +2 -0
- mx_bluesky/hyperion/__main__.py +2 -1
- mx_bluesky/hyperion/device_setup_plans/dcm_pitch_roll_mirror_adjuster.py +21 -31
- mx_bluesky/hyperion/device_setup_plans/setup_panda.py +4 -4
- mx_bluesky/hyperion/device_setup_plans/setup_zebra.py +1 -1
- mx_bluesky/hyperion/device_setup_plans/smargon.py +3 -3
- mx_bluesky/hyperion/exceptions.py +13 -1
- mx_bluesky/hyperion/experiment_plans/__init__.py +4 -0
- mx_bluesky/hyperion/experiment_plans/change_aperture_then_move_plan.py +83 -0
- mx_bluesky/hyperion/experiment_plans/common/xrc_result.py +47 -0
- mx_bluesky/hyperion/experiment_plans/experiment_registry.py +9 -9
- mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py +133 -97
- mx_bluesky/hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py +42 -18
- mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +75 -9
- mx_bluesky/hyperion/experiment_plans/oav_grid_detection_plan.py +2 -2
- mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +1 -1
- mx_bluesky/hyperion/experiment_plans/optimise_attenuation_plan.py +2 -2
- mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +36 -17
- mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +5 -5
- mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +28 -28
- mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +64 -16
- mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +11 -3
- mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +10 -10
- mx_bluesky/hyperion/external_interaction/callbacks/__init__.py +0 -4
- mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +4 -0
- mx_bluesky/hyperion/external_interaction/callbacks/common/abstract_event.py +66 -0
- mx_bluesky/hyperion/external_interaction/callbacks/common/callback_util.py +5 -0
- mx_bluesky/hyperion/external_interaction/callbacks/grid_detection_callback.py +15 -15
- mx_bluesky/hyperion/external_interaction/callbacks/robot_load/ispyb_callback.py +18 -10
- mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_callback.py +3 -1
- mx_bluesky/hyperion/external_interaction/callbacks/rotation/nexus_callback.py +5 -3
- mx_bluesky/hyperion/external_interaction/callbacks/sample_handling/__init__.py +0 -0
- mx_bluesky/hyperion/external_interaction/callbacks/sample_handling/sample_handling_callback.py +84 -0
- mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/ispyb_callback.py +15 -9
- mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/nexus_callback.py +5 -4
- mx_bluesky/hyperion/external_interaction/config_server.py +8 -37
- mx_bluesky/hyperion/external_interaction/exceptions.py +0 -9
- mx_bluesky/hyperion/external_interaction/ispyb/exp_eye_store.py +65 -15
- mx_bluesky/hyperion/parameters/components.py +4 -9
- mx_bluesky/hyperion/parameters/constants.py +0 -1
- mx_bluesky/hyperion/parameters/gridscan.py +33 -76
- mx_bluesky/hyperion/parameters/load_centre_collect.py +14 -9
- mx_bluesky/hyperion/parameters/rotation.py +15 -6
- {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1.dist-info}/METADATA +35 -34
- {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1.dist-info}/RECORD +77 -70
- {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1.dist-info}/WHEEL +1 -1
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Mapping_py3v1.py +0 -150
- {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1.dist-info}/LICENSE +0 -0
- {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1.dist-info}/entry_points.txt +0 -0
- {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1.dist-info}/top_level.txt +0 -0
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import logging
|
|
2
1
|
from time import sleep
|
|
3
2
|
|
|
4
3
|
import bluesky.plan_stubs as bps
|
|
4
|
+
from dodal.beamlines import i24
|
|
5
5
|
from dodal.devices.i24.aperture import Aperture, AperturePositions
|
|
6
|
+
from dodal.devices.i24.beam_center import DetectorBeamCenter
|
|
6
7
|
from dodal.devices.i24.beamstop import Beamstop, BeamstopPositions
|
|
7
8
|
from dodal.devices.i24.dual_backlight import BacklightPositions, DualBacklight
|
|
8
9
|
from dodal.devices.i24.i24_detector_motion import DetectorMotion
|
|
9
10
|
|
|
11
|
+
from mx_bluesky.beamlines.i24.serial.log import SSX_LOGGER
|
|
12
|
+
from mx_bluesky.beamlines.i24.serial.parameters.constants import BEAM_CENTER_POS
|
|
10
13
|
from mx_bluesky.beamlines.i24.serial.setup_beamline import pv
|
|
11
14
|
from mx_bluesky.beamlines.i24.serial.setup_beamline.ca import caget, caput
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
|
|
17
|
+
def get_beam_center_device(detector_in_use: str) -> DetectorBeamCenter:
|
|
18
|
+
if detector_in_use == "eiger":
|
|
19
|
+
return i24.eiger_beam_center()
|
|
20
|
+
else:
|
|
21
|
+
return i24.pilatus_beam_center()
|
|
14
22
|
|
|
15
23
|
|
|
16
24
|
def setup_beamline_for_collection_plan(
|
|
@@ -20,7 +28,7 @@ def setup_beamline_for_collection_plan(
|
|
|
20
28
|
group: str = "setup_beamline_collect",
|
|
21
29
|
wait: bool = True,
|
|
22
30
|
):
|
|
23
|
-
|
|
31
|
+
SSX_LOGGER.debug("Setup beamline: collect.")
|
|
24
32
|
yield from bps.abs_set(aperture.position, AperturePositions.IN, group=group)
|
|
25
33
|
yield from bps.abs_set(backlight, BacklightPositions.OUT, group=group)
|
|
26
34
|
yield from bps.sleep(3) # Not sure needed - to test
|
|
@@ -38,13 +46,35 @@ def move_detector_stage_to_position_plan(
|
|
|
38
46
|
detector_stage: DetectorMotion,
|
|
39
47
|
detector_distance: float,
|
|
40
48
|
):
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
SSX_LOGGER.debug("Setup beamline: moving detector stage.")
|
|
50
|
+
SSX_LOGGER.debug(
|
|
43
51
|
f"Waiting for detector move. Detector distance: {detector_distance} mm."
|
|
44
52
|
)
|
|
45
53
|
yield from bps.mv(detector_stage.z, detector_distance) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809
|
|
46
54
|
|
|
47
55
|
|
|
56
|
+
def set_detector_beam_center_plan(
|
|
57
|
+
beam_center_device: DetectorBeamCenter,
|
|
58
|
+
detector_name: str,
|
|
59
|
+
group: str = "set_beamcenter",
|
|
60
|
+
wait: bool = True,
|
|
61
|
+
):
|
|
62
|
+
"""A small temporary plan to set up the beam center on the detector in use."""
|
|
63
|
+
# NOTE This will be removed once the detectors are using ophyd_async devices
|
|
64
|
+
# See https://github.com/DiamondLightSource/mx-bluesky/issues/62
|
|
65
|
+
SSX_LOGGER.debug(
|
|
66
|
+
f"Set beam center on {detector_name} detector: {BEAM_CENTER_POS[detector_name]}"
|
|
67
|
+
)
|
|
68
|
+
yield from bps.abs_set(
|
|
69
|
+
beam_center_device.beam_x, BEAM_CENTER_POS[detector_name][0], group=group
|
|
70
|
+
)
|
|
71
|
+
yield from bps.abs_set(
|
|
72
|
+
beam_center_device.beam_y, BEAM_CENTER_POS[detector_name][1], group=group
|
|
73
|
+
)
|
|
74
|
+
if wait:
|
|
75
|
+
yield from bps.wait(group=group)
|
|
76
|
+
|
|
77
|
+
|
|
48
78
|
def modechange(action):
|
|
49
79
|
"""Mode Change"""
|
|
50
80
|
# Pin Hand Mount
|
|
@@ -60,7 +90,7 @@ def modechange(action):
|
|
|
60
90
|
caput(pv.fluo_trans, "OUT")
|
|
61
91
|
caput(pv.cstrm_p1701, 0)
|
|
62
92
|
caput(pv.cstrm_mp_select, "Out")
|
|
63
|
-
|
|
93
|
+
SSX_LOGGER.debug("Pin Hand Mount Done")
|
|
64
94
|
|
|
65
95
|
# Pin Room Tempreature Hand Mount
|
|
66
96
|
elif action == "Pin_rt_hand_mount":
|
|
@@ -75,7 +105,7 @@ def modechange(action):
|
|
|
75
105
|
caput(pv.vgon_pinxs, 0)
|
|
76
106
|
caput(pv.vgon_pinzs, 0)
|
|
77
107
|
caput(pv.fluo_trans, "OUT")
|
|
78
|
-
|
|
108
|
+
SSX_LOGGER.debug("RT Pin Hand Mount Done")
|
|
79
109
|
|
|
80
110
|
# Pin Data Collection
|
|
81
111
|
elif action == "Pin_data_collection":
|
|
@@ -94,11 +124,11 @@ def modechange(action):
|
|
|
94
124
|
caput(pv.bs_mp_select, "Data Collection")
|
|
95
125
|
sleep(2.3)
|
|
96
126
|
caput(pv.bl_mp_select, "In")
|
|
97
|
-
|
|
127
|
+
SSX_LOGGER.debug("Pin Data Collection Done")
|
|
98
128
|
|
|
99
129
|
# Pin Room Tempreature Data Collection
|
|
100
130
|
elif action == "Pin_rt_data_collection":
|
|
101
|
-
|
|
131
|
+
SSX_LOGGER.debug("RT Mode")
|
|
102
132
|
caput(pv.cstrm_p1701, 0)
|
|
103
133
|
caput(pv.cstrm_mp_select, "Away")
|
|
104
134
|
caput(pv.aptr1_mp_select, "In")
|
|
@@ -114,7 +144,7 @@ def modechange(action):
|
|
|
114
144
|
sleep(2.6)
|
|
115
145
|
caput(pv.bl_mp_select, "In")
|
|
116
146
|
caput(pv.bs_mp_select, "Data Collection")
|
|
117
|
-
|
|
147
|
+
SSX_LOGGER.debug("RT Data Collection Done")
|
|
118
148
|
|
|
119
149
|
# Tray Hand Mount
|
|
120
150
|
elif action == "Tray_hand_mount":
|
|
@@ -128,7 +158,7 @@ def modechange(action):
|
|
|
128
158
|
caput(pv.bs_mp_select, "Tray Mount")
|
|
129
159
|
while float(caget(pv.ttab_x + ".RBV")) > 3:
|
|
130
160
|
sleep(1)
|
|
131
|
-
|
|
161
|
+
SSX_LOGGER.debug("Tray Hand Mount Done")
|
|
132
162
|
|
|
133
163
|
# Tray Robot Load. This action needs to be reviewed and revised
|
|
134
164
|
elif action == "Tray_robot_load":
|
|
@@ -150,11 +180,11 @@ def modechange(action):
|
|
|
150
180
|
caput(pv.bs_roty, 0)
|
|
151
181
|
sleep(4)
|
|
152
182
|
caput(pv.bl_mp_select, "In")
|
|
153
|
-
|
|
183
|
+
SSX_LOGGER.debug("Tray Robot Mount Done")
|
|
154
184
|
|
|
155
185
|
# Tray Data Collection
|
|
156
186
|
elif action == "Tray_data_collection":
|
|
157
|
-
|
|
187
|
+
SSX_LOGGER.debug("This should be E11 on the test tray (CrystalQuickX)")
|
|
158
188
|
caput(pv.ttab_x, 37.4)
|
|
159
189
|
caput(pv.hgon_trayys, -8.0)
|
|
160
190
|
caput(pv.hgon_trayzs, -2.1)
|
|
@@ -171,7 +201,7 @@ def modechange(action):
|
|
|
171
201
|
caput(pv.bs_roty, 0)
|
|
172
202
|
sleep(4)
|
|
173
203
|
caput(pv.bl_mp_select, "In")
|
|
174
|
-
|
|
204
|
+
SSX_LOGGER.debug("Tray Data Collection Done")
|
|
175
205
|
|
|
176
206
|
# Pin Switch to Tray
|
|
177
207
|
elif action == "Pin_switch2tray":
|
|
@@ -192,19 +222,19 @@ def modechange(action):
|
|
|
192
222
|
caput(pv.vgon_pinyh, 0)
|
|
193
223
|
caput(pv.vgon_pinzs, 0)
|
|
194
224
|
while float(caget(pv.ttab_x + ".RBV")) > 1:
|
|
195
|
-
|
|
225
|
+
SSX_LOGGER.debug(f"moving ttab_x {caget(pv.ttab_x)}")
|
|
196
226
|
sleep(0.1)
|
|
197
227
|
while caget(pv.fluo_out_limit) == "OFF":
|
|
198
|
-
|
|
228
|
+
SSX_LOGGER.debug("waiting on fluorescence detector")
|
|
199
229
|
sleep(0.1)
|
|
200
230
|
while caget(pv.bl_mp_select) != "Out":
|
|
201
|
-
|
|
231
|
+
SSX_LOGGER.debug("waiting on back light to move to out")
|
|
202
232
|
sleep(0.1)
|
|
203
233
|
caput(pv.bs_mp_select, "Robot")
|
|
204
234
|
caput(pv.bs_roty, 0)
|
|
205
235
|
while float(caget(pv.ptab_y + ".RBV")) > -89.0:
|
|
206
236
|
sleep(1)
|
|
207
|
-
|
|
237
|
+
SSX_LOGGER.debug("Switch To Tray Done")
|
|
208
238
|
|
|
209
239
|
# Tray Switch to Pin
|
|
210
240
|
elif action == "Tray_switch2pin":
|
|
@@ -218,39 +248,34 @@ def modechange(action):
|
|
|
218
248
|
while float(caget(pv.ptab_y + ".RBV")) < -1.0:
|
|
219
249
|
sleep(1)
|
|
220
250
|
modechange("Pin_data_collection")
|
|
221
|
-
|
|
251
|
+
SSX_LOGGER.debug("Switch To Pin Done")
|
|
222
252
|
else:
|
|
223
|
-
|
|
253
|
+
SSX_LOGGER.debug(f"Unknown action: {action}")
|
|
224
254
|
return 1
|
|
225
255
|
|
|
226
256
|
|
|
227
257
|
def pilatus(action, args_list):
|
|
228
|
-
|
|
229
|
-
|
|
258
|
+
SSX_LOGGER.debug("***** Entering Pilatus")
|
|
259
|
+
SSX_LOGGER.info(f"Setup pilatus - {action}")
|
|
230
260
|
if args_list:
|
|
231
261
|
for arg in args_list:
|
|
232
|
-
|
|
262
|
+
SSX_LOGGER.debug(f"Argument: {arg}")
|
|
233
263
|
|
|
234
264
|
# caput(pv.pilat_wavelength, caget(pv.dcm_lambda))
|
|
235
265
|
caput(pv.pilat_detdist, caget(pv.det_z))
|
|
236
266
|
caput(pv.pilat_filtertrasm, caget(pv.attn_match))
|
|
237
|
-
logger.warning("WARNING: Have you set beam X and Y?")
|
|
238
|
-
# 16 Fed 2022 last change DA
|
|
239
|
-
caput(pv.pilat_beamx, 1298)
|
|
240
|
-
caput(pv.pilat_beamy, 1307)
|
|
241
|
-
sleep(0.1)
|
|
242
267
|
|
|
243
268
|
# Fixed Target stage (very fast start and stop w/ triggering from GeoBrick
|
|
244
269
|
if action == "fastchip":
|
|
245
270
|
[filepath, filename, total_numb_imgs, exptime] = args_list
|
|
246
271
|
rampath = filepath.replace("dls/i24/data", "ramdisk")
|
|
247
272
|
acqtime = float(exptime) - 0.001
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
273
|
+
SSX_LOGGER.debug(f"Filepath was set as {filepath}")
|
|
274
|
+
SSX_LOGGER.debug(f"Rampath set as {rampath}")
|
|
275
|
+
SSX_LOGGER.debug(f"Filename set as {filename}")
|
|
276
|
+
SSX_LOGGER.debug(f"total_numb_imgs {total_numb_imgs}")
|
|
277
|
+
SSX_LOGGER.debug(f"Exposure time set as {exptime} s")
|
|
278
|
+
SSX_LOGGER.debug(f"Acquire time set as {acqtime} s")
|
|
254
279
|
caput(pv.pilat_startangle, 0.0)
|
|
255
280
|
caput(pv.pilat_angleincr, 0.0)
|
|
256
281
|
caput(pv.pilat_omegaincr, 0.0)
|
|
@@ -265,7 +290,7 @@ def pilatus(action, args_list):
|
|
|
265
290
|
|
|
266
291
|
# Quick set of images no coordinated motion
|
|
267
292
|
elif action == "quickshot":
|
|
268
|
-
|
|
293
|
+
SSX_LOGGER.debug("quickshot")
|
|
269
294
|
[filepath, filename, num_imgs, exptime] = args_list
|
|
270
295
|
rampath = filepath.replace("dls/i24/data", "ramdisk")
|
|
271
296
|
caput(pv.pilat_filepath, rampath)
|
|
@@ -275,13 +300,13 @@ def pilatus(action, args_list):
|
|
|
275
300
|
acqtime = float(exptime) - 0.001
|
|
276
301
|
caput(pv.pilat_acquiretime, str(acqtime))
|
|
277
302
|
caput(pv.pilat_acquireperiod, str(exptime))
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
303
|
+
SSX_LOGGER.debug(f"Filepath was set as {filepath}")
|
|
304
|
+
SSX_LOGGER.debug(f"Rampath set as {rampath}")
|
|
305
|
+
SSX_LOGGER.debug(f"Filename set as {filename}")
|
|
306
|
+
SSX_LOGGER.debug(f"num_imgs {num_imgs}")
|
|
307
|
+
SSX_LOGGER.debug(f"Exposure time set as {exptime} s")
|
|
308
|
+
SSX_LOGGER.debug(f"Acquire time set as {acqtime} s")
|
|
309
|
+
SSX_LOGGER.debug("Pilatus takes time apprx 2sec")
|
|
285
310
|
sleep(2)
|
|
286
311
|
caput(pv.pilat_delaytime, 0.00)
|
|
287
312
|
caput(pv.pilat_numimages, str(num_imgs))
|
|
@@ -290,7 +315,7 @@ def pilatus(action, args_list):
|
|
|
290
315
|
sleep(0.2)
|
|
291
316
|
|
|
292
317
|
elif action == "quickshot-internaltrig":
|
|
293
|
-
|
|
318
|
+
SSX_LOGGER.debug("quickshot-internaltrig")
|
|
294
319
|
[filepath, filename, num_imgs, exptime] = args_list
|
|
295
320
|
rampath = filepath.replace("dls/i24/data", "ramdisk")
|
|
296
321
|
caput(pv.pilat_filepath, rampath)
|
|
@@ -300,13 +325,13 @@ def pilatus(action, args_list):
|
|
|
300
325
|
acqtime = float(exptime) - 0.001
|
|
301
326
|
caput(pv.pilat_acquiretime, str(acqtime))
|
|
302
327
|
caput(pv.pilat_acquireperiod, str(exptime))
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
328
|
+
SSX_LOGGER.debug(f"Filepath was set as {filepath}")
|
|
329
|
+
SSX_LOGGER.debug(f"Rampath set as {rampath}")
|
|
330
|
+
SSX_LOGGER.debug(f"Filename set as {filename}")
|
|
331
|
+
SSX_LOGGER.debug(f"num_imgs {num_imgs}")
|
|
332
|
+
SSX_LOGGER.debug(f"Exposure time set as {exptime} s")
|
|
333
|
+
SSX_LOGGER.debug(f"Acquire time set as {acqtime} s")
|
|
334
|
+
SSX_LOGGER.debug("Pilatus takes time apprx 2sec")
|
|
310
335
|
sleep(2)
|
|
311
336
|
caput(pv.pilat_delaytime, 0.00)
|
|
312
337
|
caput(pv.pilat_numimages, str(num_imgs))
|
|
@@ -319,24 +344,21 @@ def pilatus(action, args_list):
|
|
|
319
344
|
caput(pv.pilat_imagemode, "Continuous")
|
|
320
345
|
caput(pv.pilat_triggermode, "Ext. Trigger")
|
|
321
346
|
caput(pv.pilat_numexpimage, 1)
|
|
322
|
-
|
|
347
|
+
SSX_LOGGER.debug("***** leaving pilatus")
|
|
323
348
|
sleep(0.1)
|
|
324
349
|
return 0
|
|
325
350
|
|
|
326
351
|
|
|
327
352
|
def eiger(action, args_list):
|
|
328
|
-
|
|
329
|
-
|
|
353
|
+
SSX_LOGGER.debug("***** Entering Eiger")
|
|
354
|
+
SSX_LOGGER.info(f"Setup eiger - {action}")
|
|
330
355
|
if args_list:
|
|
331
356
|
for arg in args_list:
|
|
332
|
-
|
|
357
|
+
SSX_LOGGER.debug(f"Argument: {arg}")
|
|
333
358
|
# caput(pv.eiger_wavelength, caget(pv.dcm_lambda))
|
|
334
359
|
caput(pv.eiger_detdist, str(float(caget(pv.det_z)) / 1000))
|
|
335
|
-
logger.warning("WARNING: Have you set header info?")
|
|
336
360
|
caput(pv.eiger_wavelength, caget(pv.dcm_lambda))
|
|
337
361
|
caput(pv.eiger_omegaincr, 0.0)
|
|
338
|
-
caput(pv.eiger_beamx, 1605.7)
|
|
339
|
-
caput(pv.eiger_beamy, 1702.7)
|
|
340
362
|
sleep(0.1)
|
|
341
363
|
# Setup common to all collections ###
|
|
342
364
|
caput(pv.eiger_filewriter, "No")
|
|
@@ -354,7 +376,7 @@ def eiger(action, args_list):
|
|
|
354
376
|
# Quick set of images no coordinated motion
|
|
355
377
|
if action == "quickshot":
|
|
356
378
|
# Sends a single trigger to start data collection
|
|
357
|
-
|
|
379
|
+
SSX_LOGGER.debug("Eiger quickshot")
|
|
358
380
|
[filepath, filename, num_imgs, exptime] = args_list
|
|
359
381
|
filename = filename + "_" + str(caget(pv.eiger_seqID))
|
|
360
382
|
caput(pv.eiger_ODfilepath, filepath)
|
|
@@ -363,11 +385,11 @@ def eiger(action, args_list):
|
|
|
363
385
|
sleep(0.1)
|
|
364
386
|
acqtime = float(exptime) - 0.0000001
|
|
365
387
|
caput(pv.eiger_acquiretime, str(acqtime))
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
388
|
+
SSX_LOGGER.debug(f"Filepath was set as {filepath}")
|
|
389
|
+
SSX_LOGGER.debug(f"Filename set as {filename}")
|
|
390
|
+
SSX_LOGGER.debug(f"num_imgs {num_imgs}")
|
|
391
|
+
SSX_LOGGER.debug(f"Exposure time set as {exptime} s")
|
|
392
|
+
SSX_LOGGER.debug(f"Acquire time set as {acqtime} s")
|
|
371
393
|
caput(pv.eiger_acquireperiod, str(exptime))
|
|
372
394
|
caput(pv.eiger_numimages, str(num_imgs))
|
|
373
395
|
caput(pv.eiger_imagemode, "Continuous")
|
|
@@ -376,7 +398,7 @@ def eiger(action, args_list):
|
|
|
376
398
|
caput(pv.eiger_manualtrigger, "Yes")
|
|
377
399
|
sleep(1.0)
|
|
378
400
|
# ODIN setup
|
|
379
|
-
|
|
401
|
+
SSX_LOGGER.info("Setting up Odin")
|
|
380
402
|
caput(pv.eiger_ODfilename, filename)
|
|
381
403
|
caput(pv.eiger_ODfilepath, filepath)
|
|
382
404
|
caput(pv.eiger_ODnumcapture, str(num_imgs))
|
|
@@ -386,17 +408,17 @@ def eiger(action, args_list):
|
|
|
386
408
|
caput(pv.eiger_ODcompress, "BSL24")
|
|
387
409
|
sleep(1.0)
|
|
388
410
|
# All done. Now get Odin to wait for data and start Eiger
|
|
389
|
-
|
|
411
|
+
SSX_LOGGER.info("Done: Odin waiting for data")
|
|
390
412
|
caput(pv.eiger_ODcapture, "Capture")
|
|
391
413
|
# If detector fails to arm first time can try twice with a sleep inbetween
|
|
392
|
-
|
|
414
|
+
SSX_LOGGER.info("Arming Eiger")
|
|
393
415
|
caput(pv.eiger_acquire, "1")
|
|
394
416
|
# Will now wait for Manual trigger. Add the below line to your DAQ script ###
|
|
395
417
|
# caput(pv.eiger_trigger, 1)
|
|
396
418
|
|
|
397
419
|
if action == "triggered":
|
|
398
420
|
# Send a trigger for every image. Records while TTL is high
|
|
399
|
-
|
|
421
|
+
SSX_LOGGER.info("Eiger triggered")
|
|
400
422
|
[filepath, filename, num_imgs, exptime] = args_list
|
|
401
423
|
filename = filename + "_" + str(caget(pv.eiger_seqID))
|
|
402
424
|
caput(pv.eiger_ODfilepath, filepath)
|
|
@@ -405,11 +427,11 @@ def eiger(action, args_list):
|
|
|
405
427
|
sleep(0.1)
|
|
406
428
|
acqtime = float(exptime) - 0.0000001
|
|
407
429
|
caput(pv.eiger_acquiretime, str(acqtime))
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
430
|
+
SSX_LOGGER.debug(f"Filepath was set as {filepath}")
|
|
431
|
+
SSX_LOGGER.debug(f"Filename set as {filename}")
|
|
432
|
+
SSX_LOGGER.debug(f"num_imgs {num_imgs}")
|
|
433
|
+
SSX_LOGGER.debug(f"Exposure time set as {exptime} s")
|
|
434
|
+
SSX_LOGGER.debug(f"Acquire time set as {acqtime} s")
|
|
413
435
|
caput(pv.eiger_acquireperiod, str(exptime))
|
|
414
436
|
caput(pv.eiger_numimages, 1)
|
|
415
437
|
caput(pv.eiger_imagemode, "Continuous")
|
|
@@ -418,7 +440,7 @@ def eiger(action, args_list):
|
|
|
418
440
|
caput(pv.eiger_manualtrigger, "Yes")
|
|
419
441
|
sleep(1.0)
|
|
420
442
|
# ODIN setup #
|
|
421
|
-
|
|
443
|
+
SSX_LOGGER.info("Setting up Odin")
|
|
422
444
|
caput(pv.eiger_ODfilename, filename)
|
|
423
445
|
caput(pv.eiger_ODfilepath, filepath)
|
|
424
446
|
caput(pv.eiger_ODnumcapture, str(num_imgs))
|
|
@@ -428,10 +450,10 @@ def eiger(action, args_list):
|
|
|
428
450
|
caput(pv.eiger_ODcompress, "BSL24")
|
|
429
451
|
sleep(1.0)
|
|
430
452
|
# All done. Now get Odin to wait for data and start Eiger
|
|
431
|
-
|
|
453
|
+
SSX_LOGGER.info("Done: Odin waiting for data")
|
|
432
454
|
caput(pv.eiger_ODcapture, "Capture")
|
|
433
455
|
# If detector fails to arm first time can try twice with a sleep inbetween
|
|
434
|
-
|
|
456
|
+
SSX_LOGGER.info("Arming Eiger")
|
|
435
457
|
caput(pv.eiger_acquire, "1")
|
|
436
458
|
# Will now wait for Manual trigger. Add the below line to your DAQ script
|
|
437
459
|
# caput(pv.eiger_trigger, 1)
|
|
@@ -440,17 +462,17 @@ def eiger(action, args_list):
|
|
|
440
462
|
elif action == "return-to-normal":
|
|
441
463
|
caput(pv.eiger_manualtrigger, "No")
|
|
442
464
|
# caput(pv.eiger_seqID, int(caget(pv.eiger_seqID))+1)
|
|
443
|
-
|
|
465
|
+
SSX_LOGGER.debug("***** leaving Eiger")
|
|
444
466
|
sleep(0.1)
|
|
445
467
|
return 0
|
|
446
468
|
|
|
447
469
|
|
|
448
470
|
def xspress3(action, args_list):
|
|
449
|
-
|
|
450
|
-
|
|
471
|
+
SSX_LOGGER.debug("***** Entering xspress3")
|
|
472
|
+
SSX_LOGGER.info(f"xspress3 - {action}")
|
|
451
473
|
if args_list:
|
|
452
474
|
for arg in args_list:
|
|
453
|
-
|
|
475
|
+
SSX_LOGGER.debug(f"Argument: {arg}")
|
|
454
476
|
|
|
455
477
|
if action == "stop-and-start":
|
|
456
478
|
[exp_time, lo, hi] = args_list
|
|
@@ -486,8 +508,8 @@ def xspress3(action, args_list):
|
|
|
486
508
|
caput(pv.xsp3_erase, 0)
|
|
487
509
|
|
|
488
510
|
else:
|
|
489
|
-
|
|
511
|
+
SSX_LOGGER.error("Unknown action for xspress3 method:", action)
|
|
490
512
|
|
|
491
513
|
sleep(0.1)
|
|
492
|
-
|
|
514
|
+
SSX_LOGGER.debug("***** leaving xspress3")
|
|
493
515
|
return 1
|
|
@@ -6,8 +6,7 @@ from collections.abc import Generator
|
|
|
6
6
|
from enum import IntEnum
|
|
7
7
|
|
|
8
8
|
import bluesky.plan_stubs as bps
|
|
9
|
-
from
|
|
10
|
-
from bluesky.utils import Msg
|
|
9
|
+
from bluesky.utils import Msg, MsgGenerator
|
|
11
10
|
from dodal.common import inject
|
|
12
11
|
from dodal.devices.i24.i24_detector_motion import DetectorMotion
|
|
13
12
|
|
|
@@ -9,8 +9,6 @@ the edm screen, while on the schematics they are 0 indexed. Thus, `Soft In 1` fr
|
|
|
9
9
|
schematics corresponds to soft_in_2 in the code.
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
|
-
import logging
|
|
13
|
-
|
|
14
12
|
import bluesky.plan_stubs as bps
|
|
15
13
|
from dodal.devices.zebra import (
|
|
16
14
|
AND3,
|
|
@@ -35,6 +33,8 @@ from dodal.devices.zebra import (
|
|
|
35
33
|
Zebra,
|
|
36
34
|
)
|
|
37
35
|
|
|
36
|
+
from mx_bluesky.beamlines.i24.serial.log import SSX_LOGGER
|
|
37
|
+
|
|
38
38
|
# Detector specific outs
|
|
39
39
|
TTL_EIGER = 1
|
|
40
40
|
TTL_PILATUS = 2
|
|
@@ -48,8 +48,6 @@ SHUTTER_MODE = {
|
|
|
48
48
|
GATE_START = 1.0
|
|
49
49
|
SHUTTER_OPEN_TIME = 0.05 # For pp with long delays
|
|
50
50
|
|
|
51
|
-
logger = logging.getLogger("I24ssx.setup_zebra")
|
|
52
|
-
|
|
53
51
|
|
|
54
52
|
def get_zebra_settings_for_extruder(
|
|
55
53
|
exp_time: float,
|
|
@@ -71,28 +69,28 @@ def get_zebra_settings_for_extruder(
|
|
|
71
69
|
|
|
72
70
|
def arm_zebra(zebra: Zebra):
|
|
73
71
|
yield from bps.abs_set(zebra.pc.arm, ArmDemand.ARM, wait=True) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809
|
|
74
|
-
|
|
72
|
+
SSX_LOGGER.info("Zebra armed.")
|
|
75
73
|
|
|
76
74
|
|
|
77
75
|
def disarm_zebra(zebra: Zebra):
|
|
78
76
|
yield from bps.abs_set(zebra.pc.arm, ArmDemand.DISARM, wait=True) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809
|
|
79
|
-
|
|
77
|
+
SSX_LOGGER.info("Zebra disarmed.")
|
|
80
78
|
|
|
81
79
|
|
|
82
80
|
def open_fast_shutter(zebra: Zebra):
|
|
83
81
|
yield from bps.abs_set(zebra.inputs.soft_in_2, SoftInState.YES, wait=True)
|
|
84
|
-
|
|
82
|
+
SSX_LOGGER.info("Fast shutter open.")
|
|
85
83
|
|
|
86
84
|
|
|
87
85
|
def close_fast_shutter(zebra: Zebra):
|
|
88
86
|
yield from bps.abs_set(zebra.inputs.soft_in_2, SoftInState.NO, wait=True)
|
|
89
|
-
|
|
87
|
+
SSX_LOGGER.info("Fast shutter closed.")
|
|
90
88
|
|
|
91
89
|
|
|
92
90
|
def set_shutter_mode(zebra: Zebra, mode: str):
|
|
93
91
|
# SOFT_IN:B0 has to be disabled for manual mode
|
|
94
92
|
yield from bps.abs_set(zebra.inputs.soft_in_1, SHUTTER_MODE[mode], wait=True)
|
|
95
|
-
|
|
93
|
+
SSX_LOGGER.info(f"Shutter mode set to {mode}.")
|
|
96
94
|
|
|
97
95
|
|
|
98
96
|
def setup_pc_sources(
|
|
@@ -124,12 +122,12 @@ def setup_zebra_for_quickshot_plan(
|
|
|
124
122
|
exp_time (float): Collection exposure time, in s.
|
|
125
123
|
num_images (float): Number of images to be collected.
|
|
126
124
|
"""
|
|
127
|
-
|
|
125
|
+
SSX_LOGGER.info("Setup ZEBRA for quickshot collection.")
|
|
128
126
|
yield from bps.abs_set(zebra.pc.arm_source, ArmSource.SOFT, group=group)
|
|
129
127
|
yield from setup_pc_sources(zebra, TrigSource.TIME, TrigSource.EXTERNAL)
|
|
130
128
|
|
|
131
129
|
gate_width = exp_time * num_images + 0.5
|
|
132
|
-
|
|
130
|
+
SSX_LOGGER.info(f"Gate start set to {GATE_START}, with width {gate_width}.")
|
|
133
131
|
yield from bps.abs_set(zebra.pc.gate_start, GATE_START, group=group)
|
|
134
132
|
yield from bps.abs_set(zebra.pc.gate_width, gate_width, group=group)
|
|
135
133
|
|
|
@@ -138,7 +136,7 @@ def setup_zebra_for_quickshot_plan(
|
|
|
138
136
|
|
|
139
137
|
if wait:
|
|
140
138
|
yield from bps.wait(group)
|
|
141
|
-
|
|
139
|
+
SSX_LOGGER.info("Finished setting up zebra.")
|
|
142
140
|
|
|
143
141
|
|
|
144
142
|
def set_logic_gates_for_porto_triggering(
|
|
@@ -204,7 +202,7 @@ def setup_zebra_for_extruder_with_pump_probe_plan(
|
|
|
204
202
|
pulse1_delay (float, optional): Delay to start pulse1 (the laser control) after \
|
|
205
203
|
gate start. Defaults to 0.0.
|
|
206
204
|
"""
|
|
207
|
-
|
|
205
|
+
SSX_LOGGER.info("Setup ZEBRA for pump probe extruder collection.")
|
|
208
206
|
|
|
209
207
|
yield from set_shutter_mode(zebra, "manual")
|
|
210
208
|
|
|
@@ -226,7 +224,7 @@ def setup_zebra_for_extruder_with_pump_probe_plan(
|
|
|
226
224
|
gate_width, gate_step = get_zebra_settings_for_extruder(
|
|
227
225
|
exp_time, pump_exp, pump_delay
|
|
228
226
|
)
|
|
229
|
-
|
|
227
|
+
SSX_LOGGER.info(
|
|
230
228
|
f"""
|
|
231
229
|
Gate start set to {GATE_START}, with calculated width {gate_width}
|
|
232
230
|
and step {gate_step}.
|
|
@@ -241,13 +239,13 @@ def setup_zebra_for_extruder_with_pump_probe_plan(
|
|
|
241
239
|
# Settings for extruder pump probe:
|
|
242
240
|
# PULSE1_DLY is the start (0 usually), PULSE1_WID is the laser dwell set on edm
|
|
243
241
|
# PULSE2_DLY is the laser delay set on edm, PULSE2_WID is the exposure time
|
|
244
|
-
|
|
242
|
+
SSX_LOGGER.info(
|
|
245
243
|
f"Pulse1 starting at {pulse1_delay} with width set to laser dwell {pump_exp}."
|
|
246
244
|
)
|
|
247
245
|
yield from bps.abs_set(zebra.output.pulse_1.input, PC_GATE, group=group)
|
|
248
246
|
yield from bps.abs_set(zebra.output.pulse_1.delay, pulse1_delay, group=group)
|
|
249
247
|
yield from bps.abs_set(zebra.output.pulse_1.width, pump_exp, group=group)
|
|
250
|
-
|
|
248
|
+
SSX_LOGGER.info(
|
|
251
249
|
f"""
|
|
252
250
|
Pulse2 starting at laser delay {pump_delay} with width set to \
|
|
253
251
|
exposure time {exp_time}.
|
|
@@ -259,7 +257,7 @@ def setup_zebra_for_extruder_with_pump_probe_plan(
|
|
|
259
257
|
|
|
260
258
|
if wait:
|
|
261
259
|
yield from bps.wait(group)
|
|
262
|
-
|
|
260
|
+
SSX_LOGGER.info("Finished setting up zebra.")
|
|
263
261
|
|
|
264
262
|
|
|
265
263
|
def setup_zebra_for_fastchip_plan(
|
|
@@ -302,7 +300,7 @@ def setup_zebra_for_fastchip_plan(
|
|
|
302
300
|
start_time_offset (float): Delay on the start of the position compare. \
|
|
303
301
|
Defaults to 0.0 (standard chip collection).
|
|
304
302
|
"""
|
|
305
|
-
|
|
303
|
+
SSX_LOGGER.info("Setup ZEBRA for a fixed target collection.")
|
|
306
304
|
|
|
307
305
|
yield from set_shutter_mode(zebra, "manual")
|
|
308
306
|
|
|
@@ -341,7 +339,7 @@ def setup_zebra_for_fastchip_plan(
|
|
|
341
339
|
|
|
342
340
|
if wait:
|
|
343
341
|
yield from bps.wait(group)
|
|
344
|
-
|
|
342
|
+
SSX_LOGGER.info("Finished setting up zebra.")
|
|
345
343
|
|
|
346
344
|
|
|
347
345
|
def open_fast_shutter_at_each_position_plan(
|
|
@@ -371,10 +369,10 @@ def open_fast_shutter_at_each_position_plan(
|
|
|
371
369
|
num_exposures (int): Number of times data is collected in each aperture.
|
|
372
370
|
exposure_time (float): Exposure time for each shot.
|
|
373
371
|
"""
|
|
374
|
-
|
|
372
|
+
SSX_LOGGER.info(
|
|
375
373
|
"ZEBRA setup for fastchip collection with long delays between exposures."
|
|
376
374
|
)
|
|
377
|
-
|
|
375
|
+
SSX_LOGGER.debug("Controlling the fast shutter on PULSE2.")
|
|
378
376
|
# Output panel pulse_2 settings
|
|
379
377
|
yield from bps.abs_set(zebra.output.pulse_2.input, PC_GATE, group=group)
|
|
380
378
|
yield from bps.abs_set(zebra.output.pulse_2.delay, 0.0, group=group)
|
|
@@ -386,7 +384,7 @@ def open_fast_shutter_at_each_position_plan(
|
|
|
386
384
|
|
|
387
385
|
if wait:
|
|
388
386
|
yield from bps.wait(group=group)
|
|
389
|
-
|
|
387
|
+
SSX_LOGGER.debug("Finished setting up for long delays.")
|
|
390
388
|
|
|
391
389
|
|
|
392
390
|
def reset_pc_gate_and_pulse(zebra: Zebra, group: str = "reset_pc"):
|
|
@@ -444,16 +442,16 @@ def zebra_return_to_normal_plan(
|
|
|
444
442
|
|
|
445
443
|
if wait:
|
|
446
444
|
yield from bps.wait(group)
|
|
447
|
-
|
|
445
|
+
SSX_LOGGER.info("Zebra settings back to normal.")
|
|
448
446
|
|
|
449
447
|
|
|
450
448
|
def reset_zebra_when_collection_done_plan(zebra: Zebra):
|
|
451
449
|
"""
|
|
452
450
|
End of collection zebra operations: close fast shutter, disarm and reset settings.
|
|
453
451
|
"""
|
|
454
|
-
|
|
452
|
+
SSX_LOGGER.debug("Close the fast shutter.")
|
|
455
453
|
yield from close_fast_shutter(zebra)
|
|
456
|
-
|
|
454
|
+
SSX_LOGGER.debug("Disarm the zebra.")
|
|
457
455
|
yield from disarm_zebra(zebra)
|
|
458
|
-
|
|
456
|
+
SSX_LOGGER.debug("Set zebra back to normal.")
|
|
459
457
|
yield from zebra_return_to_normal_plan(zebra, wait=True)
|