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
|
@@ -5,7 +5,6 @@ This version in python3 new Feb2021 by RLO
|
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
import json
|
|
8
|
-
import logging
|
|
9
8
|
import re
|
|
10
9
|
import shutil
|
|
11
10
|
import sys
|
|
@@ -17,19 +16,30 @@ from time import sleep
|
|
|
17
16
|
|
|
18
17
|
import bluesky.plan_stubs as bps
|
|
19
18
|
import bluesky.preprocessors as bpp
|
|
20
|
-
from
|
|
19
|
+
from bluesky.utils import MsgGenerator
|
|
21
20
|
from dodal.common import inject
|
|
21
|
+
from dodal.devices.attenuator import ReadOnlyAttenuator
|
|
22
22
|
from dodal.devices.hutch_shutter import HutchShutter, ShutterDemand
|
|
23
23
|
from dodal.devices.i24.aperture import Aperture
|
|
24
|
+
from dodal.devices.i24.beam_center import DetectorBeamCenter
|
|
24
25
|
from dodal.devices.i24.beamstop import Beamstop
|
|
25
26
|
from dodal.devices.i24.dcm import DCM
|
|
26
27
|
from dodal.devices.i24.dual_backlight import DualBacklight
|
|
28
|
+
from dodal.devices.i24.focus_mirrors import FocusMirrorsMode
|
|
27
29
|
from dodal.devices.i24.i24_detector_motion import DetectorMotion
|
|
28
30
|
from dodal.devices.zebra import DISCONNECT, SOFT_IN3, Zebra
|
|
29
31
|
|
|
30
|
-
from mx_bluesky.beamlines.i24.serial import
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
from mx_bluesky.beamlines.i24.serial.dcid import (
|
|
33
|
+
DCID,
|
|
34
|
+
get_pilatus_filename_template_from_device,
|
|
35
|
+
read_beam_info_from_hardware,
|
|
36
|
+
)
|
|
37
|
+
from mx_bluesky.beamlines.i24.serial.log import (
|
|
38
|
+
SSX_LOGGER,
|
|
39
|
+
_read_visit_directory_from_file,
|
|
40
|
+
log_on_entry,
|
|
41
|
+
)
|
|
42
|
+
from mx_bluesky.beamlines.i24.serial.parameters import ExtruderParameters
|
|
33
43
|
from mx_bluesky.beamlines.i24.serial.parameters.constants import (
|
|
34
44
|
PARAM_FILE_NAME,
|
|
35
45
|
PARAM_FILE_PATH,
|
|
@@ -54,31 +64,22 @@ from mx_bluesky.beamlines.i24.serial.setup_beamline.setup_zebra_plans import (
|
|
|
54
64
|
)
|
|
55
65
|
from mx_bluesky.beamlines.i24.serial.write_nexus import call_nexgen
|
|
56
66
|
|
|
57
|
-
usage = "%(prog)s command [options]"
|
|
58
|
-
logger = logging.getLogger("I24ssx.extruder")
|
|
59
|
-
|
|
60
67
|
SAFE_DET_Z = 1480
|
|
61
68
|
|
|
62
69
|
|
|
63
|
-
def setup_logging():
|
|
64
|
-
logfile = time.strftime("i24extruder_%d%B%y.log").lower()
|
|
65
|
-
log.config(logfile)
|
|
66
|
-
|
|
67
|
-
|
|
68
70
|
def flush_print(text):
|
|
69
71
|
sys.stdout.write(str(text))
|
|
70
72
|
sys.stdout.flush()
|
|
71
73
|
|
|
72
74
|
|
|
73
|
-
@
|
|
75
|
+
@log_on_entry
|
|
74
76
|
def initialise_extruder(
|
|
75
77
|
detector_stage: DetectorMotion = inject("detector_motion"),
|
|
76
78
|
) -> MsgGenerator:
|
|
77
|
-
|
|
78
|
-
logger.info("Initialise Parameters for extruder data collection on I24.")
|
|
79
|
+
SSX_LOGGER.info("Initialise Parameters for extruder data collection on I24.")
|
|
79
80
|
|
|
80
81
|
visit = caget(pv.ioc12_gp1)
|
|
81
|
-
|
|
82
|
+
SSX_LOGGER.info(f"Visit defined {visit}")
|
|
82
83
|
|
|
83
84
|
# Define detector in use
|
|
84
85
|
det_type = yield from get_detector_type(detector_stage)
|
|
@@ -93,11 +94,11 @@ def initialise_extruder(
|
|
|
93
94
|
caput(pv.ioc12_gp10, 0)
|
|
94
95
|
caput(pv.ioc12_gp15, det_type.name)
|
|
95
96
|
caput(pv.pilat_cbftemplate, 0)
|
|
96
|
-
|
|
97
|
+
SSX_LOGGER.info("Initialisation complete.")
|
|
97
98
|
yield from bps.null()
|
|
98
99
|
|
|
99
100
|
|
|
100
|
-
@
|
|
101
|
+
@log_on_entry
|
|
101
102
|
def laser_check(
|
|
102
103
|
mode: str,
|
|
103
104
|
zebra: Zebra = inject("zebra"),
|
|
@@ -116,8 +117,7 @@ def laser_check(
|
|
|
116
117
|
detector in use is the Eiger, the Pilatus cable is repurposed to trigger the light \
|
|
117
118
|
source, and viceversa.
|
|
118
119
|
"""
|
|
119
|
-
|
|
120
|
-
logger.debug(f"Laser check: {mode}")
|
|
120
|
+
SSX_LOGGER.debug(f"Laser check: {mode}")
|
|
121
121
|
|
|
122
122
|
det_type = yield from get_detector_type(detector_stage)
|
|
123
123
|
|
|
@@ -131,24 +131,25 @@ def laser_check(
|
|
|
131
131
|
yield from set_shutter_mode(zebra, "manual")
|
|
132
132
|
|
|
133
133
|
|
|
134
|
-
@
|
|
134
|
+
@log_on_entry
|
|
135
135
|
def enter_hutch(
|
|
136
136
|
detector_stage: DetectorMotion = inject("detector_motion"),
|
|
137
137
|
) -> MsgGenerator:
|
|
138
138
|
"""Move the detector stage before entering hutch."""
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
logger.debug("Detector moved.")
|
|
139
|
+
yield from bps.mv(detector_stage.z, SAFE_DET_Z) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809
|
|
140
|
+
SSX_LOGGER.debug("Detector moved.")
|
|
142
141
|
|
|
143
142
|
|
|
144
|
-
@
|
|
145
|
-
def write_parameter_file(
|
|
143
|
+
@log_on_entry
|
|
144
|
+
def write_parameter_file(
|
|
145
|
+
detector_stage: DetectorMotion, attenuator: ReadOnlyAttenuator
|
|
146
|
+
):
|
|
146
147
|
"""Writes a json parameter file that can later be parsed by the model."""
|
|
147
148
|
param_file: Path = PARAM_FILE_PATH / PARAM_FILE_NAME
|
|
148
|
-
|
|
149
|
+
SSX_LOGGER.debug(f"Writing Parameter File to: {param_file}\n")
|
|
149
150
|
|
|
150
151
|
det_type = yield from get_detector_type(detector_stage)
|
|
151
|
-
|
|
152
|
+
SSX_LOGGER.warning(f"DETECTOR TYPE: {det_type}")
|
|
152
153
|
filename = caget(pv.ioc12_gp3)
|
|
153
154
|
# If file name ends in a digit this causes processing/pilatus pain.
|
|
154
155
|
# Append an underscore
|
|
@@ -158,21 +159,24 @@ def write_parameter_file(detector_stage: DetectorMotion):
|
|
|
158
159
|
# Note for future reference. Appending underscore causes more hassle and
|
|
159
160
|
# high probability of users accidentally overwriting data. Use a dash
|
|
160
161
|
filename = filename + "-"
|
|
161
|
-
|
|
162
|
+
SSX_LOGGER.info(
|
|
162
163
|
f"Requested filename ends in a number. Appended dash: {filename}"
|
|
163
164
|
)
|
|
164
165
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
transmission = yield from bps.rd(attenuator.actual_transmission)
|
|
167
|
+
|
|
168
|
+
pump_status = bool(int(caget(pv.ioc12_gp6)))
|
|
169
|
+
pump_exp = float(caget(pv.ioc12_gp9)) if pump_status else 0.0
|
|
170
|
+
pump_delay = float(caget(pv.ioc12_gp10)) if pump_status else 0.0
|
|
168
171
|
|
|
169
172
|
params_dict = {
|
|
170
|
-
"visit":
|
|
173
|
+
"visit": _read_visit_directory_from_file().as_posix(), # noqa
|
|
171
174
|
"directory": caget(pv.ioc12_gp2),
|
|
172
175
|
"filename": filename,
|
|
173
176
|
"exposure_time_s": float(caget(pv.ioc12_gp5)),
|
|
174
177
|
"detector_distance_mm": float(caget(pv.ioc12_gp7)),
|
|
175
178
|
"detector_name": str(det_type),
|
|
179
|
+
"transmission": transmission,
|
|
176
180
|
"num_images": int(caget(pv.ioc12_gp4)),
|
|
177
181
|
"pump_status": pump_status,
|
|
178
182
|
"laser_dwell_s": pump_exp,
|
|
@@ -181,12 +185,12 @@ def write_parameter_file(detector_stage: DetectorMotion):
|
|
|
181
185
|
with open(param_file, "w") as f:
|
|
182
186
|
json.dump(params_dict, f, indent=4)
|
|
183
187
|
|
|
184
|
-
|
|
185
|
-
|
|
188
|
+
SSX_LOGGER.info("Parameters \n")
|
|
189
|
+
SSX_LOGGER.info(pformat(params_dict))
|
|
186
190
|
yield from bps.null()
|
|
187
191
|
|
|
188
192
|
|
|
189
|
-
@
|
|
193
|
+
@log_on_entry
|
|
190
194
|
def main_extruder_plan(
|
|
191
195
|
zebra: Zebra,
|
|
192
196
|
aperture: Aperture,
|
|
@@ -195,12 +199,18 @@ def main_extruder_plan(
|
|
|
195
199
|
detector_stage: DetectorMotion,
|
|
196
200
|
shutter: HutchShutter,
|
|
197
201
|
dcm: DCM,
|
|
202
|
+
mirrors: FocusMirrorsMode,
|
|
203
|
+
beam_center_device: DetectorBeamCenter,
|
|
198
204
|
parameters: ExtruderParameters,
|
|
199
205
|
dcid: DCID,
|
|
200
206
|
start_time: datetime,
|
|
201
207
|
) -> MsgGenerator:
|
|
208
|
+
yield from sup.set_detector_beam_center_plan(
|
|
209
|
+
beam_center_device, parameters.detector_name
|
|
210
|
+
)
|
|
211
|
+
|
|
202
212
|
# Setting up the beamline
|
|
203
|
-
|
|
213
|
+
SSX_LOGGER.info("Open hutch shutter")
|
|
204
214
|
yield from bps.abs_set(shutter, ShutterDemand.OPEN, wait=True)
|
|
205
215
|
|
|
206
216
|
yield from sup.setup_beamline_for_collection_plan(
|
|
@@ -213,25 +223,25 @@ def main_extruder_plan(
|
|
|
213
223
|
|
|
214
224
|
# For pixel detector
|
|
215
225
|
filepath = parameters.collection_directory.as_posix()
|
|
216
|
-
|
|
217
|
-
|
|
226
|
+
SSX_LOGGER.debug(f"Filepath {filepath}")
|
|
227
|
+
SSX_LOGGER.debug(f"Filename {parameters.filename}")
|
|
218
228
|
|
|
219
229
|
if parameters.detector_name == "pilatus":
|
|
220
|
-
|
|
230
|
+
SSX_LOGGER.info("Using pilatus mini cbf")
|
|
221
231
|
caput(pv.pilat_cbftemplate, 0)
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
232
|
+
SSX_LOGGER.info(f"Pilatus quickshot setup: filepath {filepath}")
|
|
233
|
+
SSX_LOGGER.info(f"Pilatus quickshot setup: filepath {parameters.filename}")
|
|
234
|
+
SSX_LOGGER.info(
|
|
225
235
|
f"Pilatus quickshot setup: number of images {parameters.num_images}"
|
|
226
236
|
)
|
|
227
|
-
|
|
237
|
+
SSX_LOGGER.info(
|
|
228
238
|
f"Pilatus quickshot setup: exposure time {parameters.exposure_time_s}"
|
|
229
239
|
)
|
|
230
240
|
|
|
231
241
|
if parameters.pump_status:
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
242
|
+
SSX_LOGGER.info("Pump probe extruder data collection")
|
|
243
|
+
SSX_LOGGER.info(f"Pump exposure time {parameters.laser_dwell_s}")
|
|
244
|
+
SSX_LOGGER.info(f"Pump delay time {parameters.laser_delay_s}")
|
|
235
245
|
sup.pilatus(
|
|
236
246
|
"fastchip",
|
|
237
247
|
[
|
|
@@ -252,7 +262,7 @@ def main_extruder_plan(
|
|
|
252
262
|
wait=True,
|
|
253
263
|
)
|
|
254
264
|
else:
|
|
255
|
-
|
|
265
|
+
SSX_LOGGER.info("Static experiment: no photoexcitation")
|
|
256
266
|
sup.pilatus(
|
|
257
267
|
"quickshot",
|
|
258
268
|
[
|
|
@@ -267,38 +277,25 @@ def main_extruder_plan(
|
|
|
267
277
|
)
|
|
268
278
|
|
|
269
279
|
elif parameters.detector_name == "eiger":
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
Running a Single image pilatus data collection to create directory."""
|
|
275
|
-
) # See https://github.com/DiamondLightSource/mx_bluesky/issues/45
|
|
276
|
-
num_shots = 1
|
|
277
|
-
sup.pilatus(
|
|
278
|
-
"quickshot-internaltrig",
|
|
279
|
-
[filepath, parameters.filename, num_shots, parameters.exposure_time_s],
|
|
280
|
-
)
|
|
281
|
-
logger.debug("Sleep 2s waiting for pilatus to arm")
|
|
282
|
-
sleep(2.5)
|
|
283
|
-
caput(pv.pilat_acquire, "0") # Disarm pilatus
|
|
284
|
-
sleep(0.5)
|
|
285
|
-
caput(pv.pilat_acquire, "1") # Arm pilatus
|
|
286
|
-
logger.debug("Pilatus data collection DONE")
|
|
287
|
-
sup.pilatus("return to normal", None)
|
|
288
|
-
logger.info("Pilatus back to normal. Single image pilatus data collection DONE")
|
|
280
|
+
SSX_LOGGER.info("Using Eiger detector")
|
|
281
|
+
|
|
282
|
+
SSX_LOGGER.debug(f"Creating the directory for the collection in {filepath}.")
|
|
283
|
+
Path(filepath).mkdir(parents=True, exist_ok=True)
|
|
289
284
|
|
|
290
285
|
caput(pv.eiger_seqID, int(caget(pv.eiger_seqID)) + 1)
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
286
|
+
SSX_LOGGER.info(f"Eiger quickshot setup: filepath {filepath}")
|
|
287
|
+
SSX_LOGGER.info(f"Eiger quickshot setup: filepath {parameters.filename}")
|
|
288
|
+
SSX_LOGGER.info(
|
|
289
|
+
f"Eiger quickshot setup: number of images {parameters.num_images}"
|
|
290
|
+
)
|
|
291
|
+
SSX_LOGGER.info(
|
|
295
292
|
f"Eiger quickshot setup: exposure time {parameters.exposure_time_s}"
|
|
296
293
|
)
|
|
297
294
|
|
|
298
295
|
if parameters.pump_status:
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
296
|
+
SSX_LOGGER.info("Pump probe extruder data collection")
|
|
297
|
+
SSX_LOGGER.debug(f"Pump exposure time {parameters.laser_dwell_s}")
|
|
298
|
+
SSX_LOGGER.debug(f"Pump delay time {parameters.laser_delay_s}")
|
|
302
299
|
sup.eiger(
|
|
303
300
|
"triggered",
|
|
304
301
|
[
|
|
@@ -319,7 +316,7 @@ def main_extruder_plan(
|
|
|
319
316
|
wait=True,
|
|
320
317
|
)
|
|
321
318
|
else:
|
|
322
|
-
|
|
319
|
+
SSX_LOGGER.info("Static experiment: no photoexcitation")
|
|
323
320
|
sup.eiger(
|
|
324
321
|
"quickshot",
|
|
325
322
|
[
|
|
@@ -334,37 +331,50 @@ def main_extruder_plan(
|
|
|
334
331
|
)
|
|
335
332
|
else:
|
|
336
333
|
err = f"Unknown Detector Type, det_type = {parameters.detector_name}"
|
|
337
|
-
|
|
334
|
+
SSX_LOGGER.error(err)
|
|
338
335
|
raise UnknownDetectorType(err)
|
|
339
336
|
|
|
337
|
+
beam_settings = yield from read_beam_info_from_hardware(
|
|
338
|
+
dcm, mirrors, beam_center_device, parameters.detector_name
|
|
339
|
+
)
|
|
340
|
+
|
|
340
341
|
# Do DCID creation BEFORE arming the detector
|
|
342
|
+
if parameters.detector_name == "eiger":
|
|
343
|
+
filetemplate = f"{parameters.filename}.nxs"
|
|
344
|
+
else:
|
|
345
|
+
filetemplate = yield from get_pilatus_filename_template_from_device()
|
|
341
346
|
dcid.generate_dcid(
|
|
342
|
-
|
|
347
|
+
beam_settings=beam_settings,
|
|
343
348
|
image_dir=parameters.collection_directory.as_posix(),
|
|
344
|
-
|
|
349
|
+
file_template=filetemplate,
|
|
345
350
|
num_images=parameters.num_images,
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
pump_delay=parameters.laser_delay_s or 0,
|
|
349
|
-
pump_status=int(parameters.pump_status),
|
|
351
|
+
start_time=start_time,
|
|
352
|
+
pump_probe=parameters.pump_status,
|
|
350
353
|
)
|
|
351
354
|
|
|
352
355
|
# Collect
|
|
353
|
-
|
|
356
|
+
SSX_LOGGER.info("Fast shutter opening")
|
|
354
357
|
yield from open_fast_shutter(zebra)
|
|
355
358
|
if parameters.detector_name == "pilatus":
|
|
356
|
-
|
|
359
|
+
SSX_LOGGER.info("Pilatus acquire ON")
|
|
357
360
|
caput(pv.pilat_acquire, 1)
|
|
358
361
|
elif parameters.detector_name == "eiger":
|
|
359
|
-
|
|
362
|
+
SSX_LOGGER.info("Triggering Eiger NOW")
|
|
360
363
|
caput(pv.eiger_trigger, 1)
|
|
361
364
|
|
|
362
365
|
dcid.notify_start()
|
|
363
366
|
|
|
364
367
|
if parameters.detector_name == "eiger":
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
+
SSX_LOGGER.debug("Call nexgen server for nexus writing.")
|
|
369
|
+
beam_x = yield from bps.rd(beam_center_device.beam_x)
|
|
370
|
+
beam_y = yield from bps.rd(beam_center_device.beam_y)
|
|
371
|
+
call_nexgen(
|
|
372
|
+
None,
|
|
373
|
+
parameters,
|
|
374
|
+
beam_settings.wavelength_in_a,
|
|
375
|
+
(beam_x, beam_y),
|
|
376
|
+
start_time,
|
|
377
|
+
)
|
|
368
378
|
|
|
369
379
|
timeout_time = time.time() + parameters.num_images * parameters.exposure_time_s + 10
|
|
370
380
|
|
|
@@ -381,25 +391,25 @@ def main_extruder_plan(
|
|
|
381
391
|
if zebra_arm_status == 0: # not zebra.pc.is_armed():
|
|
382
392
|
# As soon as zebra is disarmed, exit.
|
|
383
393
|
# Epics updates this PV once the collection is done.
|
|
384
|
-
|
|
394
|
+
SSX_LOGGER.info("Zebra disarmed - Collection done.")
|
|
385
395
|
break
|
|
386
396
|
if time.time() >= timeout_time:
|
|
387
|
-
|
|
397
|
+
SSX_LOGGER.warning(
|
|
388
398
|
"""
|
|
389
399
|
Something went wrong and data collection timed out. Aborting.
|
|
390
400
|
"""
|
|
391
401
|
)
|
|
392
402
|
raise TimeoutError("Data collection timed out.")
|
|
393
403
|
|
|
394
|
-
|
|
404
|
+
SSX_LOGGER.info("Collection completed without errors.")
|
|
395
405
|
|
|
396
406
|
|
|
397
|
-
@
|
|
407
|
+
@log_on_entry
|
|
398
408
|
def collection_aborted_plan(
|
|
399
409
|
zebra: Zebra, detector_name: str, dcid: DCID
|
|
400
410
|
) -> MsgGenerator:
|
|
401
411
|
"""A plan to run in case the collection is aborted before the end."""
|
|
402
|
-
|
|
412
|
+
SSX_LOGGER.warning("Data Collection Aborted")
|
|
403
413
|
yield from disarm_zebra(zebra) # If aborted/timed out zebra still armed
|
|
404
414
|
if detector_name == "pilatus":
|
|
405
415
|
caput(pv.pilat_acquire, 0)
|
|
@@ -410,7 +420,7 @@ def collection_aborted_plan(
|
|
|
410
420
|
dcid.collection_complete(end_time, aborted=True)
|
|
411
421
|
|
|
412
422
|
|
|
413
|
-
@
|
|
423
|
+
@log_on_entry
|
|
414
424
|
def tidy_up_at_collection_end_plan(
|
|
415
425
|
zebra: Zebra,
|
|
416
426
|
shutter: HutchShutter,
|
|
@@ -431,23 +441,23 @@ def tidy_up_at_collection_end_plan(
|
|
|
431
441
|
sup.pilatus("return-to-normal", None)
|
|
432
442
|
elif parameters.detector_name == "eiger":
|
|
433
443
|
sup.eiger("return-to-normal", None)
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
444
|
+
SSX_LOGGER.debug(f"{parameters.filename}_{caget(pv.eiger_seqID)}")
|
|
445
|
+
SSX_LOGGER.debug("End of Run")
|
|
446
|
+
SSX_LOGGER.info("Close hutch shutter")
|
|
437
447
|
yield from bps.abs_set(shutter, ShutterDemand.CLOSE, wait=True)
|
|
438
448
|
|
|
439
449
|
dcid.notify_end()
|
|
440
450
|
|
|
441
451
|
|
|
442
|
-
@
|
|
452
|
+
@log_on_entry
|
|
443
453
|
def collection_complete_plan(
|
|
444
454
|
collection_directory: Path, detector_name: str, dcid: DCID
|
|
445
455
|
) -> MsgGenerator:
|
|
446
456
|
if detector_name == "pilatus":
|
|
447
|
-
|
|
457
|
+
SSX_LOGGER.info("Pilatus Acquire STOP")
|
|
448
458
|
caput(pv.pilat_acquire, 0)
|
|
449
459
|
elif detector_name == "eiger":
|
|
450
|
-
|
|
460
|
+
SSX_LOGGER.info("Eiger Acquire STOP")
|
|
451
461
|
caput(pv.eiger_acquire, 0)
|
|
452
462
|
caput(pv.eiger_ODcapture, "Done")
|
|
453
463
|
|
|
@@ -455,7 +465,7 @@ def collection_complete_plan(
|
|
|
455
465
|
|
|
456
466
|
end_time = datetime.now()
|
|
457
467
|
dcid.collection_complete(end_time, aborted=False)
|
|
458
|
-
|
|
468
|
+
SSX_LOGGER.info(f"End Time = {end_time.ctime()}")
|
|
459
469
|
|
|
460
470
|
# Copy parameter file
|
|
461
471
|
shutil.copy2(
|
|
@@ -473,20 +483,19 @@ def run_extruder_plan(
|
|
|
473
483
|
detector_stage: DetectorMotion = inject("detector_motion"),
|
|
474
484
|
shutter: HutchShutter = inject("shutter"),
|
|
475
485
|
dcm: DCM = inject("dcm"),
|
|
486
|
+
mirrors: FocusMirrorsMode = inject("focus_mirrors"),
|
|
487
|
+
attenuator: ReadOnlyAttenuator = inject("attenuator"),
|
|
476
488
|
) -> MsgGenerator:
|
|
477
|
-
setup_logging()
|
|
478
489
|
start_time = datetime.now()
|
|
479
|
-
|
|
490
|
+
SSX_LOGGER.info(f"Collection start time: {start_time.ctime()}")
|
|
480
491
|
|
|
481
|
-
yield from write_parameter_file(detector_stage)
|
|
492
|
+
yield from write_parameter_file(detector_stage, attenuator)
|
|
482
493
|
parameters = ExtruderParameters.from_file(PARAM_FILE_PATH / PARAM_FILE_NAME)
|
|
483
494
|
|
|
495
|
+
beam_center_device = sup.get_beam_center_device(parameters.detector_name)
|
|
496
|
+
|
|
484
497
|
# DCID - not generated yet
|
|
485
|
-
dcid = DCID(
|
|
486
|
-
emit_errors=False,
|
|
487
|
-
ssx_type=SSXType.EXTRUDER,
|
|
488
|
-
detector=parameters.detector_name,
|
|
489
|
-
)
|
|
498
|
+
dcid = DCID(emit_errors=False, expt_params=parameters)
|
|
490
499
|
|
|
491
500
|
yield from bpp.contingency_wrapper(
|
|
492
501
|
main_extruder_plan(
|
|
@@ -497,6 +506,8 @@ def run_extruder_plan(
|
|
|
497
506
|
detector_stage=detector_stage,
|
|
498
507
|
shutter=shutter,
|
|
499
508
|
dcm=dcm,
|
|
509
|
+
mirrors=mirrors,
|
|
510
|
+
beam_center_device=beam_center_device,
|
|
500
511
|
parameters=parameters,
|
|
501
512
|
dcid=dcid,
|
|
502
513
|
start_time=start_time,
|
|
@@ -323,7 +323,7 @@ font "helvetica-bold-r-24.0"
|
|
|
323
323
|
buttonLabel "Start"
|
|
324
324
|
numCmds 1
|
|
325
325
|
command {
|
|
326
|
-
0 "blueapi -c CONFIG_LOCATION controller run run_fixed_target_plan '\{\"zebra\":\"zebra\",\"pmac\":\"pmac\",\"aperture\":\"aperture\",\"backlight\":\"backlight\",\"beamstop\":\"beamstop\",\"detector_stage\":\"detector_motion\",\"shutter\":\"shutter\",\"dcm\":\"dcm\"\}'"
|
|
326
|
+
0 "blueapi -c CONFIG_LOCATION controller run run_fixed_target_plan '\{\"zebra\":\"zebra\",\"pmac\":\"pmac\",\"aperture\":\"aperture\",\"backlight\":\"backlight\",\"beamstop\":\"beamstop\",\"detector_stage\":\"detector_motion\",\"shutter\":\"shutter\",\"dcm\":\"dcm\",\"mirrors\":\"focus_mirrors\",\"attenuator\":\"attenuator\"\}'"
|
|
327
327
|
}
|
|
328
328
|
endObjectProperties
|
|
329
329
|
|
|
@@ -1270,21 +1270,18 @@ topShadowColor index 1
|
|
|
1270
1270
|
botShadowColor index 8
|
|
1271
1271
|
controlPv "ME14E-MO-IOC-01:GP2"
|
|
1272
1272
|
font "arial-medium-r-18.0"
|
|
1273
|
-
numItems
|
|
1273
|
+
numItems 2
|
|
1274
1274
|
symbolTag {
|
|
1275
1275
|
0 "None"
|
|
1276
1276
|
1 "Mapping Lite"
|
|
1277
|
-
2 "Full Mapping"
|
|
1278
1277
|
}
|
|
1279
1278
|
symbol0 {
|
|
1280
1279
|
0 "NN"
|
|
1281
1280
|
1 "ML"
|
|
1282
|
-
2 "FM"
|
|
1283
1281
|
}
|
|
1284
1282
|
value0 {
|
|
1285
1283
|
0 "none"
|
|
1286
1284
|
1 "mappinglite"
|
|
1287
|
-
2 "fullmapping"
|
|
1288
1285
|
}
|
|
1289
1286
|
endObjectProperties
|
|
1290
1287
|
|
|
@@ -3862,7 +3859,7 @@ buttonLabel "Stages"
|
|
|
3862
3859
|
numPvs 4
|
|
3863
3860
|
numDsps 1
|
|
3864
3861
|
displayFileName {
|
|
3865
|
-
0 "/dls_sw/work/R3.14.12.
|
|
3862
|
+
0 "/dls_sw/work/R3.14.12.7/ioc/ME14E/BL/data/ME14E-motors.edl"
|
|
3866
3863
|
}
|
|
3867
3864
|
endObjectProperties
|
|
3868
3865
|
|