mx-bluesky 1.4.0__py3-none-any.whl → 1.4.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mx_bluesky/_version.py +2 -2
- mx_bluesky/beamlines/i04/redis_to_murko_forwarder.py +178 -0
- mx_bluesky/beamlines/i04/thawing_plan.py +1 -1
- mx_bluesky/beamlines/i24/serial/dcid.py +143 -171
- mx_bluesky/beamlines/i24/serial/extruder/EX-gui-edm/DiamondExtruder-I24-py3v1.edl +1 -1
- mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +54 -21
- mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/DiamondChipI24-py3v1.edl +2 -5
- mx_bluesky/beamlines/i24/serial/fixed_target/ft_utils.py +0 -1
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +67 -50
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +26 -79
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_StartUp_py3v1.py +0 -199
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py +4 -6
- mx_bluesky/beamlines/i24/serial/log.py +1 -1
- mx_bluesky/beamlines/i24/serial/parameters/__init__.py +4 -0
- mx_bluesky/beamlines/i24/serial/parameters/constants.py +6 -1
- mx_bluesky/beamlines/i24/serial/parameters/experiment_parameters.py +42 -15
- mx_bluesky/beamlines/i24/serial/run_fixed_target.sh +4 -3
- mx_bluesky/beamlines/i24/serial/setup_beamline/pv.py +2 -0
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +103 -81
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +1 -2
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +24 -26
- mx_bluesky/beamlines/i24/serial/write_nexus.py +74 -72
- mx_bluesky/common/external_interaction/config_server.py +46 -0
- mx_bluesky/common/parameters/components.py +52 -15
- mx_bluesky/common/parameters/constants.py +11 -1
- mx_bluesky/common/parameters/gridscan.py +94 -0
- mx_bluesky/{hyperion → common}/parameters/robot_load.py +2 -2
- mx_bluesky/common/plans/do_fgs.py +2 -2
- mx_bluesky/common/utils/log.py +2 -0
- mx_bluesky/hyperion/__main__.py +2 -1
- mx_bluesky/hyperion/device_setup_plans/dcm_pitch_roll_mirror_adjuster.py +21 -31
- mx_bluesky/hyperion/device_setup_plans/setup_panda.py +4 -4
- mx_bluesky/hyperion/device_setup_plans/setup_zebra.py +1 -1
- mx_bluesky/hyperion/device_setup_plans/smargon.py +3 -3
- mx_bluesky/hyperion/exceptions.py +13 -1
- mx_bluesky/hyperion/experiment_plans/__init__.py +4 -0
- mx_bluesky/hyperion/experiment_plans/change_aperture_then_move_plan.py +83 -0
- mx_bluesky/hyperion/experiment_plans/common/xrc_result.py +47 -0
- mx_bluesky/hyperion/experiment_plans/experiment_registry.py +9 -9
- mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py +133 -97
- mx_bluesky/hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py +42 -18
- mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +75 -9
- mx_bluesky/hyperion/experiment_plans/oav_grid_detection_plan.py +2 -2
- mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +1 -1
- mx_bluesky/hyperion/experiment_plans/optimise_attenuation_plan.py +2 -2
- mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +36 -17
- mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +5 -5
- mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +28 -28
- mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +64 -16
- mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +11 -3
- mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +10 -10
- mx_bluesky/hyperion/external_interaction/callbacks/__init__.py +0 -4
- mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +4 -0
- mx_bluesky/hyperion/external_interaction/callbacks/common/abstract_event.py +66 -0
- mx_bluesky/hyperion/external_interaction/callbacks/common/callback_util.py +5 -0
- mx_bluesky/hyperion/external_interaction/callbacks/grid_detection_callback.py +15 -15
- mx_bluesky/hyperion/external_interaction/callbacks/robot_load/ispyb_callback.py +18 -10
- mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_callback.py +3 -1
- mx_bluesky/hyperion/external_interaction/callbacks/rotation/nexus_callback.py +5 -3
- mx_bluesky/hyperion/external_interaction/callbacks/sample_handling/__init__.py +0 -0
- mx_bluesky/hyperion/external_interaction/callbacks/sample_handling/sample_handling_callback.py +84 -0
- mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/ispyb_callback.py +15 -9
- mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/nexus_callback.py +5 -4
- mx_bluesky/hyperion/external_interaction/config_server.py +8 -37
- mx_bluesky/hyperion/external_interaction/exceptions.py +0 -9
- mx_bluesky/hyperion/external_interaction/ispyb/exp_eye_store.py +65 -15
- mx_bluesky/hyperion/parameters/components.py +4 -9
- mx_bluesky/hyperion/parameters/constants.py +0 -1
- mx_bluesky/hyperion/parameters/gridscan.py +33 -76
- mx_bluesky/hyperion/parameters/load_centre_collect.py +14 -9
- mx_bluesky/hyperion/parameters/rotation.py +15 -6
- {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1.dist-info}/METADATA +35 -34
- {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1.dist-info}/RECORD +77 -70
- {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1.dist-info}/WHEEL +1 -1
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Mapping_py3v1.py +0 -150
- {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1.dist-info}/LICENSE +0 -0
- {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1.dist-info}/entry_points.txt +0 -0
- {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1.dist-info}/top_level.txt +0 -0
|
@@ -16,23 +16,30 @@ from time import sleep
|
|
|
16
16
|
|
|
17
17
|
import bluesky.plan_stubs as bps
|
|
18
18
|
import bluesky.preprocessors as bpp
|
|
19
|
-
from
|
|
19
|
+
from bluesky.utils import MsgGenerator
|
|
20
20
|
from dodal.common import inject
|
|
21
|
+
from dodal.devices.attenuator import ReadOnlyAttenuator
|
|
21
22
|
from dodal.devices.hutch_shutter import HutchShutter, ShutterDemand
|
|
22
23
|
from dodal.devices.i24.aperture import Aperture
|
|
24
|
+
from dodal.devices.i24.beam_center import DetectorBeamCenter
|
|
23
25
|
from dodal.devices.i24.beamstop import Beamstop
|
|
24
26
|
from dodal.devices.i24.dcm import DCM
|
|
25
27
|
from dodal.devices.i24.dual_backlight import DualBacklight
|
|
28
|
+
from dodal.devices.i24.focus_mirrors import FocusMirrorsMode
|
|
26
29
|
from dodal.devices.i24.i24_detector_motion import DetectorMotion
|
|
27
30
|
from dodal.devices.zebra import DISCONNECT, SOFT_IN3, Zebra
|
|
28
31
|
|
|
29
|
-
from mx_bluesky.beamlines.i24.serial.dcid import
|
|
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
|
+
)
|
|
30
37
|
from mx_bluesky.beamlines.i24.serial.log import (
|
|
31
38
|
SSX_LOGGER,
|
|
32
39
|
_read_visit_directory_from_file,
|
|
33
40
|
log_on_entry,
|
|
34
41
|
)
|
|
35
|
-
from mx_bluesky.beamlines.i24.serial.parameters import ExtruderParameters
|
|
42
|
+
from mx_bluesky.beamlines.i24.serial.parameters import ExtruderParameters
|
|
36
43
|
from mx_bluesky.beamlines.i24.serial.parameters.constants import (
|
|
37
44
|
PARAM_FILE_NAME,
|
|
38
45
|
PARAM_FILE_PATH,
|
|
@@ -134,7 +141,9 @@ def enter_hutch(
|
|
|
134
141
|
|
|
135
142
|
|
|
136
143
|
@log_on_entry
|
|
137
|
-
def write_parameter_file(
|
|
144
|
+
def write_parameter_file(
|
|
145
|
+
detector_stage: DetectorMotion, attenuator: ReadOnlyAttenuator
|
|
146
|
+
):
|
|
138
147
|
"""Writes a json parameter file that can later be parsed by the model."""
|
|
139
148
|
param_file: Path = PARAM_FILE_PATH / PARAM_FILE_NAME
|
|
140
149
|
SSX_LOGGER.debug(f"Writing Parameter File to: {param_file}\n")
|
|
@@ -154,9 +163,11 @@ def write_parameter_file(detector_stage: DetectorMotion):
|
|
|
154
163
|
f"Requested filename ends in a number. Appended dash: {filename}"
|
|
155
164
|
)
|
|
156
165
|
|
|
166
|
+
transmission = yield from bps.rd(attenuator.actual_transmission)
|
|
167
|
+
|
|
157
168
|
pump_status = bool(int(caget(pv.ioc12_gp6)))
|
|
158
|
-
pump_exp = float(caget(pv.ioc12_gp9)) if pump_status else
|
|
159
|
-
pump_delay = float(caget(pv.ioc12_gp10)) if pump_status else
|
|
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
|
|
160
171
|
|
|
161
172
|
params_dict = {
|
|
162
173
|
"visit": _read_visit_directory_from_file().as_posix(), # noqa
|
|
@@ -165,6 +176,7 @@ def write_parameter_file(detector_stage: DetectorMotion):
|
|
|
165
176
|
"exposure_time_s": float(caget(pv.ioc12_gp5)),
|
|
166
177
|
"detector_distance_mm": float(caget(pv.ioc12_gp7)),
|
|
167
178
|
"detector_name": str(det_type),
|
|
179
|
+
"transmission": transmission,
|
|
168
180
|
"num_images": int(caget(pv.ioc12_gp4)),
|
|
169
181
|
"pump_status": pump_status,
|
|
170
182
|
"laser_dwell_s": pump_exp,
|
|
@@ -187,10 +199,16 @@ def main_extruder_plan(
|
|
|
187
199
|
detector_stage: DetectorMotion,
|
|
188
200
|
shutter: HutchShutter,
|
|
189
201
|
dcm: DCM,
|
|
202
|
+
mirrors: FocusMirrorsMode,
|
|
203
|
+
beam_center_device: DetectorBeamCenter,
|
|
190
204
|
parameters: ExtruderParameters,
|
|
191
205
|
dcid: DCID,
|
|
192
206
|
start_time: datetime,
|
|
193
207
|
) -> MsgGenerator:
|
|
208
|
+
yield from sup.set_detector_beam_center_plan(
|
|
209
|
+
beam_center_device, parameters.detector_name
|
|
210
|
+
)
|
|
211
|
+
|
|
194
212
|
# Setting up the beamline
|
|
195
213
|
SSX_LOGGER.info("Open hutch shutter")
|
|
196
214
|
yield from bps.abs_set(shutter, ShutterDemand.OPEN, wait=True)
|
|
@@ -262,7 +280,7 @@ def main_extruder_plan(
|
|
|
262
280
|
SSX_LOGGER.info("Using Eiger detector")
|
|
263
281
|
|
|
264
282
|
SSX_LOGGER.debug(f"Creating the directory for the collection in {filepath}.")
|
|
265
|
-
Path(filepath).mkdir(parents=True)
|
|
283
|
+
Path(filepath).mkdir(parents=True, exist_ok=True)
|
|
266
284
|
|
|
267
285
|
caput(pv.eiger_seqID, int(caget(pv.eiger_seqID)) + 1)
|
|
268
286
|
SSX_LOGGER.info(f"Eiger quickshot setup: filepath {filepath}")
|
|
@@ -316,16 +334,22 @@ def main_extruder_plan(
|
|
|
316
334
|
SSX_LOGGER.error(err)
|
|
317
335
|
raise UnknownDetectorType(err)
|
|
318
336
|
|
|
337
|
+
beam_settings = yield from read_beam_info_from_hardware(
|
|
338
|
+
dcm, mirrors, beam_center_device, parameters.detector_name
|
|
339
|
+
)
|
|
340
|
+
|
|
319
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()
|
|
320
346
|
dcid.generate_dcid(
|
|
321
|
-
|
|
347
|
+
beam_settings=beam_settings,
|
|
322
348
|
image_dir=parameters.collection_directory.as_posix(),
|
|
323
|
-
|
|
349
|
+
file_template=filetemplate,
|
|
324
350
|
num_images=parameters.num_images,
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
pump_delay=parameters.laser_delay_s or 0,
|
|
328
|
-
pump_status=int(parameters.pump_status),
|
|
351
|
+
start_time=start_time,
|
|
352
|
+
pump_probe=parameters.pump_status,
|
|
329
353
|
)
|
|
330
354
|
|
|
331
355
|
# Collect
|
|
@@ -341,9 +365,16 @@ def main_extruder_plan(
|
|
|
341
365
|
dcid.notify_start()
|
|
342
366
|
|
|
343
367
|
if parameters.detector_name == "eiger":
|
|
344
|
-
wavelength = yield from bps.rd(dcm.wavelength_in_a)
|
|
345
368
|
SSX_LOGGER.debug("Call nexgen server for nexus writing.")
|
|
346
|
-
|
|
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
|
+
)
|
|
347
378
|
|
|
348
379
|
timeout_time = time.time() + parameters.num_images * parameters.exposure_time_s + 10
|
|
349
380
|
|
|
@@ -452,19 +483,19 @@ def run_extruder_plan(
|
|
|
452
483
|
detector_stage: DetectorMotion = inject("detector_motion"),
|
|
453
484
|
shutter: HutchShutter = inject("shutter"),
|
|
454
485
|
dcm: DCM = inject("dcm"),
|
|
486
|
+
mirrors: FocusMirrorsMode = inject("focus_mirrors"),
|
|
487
|
+
attenuator: ReadOnlyAttenuator = inject("attenuator"),
|
|
455
488
|
) -> MsgGenerator:
|
|
456
489
|
start_time = datetime.now()
|
|
457
490
|
SSX_LOGGER.info(f"Collection start time: {start_time.ctime()}")
|
|
458
491
|
|
|
459
|
-
yield from write_parameter_file(detector_stage)
|
|
492
|
+
yield from write_parameter_file(detector_stage, attenuator)
|
|
460
493
|
parameters = ExtruderParameters.from_file(PARAM_FILE_PATH / PARAM_FILE_NAME)
|
|
461
494
|
|
|
495
|
+
beam_center_device = sup.get_beam_center_device(parameters.detector_name)
|
|
496
|
+
|
|
462
497
|
# DCID - not generated yet
|
|
463
|
-
dcid = DCID(
|
|
464
|
-
emit_errors=False,
|
|
465
|
-
ssx_type=SSXType.EXTRUDER,
|
|
466
|
-
detector=parameters.detector_name,
|
|
467
|
-
)
|
|
498
|
+
dcid = DCID(emit_errors=False, expt_params=parameters)
|
|
468
499
|
|
|
469
500
|
yield from bpp.contingency_wrapper(
|
|
470
501
|
main_extruder_plan(
|
|
@@ -475,6 +506,8 @@ def run_extruder_plan(
|
|
|
475
506
|
detector_stage=detector_stage,
|
|
476
507
|
shutter=shutter,
|
|
477
508
|
dcm=dcm,
|
|
509
|
+
mirrors=mirrors,
|
|
510
|
+
beam_center_device=beam_center_device,
|
|
478
511
|
parameters=parameters,
|
|
479
512
|
dcid=dcid,
|
|
480
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
|
|
|
@@ -10,18 +10,25 @@ from time import sleep
|
|
|
10
10
|
import bluesky.plan_stubs as bps
|
|
11
11
|
import bluesky.preprocessors as bpp
|
|
12
12
|
import numpy as np
|
|
13
|
-
from
|
|
13
|
+
from bluesky.utils import MsgGenerator
|
|
14
14
|
from dodal.common import inject
|
|
15
|
+
from dodal.devices.attenuator import ReadOnlyAttenuator
|
|
15
16
|
from dodal.devices.hutch_shutter import HutchShutter, ShutterDemand
|
|
16
17
|
from dodal.devices.i24.aperture import Aperture
|
|
18
|
+
from dodal.devices.i24.beam_center import DetectorBeamCenter
|
|
17
19
|
from dodal.devices.i24.beamstop import Beamstop
|
|
18
20
|
from dodal.devices.i24.dcm import DCM
|
|
19
21
|
from dodal.devices.i24.dual_backlight import DualBacklight
|
|
22
|
+
from dodal.devices.i24.focus_mirrors import FocusMirrorsMode
|
|
20
23
|
from dodal.devices.i24.i24_detector_motion import DetectorMotion
|
|
21
24
|
from dodal.devices.i24.pmac import PMAC
|
|
22
25
|
from dodal.devices.zebra import Zebra
|
|
23
26
|
|
|
24
|
-
from mx_bluesky.beamlines.i24.serial.dcid import
|
|
27
|
+
from mx_bluesky.beamlines.i24.serial.dcid import (
|
|
28
|
+
DCID,
|
|
29
|
+
get_pilatus_filename_template_from_device,
|
|
30
|
+
read_beam_info_from_hardware,
|
|
31
|
+
)
|
|
25
32
|
from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import (
|
|
26
33
|
ChipType,
|
|
27
34
|
MappingType,
|
|
@@ -34,7 +41,6 @@ from mx_bluesky.beamlines.i24.serial.log import SSX_LOGGER, log_on_entry
|
|
|
34
41
|
from mx_bluesky.beamlines.i24.serial.parameters import (
|
|
35
42
|
ChipDescription,
|
|
36
43
|
FixedTargetParameters,
|
|
37
|
-
SSXType,
|
|
38
44
|
)
|
|
39
45
|
from mx_bluesky.beamlines.i24.serial.parameters.constants import (
|
|
40
46
|
LITEMAP_PATH,
|
|
@@ -77,7 +83,7 @@ def calculate_collection_timeout(parameters: FixedTargetParameters) -> float:
|
|
|
77
83
|
Returns:
|
|
78
84
|
The estimated collection time, in s.
|
|
79
85
|
"""
|
|
80
|
-
buffer = PMAC_MOVE_TIME * parameters.total_num_images +
|
|
86
|
+
buffer = PMAC_MOVE_TIME * parameters.total_num_images + 600
|
|
81
87
|
pump_setting = parameters.pump_repeat
|
|
82
88
|
collection_time = parameters.total_num_images * parameters.exposure_time_s
|
|
83
89
|
if pump_setting in [
|
|
@@ -97,7 +103,7 @@ def calculate_collection_timeout(parameters: FixedTargetParameters) -> float:
|
|
|
97
103
|
)
|
|
98
104
|
if pump_setting == PumpProbeSetting.Medium1:
|
|
99
105
|
# Long delay between pump and probe, with fast shutter opening and closing.
|
|
100
|
-
timeout = timeout + SHUTTER_OPEN_TIME
|
|
106
|
+
timeout = timeout + SHUTTER_OPEN_TIME * parameters.total_num_images
|
|
101
107
|
return timeout
|
|
102
108
|
|
|
103
109
|
|
|
@@ -234,8 +240,6 @@ def load_motion_program_data(
|
|
|
234
240
|
SSX_LOGGER.info(f"Map type is None, setting program prefix to {prefix}")
|
|
235
241
|
elif map_type == MappingType.Lite:
|
|
236
242
|
prefix = 12
|
|
237
|
-
elif map_type == MappingType.Full:
|
|
238
|
-
prefix = 13
|
|
239
243
|
else:
|
|
240
244
|
SSX_LOGGER.warning(f"Unknown Map Type, map_type = {map_type}")
|
|
241
245
|
return
|
|
@@ -301,14 +305,6 @@ def get_prog_num(
|
|
|
301
305
|
SSX_LOGGER.info(f"Map type: {str(map_type)}")
|
|
302
306
|
SSX_LOGGER.info("Program number: 12")
|
|
303
307
|
return 12
|
|
304
|
-
if map_type == MappingType.Full:
|
|
305
|
-
# TODO See https://github.com/DiamondLightSource/mx-bluesky/issues/515
|
|
306
|
-
SSX_LOGGER.info(f"Map type: {str(map_type)}")
|
|
307
|
-
SSX_LOGGER.info("Program number: 13")
|
|
308
|
-
# TODO once reinstated return 13
|
|
309
|
-
msg = "Full mapping is broken and currently disabled."
|
|
310
|
-
SSX_LOGGER.error(msg)
|
|
311
|
-
raise ValueError(msg)
|
|
312
308
|
|
|
313
309
|
|
|
314
310
|
@log_on_entry
|
|
@@ -352,14 +348,6 @@ def datasetsizei24(
|
|
|
352
348
|
total_numb_imgs = int(np.prod(chip_format) * block_count * n_exposures)
|
|
353
349
|
SSX_LOGGER.info(f"Calculated number of images: {total_numb_imgs}")
|
|
354
350
|
|
|
355
|
-
elif map_type == MappingType.Full:
|
|
356
|
-
SSX_LOGGER.error("Not Set Up For Full Mapping")
|
|
357
|
-
raise ValueError("The beamline is currently not set for Full Mapping.")
|
|
358
|
-
|
|
359
|
-
else:
|
|
360
|
-
SSX_LOGGER.warning(f"Unknown Map Type, map_type = {str(map_type)}")
|
|
361
|
-
raise ValueError("Unknown map type")
|
|
362
|
-
|
|
363
351
|
SSX_LOGGER.info("Set PV to calculated number of images.")
|
|
364
352
|
caput(pv.me14e_gp10, int(total_numb_imgs))
|
|
365
353
|
|
|
@@ -375,6 +363,9 @@ def start_i24(
|
|
|
375
363
|
detector_stage: DetectorMotion,
|
|
376
364
|
shutter: HutchShutter,
|
|
377
365
|
parameters: FixedTargetParameters,
|
|
366
|
+
dcm: DCM,
|
|
367
|
+
mirrors: FocusMirrorsMode,
|
|
368
|
+
beam_center_device: DetectorBeamCenter,
|
|
378
369
|
dcid: DCID,
|
|
379
370
|
):
|
|
380
371
|
"""Set up for I24 fixed target data collection, trigger the detector and open \
|
|
@@ -382,6 +373,9 @@ def start_i24(
|
|
|
382
373
|
Returns the start_time.
|
|
383
374
|
"""
|
|
384
375
|
|
|
376
|
+
beam_settings = yield from read_beam_info_from_hardware(
|
|
377
|
+
dcm, mirrors, beam_center_device, parameters.detector_name
|
|
378
|
+
)
|
|
385
379
|
SSX_LOGGER.info("Start I24 data collection.")
|
|
386
380
|
start_time = datetime.now()
|
|
387
381
|
SSX_LOGGER.info(f"Collection start time {start_time.ctime()}")
|
|
@@ -431,20 +425,23 @@ def start_i24(
|
|
|
431
425
|
|
|
432
426
|
# DCID process depends on detector PVs being set up already
|
|
433
427
|
SSX_LOGGER.debug("Start DCID process")
|
|
428
|
+
filetemplate = yield from get_pilatus_filename_template_from_device()
|
|
434
429
|
dcid.generate_dcid(
|
|
435
|
-
|
|
430
|
+
beam_settings=beam_settings,
|
|
436
431
|
image_dir=filepath,
|
|
437
|
-
|
|
432
|
+
file_template=filetemplate,
|
|
438
433
|
num_images=parameters.total_num_images,
|
|
439
|
-
exposure_time=parameters.exposure_time_s,
|
|
440
434
|
shots_per_position=parameters.num_exposures,
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
pump_status=parameters.pump_repeat.value,
|
|
435
|
+
start_time=start_time,
|
|
436
|
+
pump_probe=bool(parameters.pump_repeat),
|
|
444
437
|
)
|
|
445
438
|
|
|
446
439
|
SSX_LOGGER.debug("Arm Pilatus. Arm Zebra.")
|
|
447
|
-
shutter_time_offset =
|
|
440
|
+
shutter_time_offset = (
|
|
441
|
+
SHUTTER_OPEN_TIME
|
|
442
|
+
if parameters.pump_repeat is PumpProbeSetting.Medium1
|
|
443
|
+
else 0.0
|
|
444
|
+
)
|
|
448
445
|
yield from setup_zebra_for_fastchip_plan(
|
|
449
446
|
zebra,
|
|
450
447
|
parameters.detector_name,
|
|
@@ -467,7 +464,7 @@ def start_i24(
|
|
|
467
464
|
SSX_LOGGER.info("Using Eiger detector")
|
|
468
465
|
|
|
469
466
|
SSX_LOGGER.debug(f"Creating the directory for the collection in {filepath}.")
|
|
470
|
-
Path(filepath).mkdir(parents=True)
|
|
467
|
+
Path(filepath).mkdir(parents=True, exist_ok=True)
|
|
471
468
|
|
|
472
469
|
SSX_LOGGER.info(f"Triggered Eiger setup: filepath {filepath}")
|
|
473
470
|
SSX_LOGGER.info(f"Triggered Eiger setup: filename {filename}")
|
|
@@ -490,20 +487,23 @@ def start_i24(
|
|
|
490
487
|
|
|
491
488
|
# DCID process depends on detector PVs being set up already
|
|
492
489
|
SSX_LOGGER.debug("Start DCID process")
|
|
490
|
+
filetemplate = f"{parameters.filename}.nxs"
|
|
493
491
|
dcid.generate_dcid(
|
|
494
|
-
|
|
492
|
+
beam_settings=beam_settings,
|
|
495
493
|
image_dir=filepath,
|
|
496
|
-
|
|
494
|
+
file_template=filetemplate,
|
|
497
495
|
num_images=parameters.total_num_images,
|
|
498
|
-
exposure_time=parameters.exposure_time_s,
|
|
499
496
|
shots_per_position=parameters.num_exposures,
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
pump_status=parameters.pump_repeat.value,
|
|
497
|
+
start_time=start_time,
|
|
498
|
+
pump_probe=bool(parameters.pump_repeat),
|
|
503
499
|
)
|
|
504
500
|
|
|
505
501
|
SSX_LOGGER.debug("Arm Zebra.")
|
|
506
|
-
shutter_time_offset =
|
|
502
|
+
shutter_time_offset = (
|
|
503
|
+
SHUTTER_OPEN_TIME
|
|
504
|
+
if parameters.pump_repeat is PumpProbeSetting.Medium1
|
|
505
|
+
else 0.0
|
|
506
|
+
)
|
|
507
507
|
yield from setup_zebra_for_fastchip_plan(
|
|
508
508
|
zebra,
|
|
509
509
|
parameters.detector_name,
|
|
@@ -594,11 +594,17 @@ def main_fixed_target_plan(
|
|
|
594
594
|
detector_stage: DetectorMotion,
|
|
595
595
|
shutter: HutchShutter,
|
|
596
596
|
dcm: DCM,
|
|
597
|
+
mirrors: FocusMirrorsMode,
|
|
598
|
+
beam_center_device: DetectorBeamCenter,
|
|
597
599
|
parameters: FixedTargetParameters,
|
|
598
600
|
dcid: DCID,
|
|
599
601
|
) -> MsgGenerator:
|
|
600
602
|
SSX_LOGGER.info("Running a chip collection on I24")
|
|
601
603
|
|
|
604
|
+
yield from sup.set_detector_beam_center_plan(
|
|
605
|
+
beam_center_device, parameters.detector_name
|
|
606
|
+
)
|
|
607
|
+
|
|
602
608
|
SSX_LOGGER.info("Getting Program Dictionary")
|
|
603
609
|
|
|
604
610
|
# If alignment type is Oxford inner it is still an Oxford type chip
|
|
@@ -621,7 +627,17 @@ def main_fixed_target_plan(
|
|
|
621
627
|
)
|
|
622
628
|
|
|
623
629
|
start_time = yield from start_i24(
|
|
624
|
-
zebra,
|
|
630
|
+
zebra,
|
|
631
|
+
aperture,
|
|
632
|
+
backlight,
|
|
633
|
+
beamstop,
|
|
634
|
+
detector_stage,
|
|
635
|
+
shutter,
|
|
636
|
+
parameters,
|
|
637
|
+
dcm,
|
|
638
|
+
mirrors,
|
|
639
|
+
beam_center_device,
|
|
640
|
+
dcid,
|
|
625
641
|
)
|
|
626
642
|
|
|
627
643
|
SSX_LOGGER.info("Moving to Start")
|
|
@@ -636,14 +652,13 @@ def main_fixed_target_plan(
|
|
|
636
652
|
SSX_LOGGER.debug("Notify DCID of the start of the collection.")
|
|
637
653
|
dcid.notify_start()
|
|
638
654
|
|
|
639
|
-
wavelength = yield from bps.rd(dcm.wavelength_in_a)
|
|
640
655
|
if parameters.detector_name == "eiger":
|
|
656
|
+
wavelength = yield from bps.rd(dcm.wavelength_in_a)
|
|
657
|
+
beam_x = yield from bps.rd(beam_center_device.beam_x)
|
|
658
|
+
beam_y = yield from bps.rd(beam_center_device.beam_y)
|
|
641
659
|
SSX_LOGGER.debug("Start nexus writing service.")
|
|
642
660
|
call_nexgen(
|
|
643
|
-
chip_prog_dict,
|
|
644
|
-
start_time,
|
|
645
|
-
parameters,
|
|
646
|
-
wavelength,
|
|
661
|
+
chip_prog_dict, parameters, wavelength, (beam_x, beam_y), start_time
|
|
647
662
|
)
|
|
648
663
|
|
|
649
664
|
yield from kickoff_and_complete_collection(pmac, parameters)
|
|
@@ -731,9 +746,11 @@ def run_fixed_target_plan(
|
|
|
731
746
|
detector_stage: DetectorMotion = inject("detector_motion"),
|
|
732
747
|
shutter: HutchShutter = inject("shutter"),
|
|
733
748
|
dcm: DCM = inject("dcm"),
|
|
749
|
+
mirrors: FocusMirrorsMode = inject("focus_mirrors"),
|
|
750
|
+
attenuator: ReadOnlyAttenuator = inject("attenuator"),
|
|
734
751
|
) -> MsgGenerator:
|
|
735
752
|
# in the first instance, write params here
|
|
736
|
-
yield from write_parameter_file(detector_stage)
|
|
753
|
+
yield from write_parameter_file(detector_stage, attenuator)
|
|
737
754
|
|
|
738
755
|
SSX_LOGGER.info("Getting parameters from file.")
|
|
739
756
|
parameters = FixedTargetParameters.from_file(PARAM_FILE_PATH_FT / PARAM_FILE_NAME)
|
|
@@ -756,12 +773,10 @@ def run_fixed_target_plan(
|
|
|
756
773
|
"""
|
|
757
774
|
SSX_LOGGER.info(log_msg)
|
|
758
775
|
|
|
776
|
+
beam_center_device = sup.get_beam_center_device(parameters.detector_name)
|
|
777
|
+
|
|
759
778
|
# DCID instance - do not create yet
|
|
760
|
-
dcid = DCID(
|
|
761
|
-
emit_errors=False,
|
|
762
|
-
ssx_type=SSXType.FIXED,
|
|
763
|
-
detector=parameters.detector_name,
|
|
764
|
-
)
|
|
779
|
+
dcid = DCID(emit_errors=False, expt_params=parameters)
|
|
765
780
|
|
|
766
781
|
yield from bpp.contingency_wrapper(
|
|
767
782
|
main_fixed_target_plan(
|
|
@@ -773,6 +788,8 @@ def run_fixed_target_plan(
|
|
|
773
788
|
detector_stage,
|
|
774
789
|
shutter,
|
|
775
790
|
dcm,
|
|
791
|
+
mirrors,
|
|
792
|
+
beam_center_device,
|
|
776
793
|
parameters,
|
|
777
794
|
dcid,
|
|
778
795
|
),
|