mx-bluesky 1.2.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/__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/thawing_plan.py +49 -11
- mx_bluesky/beamlines/i24/serial/__init__.py +3 -0
- mx_bluesky/beamlines/i24/serial/dcid.py +19 -21
- mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +69 -91
- 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 +111 -143
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +141 -222
- 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/constants.py +0 -1
- 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/setup_beamline.py +79 -81
- 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 +11 -11
- 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 +138 -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 +31 -26
- 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 +6 -6
- mx_bluesky/hyperion/device_setup_plans/utils.py +2 -2
- mx_bluesky/hyperion/device_setup_plans/xbpm_feedback.py +4 -4
- 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 +145 -161
- mx_bluesky/hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py +56 -22
- mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +52 -10
- mx_bluesky/hyperion/experiment_plans/oav_grid_detection_plan.py +21 -20
- mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +11 -14
- 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 +19 -19
- mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +21 -21
- mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +51 -13
- mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +24 -7
- mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +5 -6
- mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +1 -2
- mx_bluesky/hyperion/external_interaction/callbacks/common/abstract_event.py +66 -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 +1 -1
- 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/xray_centre/ispyb_callback.py +28 -20
- 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/ispyb/exp_eye_store.py +1 -1
- 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.1a0.dist-info}/METADATA +36 -33
- {mx_bluesky-1.2.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/RECORD +91 -81
- {mx_bluesky-1.2.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 -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.1a0.dist-info}/LICENSE +0 -0
- {mx_bluesky-1.2.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/entry_points.txt +0 -0
- {mx_bluesky-1.2.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/top_level.txt +0 -0
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import argparse
|
|
2
2
|
import subprocess
|
|
3
3
|
from os import environ
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
from mx_bluesky.beamlines.i24.serial.log import SSX_LOGGER
|
|
7
|
+
from mx_bluesky.beamlines.i24.serial.parameters import SSXType
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _parse_input(expt: SSXType):
|
|
11
|
+
parser = argparse.ArgumentParser(description=f"Run a {expt} collection.")
|
|
12
|
+
parser.add_argument("-t", "--test", action="store_true", help="Run in test mode.")
|
|
13
|
+
args = parser.parse_args()
|
|
14
|
+
return args
|
|
7
15
|
|
|
8
16
|
|
|
9
17
|
def get_location(default: str = "dev") -> str:
|
|
@@ -19,18 +27,26 @@ def _get_file_path() -> Path:
|
|
|
19
27
|
|
|
20
28
|
|
|
21
29
|
def run_extruder():
|
|
30
|
+
args = _parse_input(SSXType.EXTRUDER)
|
|
22
31
|
loc = get_location()
|
|
23
|
-
|
|
32
|
+
SSX_LOGGER.info(f"Running on {loc}.")
|
|
24
33
|
edm_path = get_edm_path()
|
|
25
34
|
filepath = _get_file_path()
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
test_mode = "--test" if args.test else ""
|
|
36
|
+
SSX_LOGGER.debug(f"Running {filepath}/run_extruder.sh")
|
|
37
|
+
subprocess.run(
|
|
38
|
+
["bash", filepath / "run_extruder.sh", edm_path.as_posix(), test_mode]
|
|
39
|
+
)
|
|
28
40
|
|
|
29
41
|
|
|
30
42
|
def run_fixed_target():
|
|
43
|
+
args = _parse_input(SSXType.FIXED)
|
|
31
44
|
loc = get_location()
|
|
32
|
-
|
|
45
|
+
SSX_LOGGER.info(f"Running on {loc}.")
|
|
33
46
|
edm_path = get_edm_path()
|
|
34
47
|
filepath = _get_file_path()
|
|
35
|
-
|
|
36
|
-
|
|
48
|
+
test_mode = "--test" if args.test else ""
|
|
49
|
+
SSX_LOGGER.debug(f"Running {filepath}/run_fixed_target.sh")
|
|
50
|
+
subprocess.run(
|
|
51
|
+
["bash", filepath / "run_fixed_target.sh", edm_path.as_posix(), test_mode]
|
|
52
|
+
)
|
|
@@ -22,8 +22,6 @@ def caget(pv):
|
|
|
22
22
|
a = Popen(["caget", pv], stdout=PIPE, stderr=PIPE)
|
|
23
23
|
a_stdout, a_stderr = a.communicate()
|
|
24
24
|
val = a_stdout.split()[1].decode("ascii")
|
|
25
|
-
# val = evaluate(val)
|
|
26
|
-
# val = val.decode('ascii')
|
|
27
25
|
except Exception:
|
|
28
26
|
print("Exception in ca_py3.py caget, maybe this PV doesnt exist:", pv)
|
|
29
27
|
pass
|
|
@@ -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,11 +36,11 @@ 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
|
-
yield from bps.mv(detector_stage.z, detector_distance)
|
|
43
|
+
yield from bps.mv(detector_stage.z, detector_distance) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809
|
|
46
44
|
|
|
47
45
|
|
|
48
46
|
def modechange(action):
|
|
@@ -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
|
|
@@ -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.")
|