mx-bluesky 1.4.0__py3-none-any.whl → 1.4.1a0__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/thawing_plan.py +1 -1
- mx_bluesky/beamlines/i24/serial/dcid.py +19 -21
- mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +2 -2
- mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/DiamondChipI24-py3v1.edl +1 -4
- mx_bluesky/beamlines/i24/serial/fixed_target/ft_utils.py +0 -1
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +14 -24
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +18 -76
- 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/constants.py +0 -1
- mx_bluesky/beamlines/i24/serial/run_fixed_target.sh +4 -3
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +78 -80
- 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 +11 -11
- mx_bluesky/common/external_interaction/config_server.py +46 -0
- mx_bluesky/common/parameters/components.py +52 -15
- mx_bluesky/common/parameters/constants.py +6 -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/setup_panda.py +4 -4
- mx_bluesky/hyperion/device_setup_plans/setup_zebra.py +1 -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 +131 -89
- mx_bluesky/hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py +50 -18
- mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +52 -10
- mx_bluesky/hyperion/experiment_plans/oav_grid_detection_plan.py +2 -2
- mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +3 -9
- 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 +2 -2
- mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +6 -10
- mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +46 -11
- mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +18 -3
- mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +2 -3
- mx_bluesky/hyperion/external_interaction/callbacks/common/abstract_event.py +66 -0
- mx_bluesky/hyperion/external_interaction/callbacks/grid_detection_callback.py +15 -15
- 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/xray_centre/ispyb_callback.py +5 -2
- 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/ispyb/exp_eye_store.py +1 -1
- 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.1a0.dist-info}/METADATA +35 -34
- {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/RECORD +62 -58
- {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1a0.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.1a0.dist-info}/LICENSE +0 -0
- {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/entry_points.txt +0 -0
- {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import logging
|
|
2
1
|
from time import sleep
|
|
3
2
|
|
|
4
3
|
import bluesky.plan_stubs as bps
|
|
@@ -7,11 +6,10 @@ from dodal.devices.i24.beamstop import Beamstop, BeamstopPositions
|
|
|
7
6
|
from dodal.devices.i24.dual_backlight import BacklightPositions, DualBacklight
|
|
8
7
|
from dodal.devices.i24.i24_detector_motion import DetectorMotion
|
|
9
8
|
|
|
9
|
+
from mx_bluesky.beamlines.i24.serial.log import SSX_LOGGER
|
|
10
10
|
from mx_bluesky.beamlines.i24.serial.setup_beamline import pv
|
|
11
11
|
from mx_bluesky.beamlines.i24.serial.setup_beamline.ca import caget, caput
|
|
12
12
|
|
|
13
|
-
logger = logging.getLogger("I24ssx.sup")
|
|
14
|
-
|
|
15
13
|
|
|
16
14
|
def setup_beamline_for_collection_plan(
|
|
17
15
|
aperture: Aperture,
|
|
@@ -20,7 +18,7 @@ def setup_beamline_for_collection_plan(
|
|
|
20
18
|
group: str = "setup_beamline_collect",
|
|
21
19
|
wait: bool = True,
|
|
22
20
|
):
|
|
23
|
-
|
|
21
|
+
SSX_LOGGER.debug("Setup beamline: collect.")
|
|
24
22
|
yield from bps.abs_set(aperture.position, AperturePositions.IN, group=group)
|
|
25
23
|
yield from bps.abs_set(backlight, BacklightPositions.OUT, group=group)
|
|
26
24
|
yield from bps.sleep(3) # Not sure needed - to test
|
|
@@ -38,8 +36,8 @@ def move_detector_stage_to_position_plan(
|
|
|
38
36
|
detector_stage: DetectorMotion,
|
|
39
37
|
detector_distance: float,
|
|
40
38
|
):
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
SSX_LOGGER.debug("Setup beamline: moving detector stage.")
|
|
40
|
+
SSX_LOGGER.debug(
|
|
43
41
|
f"Waiting for detector move. Detector distance: {detector_distance} mm."
|
|
44
42
|
)
|
|
45
43
|
yield from bps.mv(detector_stage.z, detector_distance) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809
|
|
@@ -60,7 +58,7 @@ def modechange(action):
|
|
|
60
58
|
caput(pv.fluo_trans, "OUT")
|
|
61
59
|
caput(pv.cstrm_p1701, 0)
|
|
62
60
|
caput(pv.cstrm_mp_select, "Out")
|
|
63
|
-
|
|
61
|
+
SSX_LOGGER.debug("Pin Hand Mount Done")
|
|
64
62
|
|
|
65
63
|
# Pin Room Tempreature Hand Mount
|
|
66
64
|
elif action == "Pin_rt_hand_mount":
|
|
@@ -75,7 +73,7 @@ def modechange(action):
|
|
|
75
73
|
caput(pv.vgon_pinxs, 0)
|
|
76
74
|
caput(pv.vgon_pinzs, 0)
|
|
77
75
|
caput(pv.fluo_trans, "OUT")
|
|
78
|
-
|
|
76
|
+
SSX_LOGGER.debug("RT Pin Hand Mount Done")
|
|
79
77
|
|
|
80
78
|
# Pin Data Collection
|
|
81
79
|
elif action == "Pin_data_collection":
|
|
@@ -94,11 +92,11 @@ def modechange(action):
|
|
|
94
92
|
caput(pv.bs_mp_select, "Data Collection")
|
|
95
93
|
sleep(2.3)
|
|
96
94
|
caput(pv.bl_mp_select, "In")
|
|
97
|
-
|
|
95
|
+
SSX_LOGGER.debug("Pin Data Collection Done")
|
|
98
96
|
|
|
99
97
|
# Pin Room Tempreature Data Collection
|
|
100
98
|
elif action == "Pin_rt_data_collection":
|
|
101
|
-
|
|
99
|
+
SSX_LOGGER.debug("RT Mode")
|
|
102
100
|
caput(pv.cstrm_p1701, 0)
|
|
103
101
|
caput(pv.cstrm_mp_select, "Away")
|
|
104
102
|
caput(pv.aptr1_mp_select, "In")
|
|
@@ -114,7 +112,7 @@ def modechange(action):
|
|
|
114
112
|
sleep(2.6)
|
|
115
113
|
caput(pv.bl_mp_select, "In")
|
|
116
114
|
caput(pv.bs_mp_select, "Data Collection")
|
|
117
|
-
|
|
115
|
+
SSX_LOGGER.debug("RT Data Collection Done")
|
|
118
116
|
|
|
119
117
|
# Tray Hand Mount
|
|
120
118
|
elif action == "Tray_hand_mount":
|
|
@@ -128,7 +126,7 @@ def modechange(action):
|
|
|
128
126
|
caput(pv.bs_mp_select, "Tray Mount")
|
|
129
127
|
while float(caget(pv.ttab_x + ".RBV")) > 3:
|
|
130
128
|
sleep(1)
|
|
131
|
-
|
|
129
|
+
SSX_LOGGER.debug("Tray Hand Mount Done")
|
|
132
130
|
|
|
133
131
|
# Tray Robot Load. This action needs to be reviewed and revised
|
|
134
132
|
elif action == "Tray_robot_load":
|
|
@@ -150,11 +148,11 @@ def modechange(action):
|
|
|
150
148
|
caput(pv.bs_roty, 0)
|
|
151
149
|
sleep(4)
|
|
152
150
|
caput(pv.bl_mp_select, "In")
|
|
153
|
-
|
|
151
|
+
SSX_LOGGER.debug("Tray Robot Mount Done")
|
|
154
152
|
|
|
155
153
|
# Tray Data Collection
|
|
156
154
|
elif action == "Tray_data_collection":
|
|
157
|
-
|
|
155
|
+
SSX_LOGGER.debug("This should be E11 on the test tray (CrystalQuickX)")
|
|
158
156
|
caput(pv.ttab_x, 37.4)
|
|
159
157
|
caput(pv.hgon_trayys, -8.0)
|
|
160
158
|
caput(pv.hgon_trayzs, -2.1)
|
|
@@ -171,7 +169,7 @@ def modechange(action):
|
|
|
171
169
|
caput(pv.bs_roty, 0)
|
|
172
170
|
sleep(4)
|
|
173
171
|
caput(pv.bl_mp_select, "In")
|
|
174
|
-
|
|
172
|
+
SSX_LOGGER.debug("Tray Data Collection Done")
|
|
175
173
|
|
|
176
174
|
# Pin Switch to Tray
|
|
177
175
|
elif action == "Pin_switch2tray":
|
|
@@ -192,19 +190,19 @@ def modechange(action):
|
|
|
192
190
|
caput(pv.vgon_pinyh, 0)
|
|
193
191
|
caput(pv.vgon_pinzs, 0)
|
|
194
192
|
while float(caget(pv.ttab_x + ".RBV")) > 1:
|
|
195
|
-
|
|
193
|
+
SSX_LOGGER.debug(f"moving ttab_x {caget(pv.ttab_x)}")
|
|
196
194
|
sleep(0.1)
|
|
197
195
|
while caget(pv.fluo_out_limit) == "OFF":
|
|
198
|
-
|
|
196
|
+
SSX_LOGGER.debug("waiting on fluorescence detector")
|
|
199
197
|
sleep(0.1)
|
|
200
198
|
while caget(pv.bl_mp_select) != "Out":
|
|
201
|
-
|
|
199
|
+
SSX_LOGGER.debug("waiting on back light to move to out")
|
|
202
200
|
sleep(0.1)
|
|
203
201
|
caput(pv.bs_mp_select, "Robot")
|
|
204
202
|
caput(pv.bs_roty, 0)
|
|
205
203
|
while float(caget(pv.ptab_y + ".RBV")) > -89.0:
|
|
206
204
|
sleep(1)
|
|
207
|
-
|
|
205
|
+
SSX_LOGGER.debug("Switch To Tray Done")
|
|
208
206
|
|
|
209
207
|
# Tray Switch to Pin
|
|
210
208
|
elif action == "Tray_switch2pin":
|
|
@@ -218,26 +216,26 @@ def modechange(action):
|
|
|
218
216
|
while float(caget(pv.ptab_y + ".RBV")) < -1.0:
|
|
219
217
|
sleep(1)
|
|
220
218
|
modechange("Pin_data_collection")
|
|
221
|
-
|
|
219
|
+
SSX_LOGGER.debug("Switch To Pin Done")
|
|
222
220
|
else:
|
|
223
|
-
|
|
221
|
+
SSX_LOGGER.debug(f"Unknown action: {action}")
|
|
224
222
|
return 1
|
|
225
223
|
|
|
226
224
|
|
|
227
225
|
def pilatus(action, args_list):
|
|
228
|
-
|
|
229
|
-
|
|
226
|
+
SSX_LOGGER.debug("***** Entering Pilatus")
|
|
227
|
+
SSX_LOGGER.info(f"Setup pilatus - {action}")
|
|
230
228
|
if args_list:
|
|
231
229
|
for arg in args_list:
|
|
232
|
-
|
|
230
|
+
SSX_LOGGER.debug(f"Argument: {arg}")
|
|
233
231
|
|
|
234
232
|
# caput(pv.pilat_wavelength, caget(pv.dcm_lambda))
|
|
235
233
|
caput(pv.pilat_detdist, caget(pv.det_z))
|
|
236
234
|
caput(pv.pilat_filtertrasm, caget(pv.attn_match))
|
|
237
|
-
|
|
235
|
+
SSX_LOGGER.warning("WARNING: Have you set beam X and Y?")
|
|
238
236
|
# 16 Fed 2022 last change DA
|
|
239
|
-
caput(pv.pilat_beamx,
|
|
240
|
-
caput(pv.pilat_beamy,
|
|
237
|
+
caput(pv.pilat_beamx, 1284.7)
|
|
238
|
+
caput(pv.pilat_beamy, 1308.6)
|
|
241
239
|
sleep(0.1)
|
|
242
240
|
|
|
243
241
|
# Fixed Target stage (very fast start and stop w/ triggering from GeoBrick
|
|
@@ -245,12 +243,12 @@ def pilatus(action, args_list):
|
|
|
245
243
|
[filepath, filename, total_numb_imgs, exptime] = args_list
|
|
246
244
|
rampath = filepath.replace("dls/i24/data", "ramdisk")
|
|
247
245
|
acqtime = float(exptime) - 0.001
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
246
|
+
SSX_LOGGER.debug(f"Filepath was set as {filepath}")
|
|
247
|
+
SSX_LOGGER.debug(f"Rampath set as {rampath}")
|
|
248
|
+
SSX_LOGGER.debug(f"Filename set as {filename}")
|
|
249
|
+
SSX_LOGGER.debug(f"total_numb_imgs {total_numb_imgs}")
|
|
250
|
+
SSX_LOGGER.debug(f"Exposure time set as {exptime} s")
|
|
251
|
+
SSX_LOGGER.debug(f"Acquire time set as {acqtime} s")
|
|
254
252
|
caput(pv.pilat_startangle, 0.0)
|
|
255
253
|
caput(pv.pilat_angleincr, 0.0)
|
|
256
254
|
caput(pv.pilat_omegaincr, 0.0)
|
|
@@ -265,7 +263,7 @@ def pilatus(action, args_list):
|
|
|
265
263
|
|
|
266
264
|
# Quick set of images no coordinated motion
|
|
267
265
|
elif action == "quickshot":
|
|
268
|
-
|
|
266
|
+
SSX_LOGGER.debug("quickshot")
|
|
269
267
|
[filepath, filename, num_imgs, exptime] = args_list
|
|
270
268
|
rampath = filepath.replace("dls/i24/data", "ramdisk")
|
|
271
269
|
caput(pv.pilat_filepath, rampath)
|
|
@@ -275,13 +273,13 @@ def pilatus(action, args_list):
|
|
|
275
273
|
acqtime = float(exptime) - 0.001
|
|
276
274
|
caput(pv.pilat_acquiretime, str(acqtime))
|
|
277
275
|
caput(pv.pilat_acquireperiod, str(exptime))
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
276
|
+
SSX_LOGGER.debug(f"Filepath was set as {filepath}")
|
|
277
|
+
SSX_LOGGER.debug(f"Rampath set as {rampath}")
|
|
278
|
+
SSX_LOGGER.debug(f"Filename set as {filename}")
|
|
279
|
+
SSX_LOGGER.debug(f"num_imgs {num_imgs}")
|
|
280
|
+
SSX_LOGGER.debug(f"Exposure time set as {exptime} s")
|
|
281
|
+
SSX_LOGGER.debug(f"Acquire time set as {acqtime} s")
|
|
282
|
+
SSX_LOGGER.debug("Pilatus takes time apprx 2sec")
|
|
285
283
|
sleep(2)
|
|
286
284
|
caput(pv.pilat_delaytime, 0.00)
|
|
287
285
|
caput(pv.pilat_numimages, str(num_imgs))
|
|
@@ -290,7 +288,7 @@ def pilatus(action, args_list):
|
|
|
290
288
|
sleep(0.2)
|
|
291
289
|
|
|
292
290
|
elif action == "quickshot-internaltrig":
|
|
293
|
-
|
|
291
|
+
SSX_LOGGER.debug("quickshot-internaltrig")
|
|
294
292
|
[filepath, filename, num_imgs, exptime] = args_list
|
|
295
293
|
rampath = filepath.replace("dls/i24/data", "ramdisk")
|
|
296
294
|
caput(pv.pilat_filepath, rampath)
|
|
@@ -300,13 +298,13 @@ def pilatus(action, args_list):
|
|
|
300
298
|
acqtime = float(exptime) - 0.001
|
|
301
299
|
caput(pv.pilat_acquiretime, str(acqtime))
|
|
302
300
|
caput(pv.pilat_acquireperiod, str(exptime))
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
301
|
+
SSX_LOGGER.debug(f"Filepath was set as {filepath}")
|
|
302
|
+
SSX_LOGGER.debug(f"Rampath set as {rampath}")
|
|
303
|
+
SSX_LOGGER.debug(f"Filename set as {filename}")
|
|
304
|
+
SSX_LOGGER.debug(f"num_imgs {num_imgs}")
|
|
305
|
+
SSX_LOGGER.debug(f"Exposure time set as {exptime} s")
|
|
306
|
+
SSX_LOGGER.debug(f"Acquire time set as {acqtime} s")
|
|
307
|
+
SSX_LOGGER.debug("Pilatus takes time apprx 2sec")
|
|
310
308
|
sleep(2)
|
|
311
309
|
caput(pv.pilat_delaytime, 0.00)
|
|
312
310
|
caput(pv.pilat_numimages, str(num_imgs))
|
|
@@ -319,24 +317,24 @@ def pilatus(action, args_list):
|
|
|
319
317
|
caput(pv.pilat_imagemode, "Continuous")
|
|
320
318
|
caput(pv.pilat_triggermode, "Ext. Trigger")
|
|
321
319
|
caput(pv.pilat_numexpimage, 1)
|
|
322
|
-
|
|
320
|
+
SSX_LOGGER.debug("***** leaving pilatus")
|
|
323
321
|
sleep(0.1)
|
|
324
322
|
return 0
|
|
325
323
|
|
|
326
324
|
|
|
327
325
|
def eiger(action, args_list):
|
|
328
|
-
|
|
329
|
-
|
|
326
|
+
SSX_LOGGER.debug("***** Entering Eiger")
|
|
327
|
+
SSX_LOGGER.info(f"Setup eiger - {action}")
|
|
330
328
|
if args_list:
|
|
331
329
|
for arg in args_list:
|
|
332
|
-
|
|
330
|
+
SSX_LOGGER.debug(f"Argument: {arg}")
|
|
333
331
|
# caput(pv.eiger_wavelength, caget(pv.dcm_lambda))
|
|
334
332
|
caput(pv.eiger_detdist, str(float(caget(pv.det_z)) / 1000))
|
|
335
|
-
|
|
333
|
+
SSX_LOGGER.warning("WARNING: Have you set header info?")
|
|
336
334
|
caput(pv.eiger_wavelength, caget(pv.dcm_lambda))
|
|
337
335
|
caput(pv.eiger_omegaincr, 0.0)
|
|
338
|
-
caput(pv.eiger_beamx,
|
|
339
|
-
caput(pv.eiger_beamy,
|
|
336
|
+
caput(pv.eiger_beamx, 1600.0)
|
|
337
|
+
caput(pv.eiger_beamy, 1697.4)
|
|
340
338
|
sleep(0.1)
|
|
341
339
|
# Setup common to all collections ###
|
|
342
340
|
caput(pv.eiger_filewriter, "No")
|
|
@@ -354,7 +352,7 @@ def eiger(action, args_list):
|
|
|
354
352
|
# Quick set of images no coordinated motion
|
|
355
353
|
if action == "quickshot":
|
|
356
354
|
# Sends a single trigger to start data collection
|
|
357
|
-
|
|
355
|
+
SSX_LOGGER.debug("Eiger quickshot")
|
|
358
356
|
[filepath, filename, num_imgs, exptime] = args_list
|
|
359
357
|
filename = filename + "_" + str(caget(pv.eiger_seqID))
|
|
360
358
|
caput(pv.eiger_ODfilepath, filepath)
|
|
@@ -363,11 +361,11 @@ def eiger(action, args_list):
|
|
|
363
361
|
sleep(0.1)
|
|
364
362
|
acqtime = float(exptime) - 0.0000001
|
|
365
363
|
caput(pv.eiger_acquiretime, str(acqtime))
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
364
|
+
SSX_LOGGER.debug(f"Filepath was set as {filepath}")
|
|
365
|
+
SSX_LOGGER.debug(f"Filename set as {filename}")
|
|
366
|
+
SSX_LOGGER.debug(f"num_imgs {num_imgs}")
|
|
367
|
+
SSX_LOGGER.debug(f"Exposure time set as {exptime} s")
|
|
368
|
+
SSX_LOGGER.debug(f"Acquire time set as {acqtime} s")
|
|
371
369
|
caput(pv.eiger_acquireperiod, str(exptime))
|
|
372
370
|
caput(pv.eiger_numimages, str(num_imgs))
|
|
373
371
|
caput(pv.eiger_imagemode, "Continuous")
|
|
@@ -376,7 +374,7 @@ def eiger(action, args_list):
|
|
|
376
374
|
caput(pv.eiger_manualtrigger, "Yes")
|
|
377
375
|
sleep(1.0)
|
|
378
376
|
# ODIN setup
|
|
379
|
-
|
|
377
|
+
SSX_LOGGER.info("Setting up Odin")
|
|
380
378
|
caput(pv.eiger_ODfilename, filename)
|
|
381
379
|
caput(pv.eiger_ODfilepath, filepath)
|
|
382
380
|
caput(pv.eiger_ODnumcapture, str(num_imgs))
|
|
@@ -386,17 +384,17 @@ def eiger(action, args_list):
|
|
|
386
384
|
caput(pv.eiger_ODcompress, "BSL24")
|
|
387
385
|
sleep(1.0)
|
|
388
386
|
# All done. Now get Odin to wait for data and start Eiger
|
|
389
|
-
|
|
387
|
+
SSX_LOGGER.info("Done: Odin waiting for data")
|
|
390
388
|
caput(pv.eiger_ODcapture, "Capture")
|
|
391
389
|
# If detector fails to arm first time can try twice with a sleep inbetween
|
|
392
|
-
|
|
390
|
+
SSX_LOGGER.info("Arming Eiger")
|
|
393
391
|
caput(pv.eiger_acquire, "1")
|
|
394
392
|
# Will now wait for Manual trigger. Add the below line to your DAQ script ###
|
|
395
393
|
# caput(pv.eiger_trigger, 1)
|
|
396
394
|
|
|
397
395
|
if action == "triggered":
|
|
398
396
|
# Send a trigger for every image. Records while TTL is high
|
|
399
|
-
|
|
397
|
+
SSX_LOGGER.info("Eiger triggered")
|
|
400
398
|
[filepath, filename, num_imgs, exptime] = args_list
|
|
401
399
|
filename = filename + "_" + str(caget(pv.eiger_seqID))
|
|
402
400
|
caput(pv.eiger_ODfilepath, filepath)
|
|
@@ -405,11 +403,11 @@ def eiger(action, args_list):
|
|
|
405
403
|
sleep(0.1)
|
|
406
404
|
acqtime = float(exptime) - 0.0000001
|
|
407
405
|
caput(pv.eiger_acquiretime, str(acqtime))
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
406
|
+
SSX_LOGGER.debug(f"Filepath was set as {filepath}")
|
|
407
|
+
SSX_LOGGER.debug(f"Filename set as {filename}")
|
|
408
|
+
SSX_LOGGER.debug(f"num_imgs {num_imgs}")
|
|
409
|
+
SSX_LOGGER.debug(f"Exposure time set as {exptime} s")
|
|
410
|
+
SSX_LOGGER.debug(f"Acquire time set as {acqtime} s")
|
|
413
411
|
caput(pv.eiger_acquireperiod, str(exptime))
|
|
414
412
|
caput(pv.eiger_numimages, 1)
|
|
415
413
|
caput(pv.eiger_imagemode, "Continuous")
|
|
@@ -418,7 +416,7 @@ def eiger(action, args_list):
|
|
|
418
416
|
caput(pv.eiger_manualtrigger, "Yes")
|
|
419
417
|
sleep(1.0)
|
|
420
418
|
# ODIN setup #
|
|
421
|
-
|
|
419
|
+
SSX_LOGGER.info("Setting up Odin")
|
|
422
420
|
caput(pv.eiger_ODfilename, filename)
|
|
423
421
|
caput(pv.eiger_ODfilepath, filepath)
|
|
424
422
|
caput(pv.eiger_ODnumcapture, str(num_imgs))
|
|
@@ -428,10 +426,10 @@ def eiger(action, args_list):
|
|
|
428
426
|
caput(pv.eiger_ODcompress, "BSL24")
|
|
429
427
|
sleep(1.0)
|
|
430
428
|
# All done. Now get Odin to wait for data and start Eiger
|
|
431
|
-
|
|
429
|
+
SSX_LOGGER.info("Done: Odin waiting for data")
|
|
432
430
|
caput(pv.eiger_ODcapture, "Capture")
|
|
433
431
|
# If detector fails to arm first time can try twice with a sleep inbetween
|
|
434
|
-
|
|
432
|
+
SSX_LOGGER.info("Arming Eiger")
|
|
435
433
|
caput(pv.eiger_acquire, "1")
|
|
436
434
|
# Will now wait for Manual trigger. Add the below line to your DAQ script
|
|
437
435
|
# caput(pv.eiger_trigger, 1)
|
|
@@ -440,17 +438,17 @@ def eiger(action, args_list):
|
|
|
440
438
|
elif action == "return-to-normal":
|
|
441
439
|
caput(pv.eiger_manualtrigger, "No")
|
|
442
440
|
# caput(pv.eiger_seqID, int(caget(pv.eiger_seqID))+1)
|
|
443
|
-
|
|
441
|
+
SSX_LOGGER.debug("***** leaving Eiger")
|
|
444
442
|
sleep(0.1)
|
|
445
443
|
return 0
|
|
446
444
|
|
|
447
445
|
|
|
448
446
|
def xspress3(action, args_list):
|
|
449
|
-
|
|
450
|
-
|
|
447
|
+
SSX_LOGGER.debug("***** Entering xspress3")
|
|
448
|
+
SSX_LOGGER.info(f"xspress3 - {action}")
|
|
451
449
|
if args_list:
|
|
452
450
|
for arg in args_list:
|
|
453
|
-
|
|
451
|
+
SSX_LOGGER.debug(f"Argument: {arg}")
|
|
454
452
|
|
|
455
453
|
if action == "stop-and-start":
|
|
456
454
|
[exp_time, lo, hi] = args_list
|
|
@@ -486,8 +484,8 @@ def xspress3(action, args_list):
|
|
|
486
484
|
caput(pv.xsp3_erase, 0)
|
|
487
485
|
|
|
488
486
|
else:
|
|
489
|
-
|
|
487
|
+
SSX_LOGGER.error("Unknown action for xspress3 method:", action)
|
|
490
488
|
|
|
491
489
|
sleep(0.1)
|
|
492
|
-
|
|
490
|
+
SSX_LOGGER.debug("***** leaving xspress3")
|
|
493
491
|
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)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import logging
|
|
2
1
|
import os
|
|
3
2
|
import pathlib
|
|
4
3
|
import pprint
|
|
@@ -9,14 +8,13 @@ from typing import Literal
|
|
|
9
8
|
import requests
|
|
10
9
|
|
|
11
10
|
from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import ChipType, MappingType
|
|
11
|
+
from mx_bluesky.beamlines.i24.serial.log import SSX_LOGGER
|
|
12
12
|
from mx_bluesky.beamlines.i24.serial.parameters import (
|
|
13
13
|
ExtruderParameters,
|
|
14
14
|
FixedTargetParameters,
|
|
15
15
|
)
|
|
16
16
|
from mx_bluesky.beamlines.i24.serial.setup_beamline import Eiger, caget, cagetstring
|
|
17
17
|
|
|
18
|
-
logger = logging.getLogger("I24ssx.nexus_writer")
|
|
19
|
-
|
|
20
18
|
|
|
21
19
|
def call_nexgen(
|
|
22
20
|
chip_prog_dict: dict | None,
|
|
@@ -54,23 +52,23 @@ def call_nexgen(
|
|
|
54
52
|
)
|
|
55
53
|
t0 = time.time()
|
|
56
54
|
max_wait = 60 # seconds
|
|
57
|
-
|
|
55
|
+
SSX_LOGGER.info(f"Watching for {meta_h5}")
|
|
58
56
|
while time.time() - t0 < max_wait:
|
|
59
57
|
if meta_h5.exists():
|
|
60
|
-
|
|
58
|
+
SSX_LOGGER.info(f"Found {meta_h5} after {time.time() - t0:.1f} seconds")
|
|
61
59
|
time.sleep(5)
|
|
62
60
|
break
|
|
63
|
-
|
|
61
|
+
SSX_LOGGER.debug(f"Waiting for {meta_h5}")
|
|
64
62
|
time.sleep(1)
|
|
65
63
|
if not meta_h5.exists():
|
|
66
|
-
|
|
64
|
+
SSX_LOGGER.warning(f"Giving up waiting for {meta_h5} after {max_wait} seconds")
|
|
67
65
|
return False
|
|
68
66
|
|
|
69
67
|
transmission = (float(caget(Eiger.pv.transmission)),)
|
|
70
68
|
|
|
71
69
|
if det_type == Eiger.name:
|
|
72
70
|
bit_depth = int(caget(Eiger.pv.bit_depth))
|
|
73
|
-
|
|
71
|
+
SSX_LOGGER.debug(
|
|
74
72
|
f"Call to nexgen server with the following chip definition: \n{chip_prog_dict}"
|
|
75
73
|
)
|
|
76
74
|
|
|
@@ -96,10 +94,12 @@ def call_nexgen(
|
|
|
96
94
|
"wavelength": wavelength,
|
|
97
95
|
"bit_depth": bit_depth,
|
|
98
96
|
}
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
SSX_LOGGER.info(f"Sending POST request to {url} with payload:")
|
|
98
|
+
SSX_LOGGER.info(pprint.pformat(payload))
|
|
101
99
|
response = requests.post(url, headers=headers, json=payload)
|
|
102
|
-
|
|
100
|
+
SSX_LOGGER.info(
|
|
101
|
+
f"Response: {response.text} (status code: {response.status_code})"
|
|
102
|
+
)
|
|
103
103
|
# the following will raise an error if the request was unsuccessful
|
|
104
104
|
return response.status_code == requests.codes.ok
|
|
105
105
|
return False
|