mx-bluesky 1.2.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/__init__.py +8 -3
- mx_bluesky/__main__.py +12 -7
- mx_bluesky/_version.py +2 -2
- mx_bluesky/beamlines/i04/callbacks/murko_callback.py +14 -4
- mx_bluesky/beamlines/i04/redis_to_murko_forwarder.py +178 -0
- mx_bluesky/beamlines/i04/thawing_plan.py +49 -11
- mx_bluesky/beamlines/i24/serial/__init__.py +3 -0
- 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 +121 -110
- mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/DiamondChipI24-py3v1.edl +3 -6
- mx_bluesky/beamlines/i24/serial/fixed_target/ft_utils.py +0 -1
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +164 -169
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +149 -225
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_StartUp_py3v1.py +7 -216
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py +18 -17
- mx_bluesky/beamlines/i24/serial/log.py +58 -49
- 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/parameters/fixed_target/cs/cs_maker.json +3 -3
- mx_bluesky/beamlines/i24/serial/run_extruder.sh +30 -5
- mx_bluesky/beamlines/i24/serial/run_fixed_target.sh +30 -5
- mx_bluesky/beamlines/i24/serial/run_serial.py +24 -8
- mx_bluesky/beamlines/i24/serial/setup_beamline/ca.py +0 -2
- mx_bluesky/beamlines/i24/serial/setup_beamline/pv.py +2 -0
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +104 -82
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +9 -20
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +26 -28
- mx_bluesky/beamlines/i24/serial/write_nexus.py +74 -72
- mx_bluesky/common/__init__.py +0 -0
- mx_bluesky/common/device_setup_plans/read_hardware_for_setup.py +14 -0
- mx_bluesky/common/external_interaction/config_server.py +46 -0
- mx_bluesky/common/parameters/components.py +258 -0
- mx_bluesky/common/parameters/constants.py +143 -0
- mx_bluesky/common/parameters/gridscan.py +94 -0
- mx_bluesky/common/parameters/robot_load.py +16 -0
- mx_bluesky/common/plans/__init__.py +1 -0
- mx_bluesky/common/plans/do_fgs.py +121 -0
- mx_bluesky/common/utils/log.py +118 -0
- mx_bluesky/{hyperion → common/utils}/tracing.py +2 -2
- mx_bluesky/hyperion/__main__.py +13 -10
- mx_bluesky/hyperion/device_setup_plans/dcm_pitch_roll_mirror_adjuster.py +47 -52
- mx_bluesky/hyperion/device_setup_plans/read_hardware_for_setup.py +6 -12
- mx_bluesky/hyperion/device_setup_plans/setup_oav.py +6 -12
- mx_bluesky/hyperion/device_setup_plans/setup_panda.py +5 -6
- mx_bluesky/hyperion/device_setup_plans/setup_zebra.py +49 -18
- mx_bluesky/hyperion/device_setup_plans/smargon.py +9 -9
- mx_bluesky/hyperion/device_setup_plans/utils.py +2 -2
- mx_bluesky/hyperion/device_setup_plans/xbpm_feedback.py +4 -4
- 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 +147 -169
- mx_bluesky/hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py +48 -22
- mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +75 -9
- mx_bluesky/hyperion/experiment_plans/oav_grid_detection_plan.py +21 -20
- mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +9 -6
- mx_bluesky/hyperion/experiment_plans/optimise_attenuation_plan.py +2 -2
- mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +40 -21
- mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +22 -22
- mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +43 -39
- mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +69 -18
- mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +17 -7
- mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +13 -13
- mx_bluesky/hyperion/external_interaction/callbacks/__init__.py +0 -4
- mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +5 -2
- 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/common/ispyb_mapping.py +1 -1
- mx_bluesky/hyperion/external_interaction/callbacks/grid_detection_callback.py +30 -25
- mx_bluesky/hyperion/external_interaction/callbacks/ispyb_callback_base.py +29 -12
- mx_bluesky/hyperion/external_interaction/callbacks/log_uid_tag_callback.py +1 -1
- mx_bluesky/hyperion/external_interaction/callbacks/robot_load/ispyb_callback.py +19 -11
- mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_callback.py +7 -4
- 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 +38 -27
- mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/nexus_callback.py +5 -4
- mx_bluesky/hyperion/external_interaction/config_server.py +11 -28
- mx_bluesky/hyperion/external_interaction/exceptions.py +0 -9
- mx_bluesky/hyperion/external_interaction/ispyb/exp_eye_store.py +65 -15
- mx_bluesky/hyperion/external_interaction/ispyb/ispyb_store.py +1 -1
- mx_bluesky/hyperion/external_interaction/nexus/nexus_utils.py +2 -2
- mx_bluesky/hyperion/external_interaction/nexus/write_nexus.py +1 -1
- mx_bluesky/hyperion/log.py +0 -84
- mx_bluesky/hyperion/parameters/components.py +4 -251
- mx_bluesky/hyperion/parameters/constants.py +22 -119
- mx_bluesky/hyperion/parameters/gridscan.py +35 -74
- mx_bluesky/hyperion/parameters/load_centre_collect.py +16 -11
- mx_bluesky/hyperion/parameters/rotation.py +23 -10
- mx_bluesky/hyperion/utils/utils.py +17 -0
- mx_bluesky/hyperion/utils/validation.py +5 -6
- {mx_bluesky-1.2.0.dist-info → mx_bluesky-1.4.1.dist-info}/METADATA +36 -33
- {mx_bluesky-1.2.0.dist-info → mx_bluesky-1.4.1.dist-info}/RECORD +102 -89
- {mx_bluesky-1.2.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 -161
- mx_bluesky/example.py +0 -19
- mx_bluesky/hyperion/parameters/robot_load.py +0 -16
- {mx_bluesky-1.2.0.dist-info → mx_bluesky-1.4.1.dist-info}/LICENSE +0 -0
- {mx_bluesky-1.2.0.dist-info → mx_bluesky-1.4.1.dist-info}/entry_points.txt +0 -0
- {mx_bluesky-1.2.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,11 +46,33 @@ 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
|
-
yield from bps.mv(detector_stage.z, detector_distance)
|
|
53
|
+
yield from bps.mv(detector_stage.z, detector_distance) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809
|
|
54
|
+
|
|
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)
|
|
46
76
|
|
|
47
77
|
|
|
48
78
|
def modechange(action):
|
|
@@ -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
|
|
@@ -2,18 +2,15 @@
|
|
|
2
2
|
Utilities for defining the detector in use, and moving the stage.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
import logging
|
|
6
|
-
import time
|
|
7
5
|
from collections.abc import Generator
|
|
8
6
|
from enum import IntEnum
|
|
9
7
|
|
|
10
8
|
import bluesky.plan_stubs as bps
|
|
11
|
-
from
|
|
12
|
-
from bluesky.utils import Msg
|
|
9
|
+
from bluesky.utils import Msg, MsgGenerator
|
|
13
10
|
from dodal.common import inject
|
|
14
11
|
from dodal.devices.i24.i24_detector_motion import DetectorMotion
|
|
15
12
|
|
|
16
|
-
from mx_bluesky.beamlines.i24.serial import
|
|
13
|
+
from mx_bluesky.beamlines.i24.serial.log import SSX_LOGGER
|
|
17
14
|
from mx_bluesky.beamlines.i24.serial.parameters import SSXType
|
|
18
15
|
from mx_bluesky.beamlines.i24.serial.setup_beamline import pv
|
|
19
16
|
from mx_bluesky.beamlines.i24.serial.setup_beamline.ca import caget
|
|
@@ -23,8 +20,6 @@ from mx_bluesky.beamlines.i24.serial.setup_beamline.pv_abstract import (
|
|
|
23
20
|
Pilatus,
|
|
24
21
|
)
|
|
25
22
|
|
|
26
|
-
logger = logging.getLogger("I24ssx.sup_det")
|
|
27
|
-
|
|
28
23
|
EXPT_TYPE_DETECTOR_PVS = {
|
|
29
24
|
SSXType.FIXED: pv.me14e_gp101,
|
|
30
25
|
SSXType.EXTRUDER: pv.ioc12_gp15,
|
|
@@ -39,11 +34,6 @@ class DetRequest(IntEnum):
|
|
|
39
34
|
return self.name
|
|
40
35
|
|
|
41
36
|
|
|
42
|
-
def setup_logging():
|
|
43
|
-
logfile = time.strftime("SSXdetectorOps_%d%B%y.log").lower()
|
|
44
|
-
log.config(logfile)
|
|
45
|
-
|
|
46
|
-
|
|
47
37
|
class UnknownDetectorType(Exception):
|
|
48
38
|
pass
|
|
49
39
|
|
|
@@ -53,19 +43,19 @@ def get_detector_type(detector_stage: DetectorMotion) -> Generator[Msg, None, De
|
|
|
53
43
|
# DetectorMotion should also be used for this.
|
|
54
44
|
# This should be part of https://github.com/DiamondLightSource/mx_bluesky/issues/51
|
|
55
45
|
if float(det_y) < Eiger.det_y_threshold:
|
|
56
|
-
|
|
46
|
+
SSX_LOGGER.info("Eiger detector in use.")
|
|
57
47
|
return Eiger()
|
|
58
48
|
elif float(det_y) > Pilatus.det_y_threshold:
|
|
59
|
-
|
|
49
|
+
SSX_LOGGER.info("Pilatus detector in use.")
|
|
60
50
|
return Pilatus()
|
|
61
51
|
else:
|
|
62
|
-
|
|
52
|
+
SSX_LOGGER.error("Detector not found.")
|
|
63
53
|
raise UnknownDetectorType("Detector not found.")
|
|
64
54
|
|
|
65
55
|
|
|
66
56
|
def _move_detector_stage(detector_stage: DetectorMotion, target: float) -> MsgGenerator:
|
|
67
|
-
|
|
68
|
-
yield from bps.mv(detector_stage.y, target)
|
|
57
|
+
SSX_LOGGER.info(f"Moving detector stage to target position: {target}.")
|
|
58
|
+
yield from bps.mv(detector_stage.y, target) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809
|
|
69
59
|
|
|
70
60
|
|
|
71
61
|
# Workaround in case the PV value has been set to the detector name
|
|
@@ -94,14 +84,13 @@ def _get_requested_detector(det_type_pv: str) -> str:
|
|
|
94
84
|
def setup_detector_stage(
|
|
95
85
|
expt_type: SSXType, detector_stage: DetectorMotion = inject("detector_motion")
|
|
96
86
|
) -> MsgGenerator:
|
|
97
|
-
setup_logging()
|
|
98
87
|
# Grab the correct PV depending on experiment
|
|
99
88
|
# Its value is set with MUX on edm screen
|
|
100
89
|
det_type_pv = EXPT_TYPE_DETECTOR_PVS[expt_type]
|
|
101
90
|
requested_detector = _get_requested_detector(det_type_pv)
|
|
102
|
-
|
|
91
|
+
SSX_LOGGER.info(f"Requested detector: {requested_detector}.")
|
|
103
92
|
det_y_target = (
|
|
104
93
|
Eiger.det_y_target if requested_detector == "eiger" else Pilatus.det_y_target
|
|
105
94
|
)
|
|
106
95
|
yield from _move_detector_stage(detector_stage, det_y_target)
|
|
107
|
-
|
|
96
|
+
SSX_LOGGER.info("Detector setup done.")
|