mx-bluesky 1.4.6__py3-none-any.whl → 1.4.8__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/aithre_lasershaping/__init__.py +13 -0
- mx_bluesky/beamlines/aithre_lasershaping/check_goniometer_performance.py +29 -0
- mx_bluesky/beamlines/aithre_lasershaping/goniometer_controls.py +18 -0
- mx_bluesky/beamlines/i04/redis_to_murko_forwarder.py +35 -29
- mx_bluesky/beamlines/i04/thawing_plan.py +18 -3
- mx_bluesky/beamlines/i23/__init__.py +3 -0
- mx_bluesky/beamlines/i23/serial.py +71 -0
- mx_bluesky/beamlines/i24/serial/__init__.py +2 -0
- mx_bluesky/beamlines/i24/serial/extruder/EX-gui-edm/DiamondExtruder-I24-py3v1.edl +12 -12
- mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +36 -30
- mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/pumpprobe-py3v1.edl +3 -3
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +15 -66
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +8 -10
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py +10 -3
- mx_bluesky/beamlines/i24/serial/log.py +9 -9
- mx_bluesky/beamlines/i24/serial/parameters/utils.py +36 -7
- mx_bluesky/beamlines/i24/serial/set_visit_directory.sh +1 -1
- mx_bluesky/beamlines/i24/serial/setup_beamline/pv.py +16 -17
- mx_bluesky/beamlines/i24/serial/setup_beamline/pv_abstract.py +4 -4
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +51 -52
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +3 -2
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +9 -7
- mx_bluesky/beamlines/i24/serial/web_gui_plans/general_plans.py +71 -11
- mx_bluesky/beamlines/i24/serial/write_nexus.py +6 -5
- mx_bluesky/{hyperion → common}/device_setup_plans/check_beamstop.py +1 -1
- mx_bluesky/{hyperion → common}/device_setup_plans/manipulate_sample.py +1 -1
- mx_bluesky/{hyperion → common}/device_setup_plans/setup_oav.py +12 -6
- mx_bluesky/common/device_setup_plans/xbpm_feedback.py +45 -0
- mx_bluesky/{hyperion → common}/experiment_plans/change_aperture_then_move_plan.py +13 -29
- mx_bluesky/{hyperion → common}/experiment_plans/oav_grid_detection_plan.py +6 -6
- mx_bluesky/common/external_interaction/callbacks/common/ispyb_callback_base.py +8 -9
- mx_bluesky/common/external_interaction/callbacks/common/ispyb_mapping.py +1 -1
- mx_bluesky/common/external_interaction/callbacks/common/zocalo_callback.py +18 -15
- mx_bluesky/{hyperion → common}/external_interaction/callbacks/sample_handling/sample_handling_callback.py +16 -4
- mx_bluesky/common/external_interaction/callbacks/xray_centre/ispyb_callback.py +50 -45
- mx_bluesky/common/external_interaction/callbacks/xray_centre/nexus_callback.py +2 -1
- mx_bluesky/common/external_interaction/ispyb/data_model.py +1 -0
- mx_bluesky/common/external_interaction/ispyb/ispyb_store.py +18 -2
- mx_bluesky/common/external_interaction/ispyb/ispyb_utils.py +4 -4
- mx_bluesky/common/external_interaction/nexus/nexus_utils.py +1 -1
- mx_bluesky/common/parameters/components.py +22 -2
- mx_bluesky/common/parameters/constants.py +6 -16
- mx_bluesky/common/parameters/gridscan.py +36 -32
- mx_bluesky/common/plans/common_flyscan_xray_centre_plan.py +316 -0
- mx_bluesky/common/plans/inner_plans/__init__ .py +0 -0
- mx_bluesky/common/plans/read_hardware.py +3 -3
- mx_bluesky/common/plans/write_sample_status.py +46 -0
- mx_bluesky/common/preprocessors/__init__.py +0 -0
- mx_bluesky/common/preprocessors/preprocessors.py +105 -0
- mx_bluesky/common/protocols/__init__.py +0 -0
- mx_bluesky/common/protocols/protocols.py +10 -0
- mx_bluesky/common/utils/log.py +15 -12
- mx_bluesky/hyperion/__main__.py +5 -24
- mx_bluesky/hyperion/baton_handler.py +84 -0
- mx_bluesky/hyperion/device_setup_plans/dcm_pitch_roll_mirror_adjuster.py +4 -4
- mx_bluesky/hyperion/device_setup_plans/setup_panda.py +5 -1
- mx_bluesky/hyperion/device_setup_plans/setup_zebra.py +0 -33
- mx_bluesky/hyperion/device_setup_plans/utils.py +4 -4
- mx_bluesky/hyperion/experiment_plans/__init__.py +0 -10
- mx_bluesky/hyperion/experiment_plans/experiment_registry.py +0 -16
- mx_bluesky/hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py +71 -88
- mx_bluesky/hyperion/experiment_plans/hyperion_flyscan_xray_centre_plan.py +183 -0
- mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +17 -8
- mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +29 -8
- mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +4 -4
- mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +6 -4
- mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +11 -3
- mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +9 -34
- mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +35 -68
- mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +27 -8
- mx_bluesky/hyperion/external_interaction/agamemnon.py +140 -10
- mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +17 -9
- mx_bluesky/hyperion/external_interaction/callbacks/snapshot_callback.py +259 -0
- mx_bluesky/hyperion/parameters/cli.py +2 -10
- mx_bluesky/hyperion/parameters/constants.py +0 -5
- mx_bluesky/hyperion/parameters/device_composites.py +40 -5
- mx_bluesky/hyperion/parameters/gridscan.py +9 -58
- mx_bluesky/hyperion/parameters/rotation.py +1 -5
- mx_bluesky/hyperion/utils/context.py +2 -5
- mx_bluesky/hyperion/utils/validation.py +13 -10
- {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info}/METADATA +10 -9
- {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info}/RECORD +92 -79
- {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info}/WHEEL +1 -1
- mx_bluesky/common/external_interaction/callbacks/common/aperture_change_callback.py +0 -22
- mx_bluesky/hyperion/device_setup_plans/xbpm_feedback.py +0 -103
- mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py +0 -466
- /mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/{short1-laser.png → s1l.png} +0 -0
- /mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/{short2-laser.png → s2l.png} +0 -0
- /mx_bluesky/{hyperion → common}/device_setup_plans/position_detector.py +0 -0
- /mx_bluesky/{hyperion → common}/external_interaction/callbacks/sample_handling/__init__.py +0 -0
- /mx_bluesky/common/plans/{do_fgs.py → inner_plans/do_fgs.py} +0 -0
- {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info}/entry_points.txt +0 -0
- {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info/licenses}/LICENSE +0 -0
- {mx_bluesky-1.4.6.dist-info → mx_bluesky-1.4.8.dist-info}/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ Fixed target data collection
|
|
|
4
4
|
|
|
5
5
|
from datetime import datetime
|
|
6
6
|
from pathlib import Path
|
|
7
|
-
from
|
|
7
|
+
from traceback import format_exception
|
|
8
8
|
|
|
9
9
|
import bluesky.plan_stubs as bps
|
|
10
10
|
import bluesky.preprocessors as bpp
|
|
@@ -52,52 +52,6 @@ from mx_bluesky.beamlines.i24.serial.setup_beamline.setup_zebra_plans import (
|
|
|
52
52
|
)
|
|
53
53
|
from mx_bluesky.beamlines.i24.serial.write_nexus import call_nexgen
|
|
54
54
|
|
|
55
|
-
# Move this in common place as part of
|
|
56
|
-
# https://github.com/DiamondLightSource/mx-bluesky/pull/603
|
|
57
|
-
PMAC_MOVE_TIME = 0.008 # Move time between positions on chip ~ 7-8 ms
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
def calculate_collection_timeout(parameters: FixedTargetParameters) -> float:
|
|
61
|
-
"""Give an estimation of the time the plan should wait for the data collection \
|
|
62
|
-
to be finished.
|
|
63
|
-
|
|
64
|
-
For non-pump probe collections and collection with short delays, it should be \
|
|
65
|
-
enough to use the collection time plus a genereous 30s buffer.
|
|
66
|
-
For EAVA (Excite and visit again) collections instead, the laser dwell and laser \
|
|
67
|
-
delay times should be included in the calculation. For long dalays between pump \
|
|
68
|
-
and probe, the shutter opening time will also need to be taken into account.
|
|
69
|
-
For more details on the dynamics see
|
|
70
|
-
https://confluence.diamond.ac.uk/display/MXTech/Dynamics+and+fixed+targets.
|
|
71
|
-
|
|
72
|
-
Args:
|
|
73
|
-
parameters (FixedTargerParameters): The collection parameters.
|
|
74
|
-
|
|
75
|
-
Returns:
|
|
76
|
-
The estimated collection time, in s.
|
|
77
|
-
"""
|
|
78
|
-
buffer = PMAC_MOVE_TIME * parameters.total_num_images + 600
|
|
79
|
-
pump_setting = parameters.pump_repeat
|
|
80
|
-
collection_time = parameters.total_num_images * parameters.exposure_time_s
|
|
81
|
-
if pump_setting in [
|
|
82
|
-
PumpProbeSetting.NoPP,
|
|
83
|
-
PumpProbeSetting.Short1,
|
|
84
|
-
PumpProbeSetting.Short2,
|
|
85
|
-
]:
|
|
86
|
-
timeout = collection_time + buffer
|
|
87
|
-
else:
|
|
88
|
-
# EAVA: Excite and visit again
|
|
89
|
-
num_windows = parameters.total_num_images / parameters.num_exposures
|
|
90
|
-
timeout = (
|
|
91
|
-
collection_time
|
|
92
|
-
+ parameters.laser_dwell_s * num_windows # type: ignore
|
|
93
|
-
+ parameters.laser_delay_s
|
|
94
|
-
+ buffer
|
|
95
|
-
)
|
|
96
|
-
if pump_setting == PumpProbeSetting.Medium1:
|
|
97
|
-
# Long delay between pump and probe, with fast shutter opening and closing.
|
|
98
|
-
timeout = timeout + SHUTTER_OPEN_TIME * parameters.total_num_images
|
|
99
|
-
return timeout
|
|
100
|
-
|
|
101
55
|
|
|
102
56
|
def write_userlog(
|
|
103
57
|
parameters: FixedTargetParameters,
|
|
@@ -362,7 +316,7 @@ def start_i24(
|
|
|
362
316
|
f"Fastchip Pilatus setup: exposure time {parameters.exposure_time_s}"
|
|
363
317
|
)
|
|
364
318
|
|
|
365
|
-
sup.pilatus(
|
|
319
|
+
yield from sup.pilatus(
|
|
366
320
|
"fastchip",
|
|
367
321
|
[
|
|
368
322
|
filepath,
|
|
@@ -407,7 +361,7 @@ def start_i24(
|
|
|
407
361
|
caput(pv.pilat_acquire, "1") # Arm pilatus
|
|
408
362
|
yield from arm_zebra(zebra)
|
|
409
363
|
caput(pv.pilat_filename, filename)
|
|
410
|
-
sleep(1.5)
|
|
364
|
+
yield from bps.sleep(1.5)
|
|
411
365
|
|
|
412
366
|
elif parameters.detector_name == "eiger":
|
|
413
367
|
SSX_LOGGER.info("Using Eiger detector")
|
|
@@ -423,7 +377,7 @@ def start_i24(
|
|
|
423
377
|
f"Triggered Eiger setup: exposure time {parameters.exposure_time_s}"
|
|
424
378
|
)
|
|
425
379
|
|
|
426
|
-
sup.eiger(
|
|
380
|
+
yield from sup.eiger(
|
|
427
381
|
"triggered",
|
|
428
382
|
[
|
|
429
383
|
filepath,
|
|
@@ -431,6 +385,7 @@ def start_i24(
|
|
|
431
385
|
parameters.total_num_images,
|
|
432
386
|
parameters.exposure_time_s,
|
|
433
387
|
],
|
|
388
|
+
dcm,
|
|
434
389
|
)
|
|
435
390
|
|
|
436
391
|
# DCID process depends on detector PVs being set up already
|
|
@@ -468,7 +423,7 @@ def start_i24(
|
|
|
468
423
|
)
|
|
469
424
|
yield from arm_zebra(zebra)
|
|
470
425
|
|
|
471
|
-
sleep(1.5)
|
|
426
|
+
yield from bps.sleep(1.5)
|
|
472
427
|
|
|
473
428
|
else:
|
|
474
429
|
msg = f"Unknown Detector Type, det_type = {parameters.detector_name}"
|
|
@@ -501,12 +456,12 @@ def finish_i24(
|
|
|
501
456
|
SSX_LOGGER.debug("Finish I24 Pilatus")
|
|
502
457
|
complete_filename = f"{parameters.filename}_{caget(pv.pilat_filenum)}"
|
|
503
458
|
yield from reset_zebra_when_collection_done_plan(zebra)
|
|
504
|
-
sup.pilatus("return-to-normal", None)
|
|
505
|
-
sleep(0.2)
|
|
459
|
+
yield from sup.pilatus("return-to-normal", None)
|
|
460
|
+
yield from bps.sleep(0.2)
|
|
506
461
|
elif parameters.detector_name == "eiger":
|
|
507
462
|
SSX_LOGGER.debug("Finish I24 Eiger")
|
|
508
463
|
yield from reset_zebra_when_collection_done_plan(zebra)
|
|
509
|
-
sup.eiger("return-to-normal", None)
|
|
464
|
+
yield from sup.eiger("return-to-normal", None, dcm)
|
|
510
465
|
complete_filename = cagetstring(pv.eiger_ODfilenameRBV) # type: ignore
|
|
511
466
|
else:
|
|
512
467
|
raise ValueError(f"{parameters.detector_name=} unrecognised")
|
|
@@ -521,12 +476,12 @@ def finish_i24(
|
|
|
521
476
|
write_userlog(parameters, complete_filename, transmission, wavelength)
|
|
522
477
|
|
|
523
478
|
|
|
524
|
-
def run_aborted_plan(pmac: PMAC, dcid: DCID):
|
|
479
|
+
def run_aborted_plan(pmac: PMAC, dcid: DCID, exception: Exception):
|
|
525
480
|
"""Plan to send pmac_strings to tell the PMAC when a collection has been aborted, \
|
|
526
481
|
either by pressing the Abort button or because of a timeout, and to reset the \
|
|
527
482
|
P variable.
|
|
528
483
|
"""
|
|
529
|
-
SSX_LOGGER.warning("Data Collection Aborted")
|
|
484
|
+
SSX_LOGGER.warning(f"Data Collection Aborted: {format_exception(exception)}")
|
|
530
485
|
yield from bps.trigger(pmac.abort_program, wait=True)
|
|
531
486
|
|
|
532
487
|
end_time = datetime.now()
|
|
@@ -595,7 +550,7 @@ def main_fixed_target_plan(
|
|
|
595
550
|
|
|
596
551
|
SSX_LOGGER.info("Moving to Start")
|
|
597
552
|
yield from bps.trigger(pmac.to_xyz_zero)
|
|
598
|
-
sleep(2.0)
|
|
553
|
+
yield from bps.sleep(2.0)
|
|
599
554
|
|
|
600
555
|
# Now ready for data collection. Open fast shutter (zebra gate)
|
|
601
556
|
SSX_LOGGER.info("Opening fast shutter.")
|
|
@@ -622,12 +577,6 @@ def kickoff_and_complete_collection(pmac: PMAC, parameters: FixedTargetParameter
|
|
|
622
577
|
parameters.chip.chip_type, parameters.map_type, parameters.pump_repeat
|
|
623
578
|
)
|
|
624
579
|
yield from bps.abs_set(pmac.program_number, prog_num, group="setup_pmac")
|
|
625
|
-
# Calculate approx collection time
|
|
626
|
-
total_collection_time = calculate_collection_timeout(parameters)
|
|
627
|
-
SSX_LOGGER.info(f"Estimated collection time: {total_collection_time}s.")
|
|
628
|
-
yield from bps.abs_set(
|
|
629
|
-
pmac.collection_time, total_collection_time, group="setup_pmac"
|
|
630
|
-
)
|
|
631
580
|
yield from bps.wait(group="setup_pmac") # Make sure the soft signals are set
|
|
632
581
|
|
|
633
582
|
@bpp.run_decorator(md={"subplan_name": "run_ft_collection"})
|
|
@@ -666,7 +615,7 @@ def tidy_up_after_collection_plan(
|
|
|
666
615
|
"""
|
|
667
616
|
SSX_LOGGER.info("Closing fast shutter")
|
|
668
617
|
yield from close_fast_shutter(zebra)
|
|
669
|
-
sleep(2.0)
|
|
618
|
+
yield from bps.sleep(2.0)
|
|
670
619
|
|
|
671
620
|
# This probably should go in main then
|
|
672
621
|
if parameters.detector_name == "pilatus":
|
|
@@ -676,7 +625,7 @@ def tidy_up_after_collection_plan(
|
|
|
676
625
|
SSX_LOGGER.debug("Eiger Acquire STOP")
|
|
677
626
|
caput(pv.eiger_acquire, 0)
|
|
678
627
|
caput(pv.eiger_ODcapture, "Done")
|
|
679
|
-
sleep(0.5)
|
|
628
|
+
yield from bps.sleep(0.5)
|
|
680
629
|
|
|
681
630
|
yield from finish_i24(zebra, pmac, shutter, dcm, parameters)
|
|
682
631
|
|
|
@@ -732,7 +681,7 @@ def run_fixed_target_plan(
|
|
|
732
681
|
parameters,
|
|
733
682
|
dcid,
|
|
734
683
|
),
|
|
735
|
-
except_plan=lambda e: (yield from run_aborted_plan(pmac, dcid)),
|
|
684
|
+
except_plan=lambda e: (yield from run_aborted_plan(pmac, dcid, e)),
|
|
736
685
|
final_plan=lambda: (
|
|
737
686
|
yield from tidy_up_after_collection_plan(
|
|
738
687
|
zebra, pmac, shutter, dcm, parameters, dcid
|
|
@@ -6,10 +6,8 @@ This version changed to python3 March2020 by RLO
|
|
|
6
6
|
import json
|
|
7
7
|
import re
|
|
8
8
|
import sys
|
|
9
|
-
import time
|
|
10
9
|
from pathlib import Path
|
|
11
10
|
from pprint import pformat
|
|
12
|
-
from time import sleep
|
|
13
11
|
|
|
14
12
|
import bluesky.plan_stubs as bps
|
|
15
13
|
import numpy as np
|
|
@@ -100,7 +98,7 @@ def initialise_stages(
|
|
|
100
98
|
|
|
101
99
|
caput(pv.pilat_cbftemplate, 0)
|
|
102
100
|
|
|
103
|
-
sleep(0.1)
|
|
101
|
+
yield from bps.sleep(0.1)
|
|
104
102
|
SSX_LOGGER.info("Clearing General Purpose PVs 1-120")
|
|
105
103
|
for i in range(4, 120):
|
|
106
104
|
if i == 100:
|
|
@@ -259,7 +257,7 @@ def upload_chip_map_to_geobrick(pmac: PMAC, chip_map: list[int]) -> MsgGenerator
|
|
|
259
257
|
SSX_LOGGER.debug(f"Set {pvar_str} for block {block}")
|
|
260
258
|
yield from bps.abs_set(pmac.pmac_string, pvar_str, wait=True)
|
|
261
259
|
# Wait for PMAC to be done processing PVAR string
|
|
262
|
-
sleep(0.02)
|
|
260
|
+
yield from bps.sleep(0.02)
|
|
263
261
|
SSX_LOGGER.debug("Upload parameters done.")
|
|
264
262
|
|
|
265
263
|
|
|
@@ -832,16 +830,16 @@ def cs_maker(pmac: PMAC = inject("pmac")) -> MsgGenerator:
|
|
|
832
830
|
SSX_LOGGER.info(f"{sqfact1:1.4f} \n {sqfact2:1.4f} \n {sqfact3:1.4f}")
|
|
833
831
|
SSX_LOGGER.debug("Long wait, please be patient")
|
|
834
832
|
yield from bps.trigger(pmac.to_xyz_zero)
|
|
835
|
-
sleep(2.5)
|
|
833
|
+
yield from bps.sleep(2.5)
|
|
836
834
|
yield from set_pmac_strings_for_cs(pmac, {"cs1": cs1, "cs2": cs2, "cs3": cs3})
|
|
837
835
|
yield from bps.trigger(pmac.to_xyz_zero)
|
|
838
|
-
sleep(2.5)
|
|
836
|
+
yield from bps.sleep(2.5)
|
|
839
837
|
yield from bps.trigger(pmac.home, wait=True)
|
|
840
|
-
sleep(2.5)
|
|
838
|
+
yield from bps.sleep(2.5)
|
|
841
839
|
SSX_LOGGER.debug(f"Chip_type is {chip_type}")
|
|
842
840
|
if chip_type == 0:
|
|
843
841
|
yield from bps.abs_set(pmac.pmac_string, "!x0.4y0.4", wait=True)
|
|
844
|
-
sleep(2.5)
|
|
842
|
+
yield from bps.sleep(2.5)
|
|
845
843
|
yield from bps.trigger(pmac.home, wait=True)
|
|
846
844
|
else:
|
|
847
845
|
yield from bps.trigger(pmac.home, wait=True)
|
|
@@ -932,12 +930,12 @@ def block_check(pmac: PMAC = inject("pmac")) -> MsgGenerator:
|
|
|
932
930
|
for entry in block_start_list:
|
|
933
931
|
if int(caget(pv.me14e_gp9)) != 0:
|
|
934
932
|
SSX_LOGGER.warning("Block Check Aborted")
|
|
935
|
-
sleep(1.0)
|
|
933
|
+
yield from bps.sleep(1.0)
|
|
936
934
|
break
|
|
937
935
|
block, x, y = entry
|
|
938
936
|
SSX_LOGGER.debug(f"Block: {block} -> (x={x} y={y})")
|
|
939
937
|
yield from bps.abs_set(pmac.pmac_string, f"!x{x}y{y}", wait=True)
|
|
940
|
-
|
|
938
|
+
yield from bps.sleep(0.4)
|
|
941
939
|
else:
|
|
942
940
|
SSX_LOGGER.warning("Block Check Aborted due to GP 9 not equalling 0")
|
|
943
941
|
break
|
|
@@ -34,7 +34,12 @@ def _get_beam_centre(oav: OAV):
|
|
|
34
34
|
def _calculate_zoom_calibrator(oav: OAV):
|
|
35
35
|
"""Set the scale for the zoom calibrator for the pmac moves."""
|
|
36
36
|
currentzoom = yield from bps.rd(oav.zoom_controller.percentage)
|
|
37
|
-
zoomcalibrator =
|
|
37
|
+
zoomcalibrator = (
|
|
38
|
+
1.285
|
|
39
|
+
- (0.02866 * currentzoom)
|
|
40
|
+
+ (0.00025 * currentzoom**2)
|
|
41
|
+
- (0.0000008151 * currentzoom**3)
|
|
42
|
+
)
|
|
38
43
|
return zoomcalibrator
|
|
39
44
|
|
|
40
45
|
|
|
@@ -49,8 +54,10 @@ def _move_on_mouse_click_plan(
|
|
|
49
54
|
zoomcalibrator = yield from _calculate_zoom_calibrator(oav)
|
|
50
55
|
beamX, beamY = yield from _get_beam_centre(oav)
|
|
51
56
|
x, y = clicked_position
|
|
52
|
-
xmove = -
|
|
53
|
-
ymove =
|
|
57
|
+
xmove = -10 * (beamX - x) * zoomcalibrator
|
|
58
|
+
ymove = 10 * (beamY - y) * zoomcalibrator
|
|
59
|
+
SSX_LOGGER.info(f"Zoom calibrator {zoomcalibrator}")
|
|
60
|
+
SSX_LOGGER.info(f"Beam centre {beamX} {beamY}")
|
|
54
61
|
SSX_LOGGER.info(f"Moving X and Y {xmove} {ymove}")
|
|
55
62
|
xmovepmacstring = "#1J:" + str(xmove)
|
|
56
63
|
ymovepmacstring = "#2J:" + str(ymove)
|
|
@@ -99,15 +99,6 @@ def config(
|
|
|
99
99
|
dev_mode (bool, optional): If true, will log to graylog on localhost instead \
|
|
100
100
|
of production. Defaults to False.
|
|
101
101
|
"""
|
|
102
|
-
do_default_logging_setup(
|
|
103
|
-
"mx-bluesky.log",
|
|
104
|
-
DEFAULT_GRAYLOG_PORT,
|
|
105
|
-
dev_mode=dev_mode,
|
|
106
|
-
integrate_all_logs=False,
|
|
107
|
-
)
|
|
108
|
-
# Remove dodal StreamHandler to avoid duplication of messages above debug
|
|
109
|
-
dodal_logger.removeHandler(dodal_logger.handlers[0])
|
|
110
|
-
_integrate_bluesky_logs(dodal_logger)
|
|
111
102
|
if logfile:
|
|
112
103
|
logs = _get_logging_file_path() / logfile
|
|
113
104
|
fileFormatter = logging.Formatter(
|
|
@@ -118,6 +109,15 @@ def config(
|
|
|
118
109
|
FH.setLevel(logging.DEBUG)
|
|
119
110
|
FH.setFormatter(fileFormatter)
|
|
120
111
|
SSX_LOGGER.addHandler(FH)
|
|
112
|
+
do_default_logging_setup(
|
|
113
|
+
"mx-bluesky.log",
|
|
114
|
+
DEFAULT_GRAYLOG_PORT,
|
|
115
|
+
dev_mode=dev_mode,
|
|
116
|
+
integrate_all_logs=False,
|
|
117
|
+
)
|
|
118
|
+
# Remove dodal StreamHandler to avoid duplication of messages above debug
|
|
119
|
+
dodal_logger.removeHandler(dodal_logger.handlers[0])
|
|
120
|
+
_integrate_bluesky_logs(dodal_logger)
|
|
121
121
|
|
|
122
122
|
|
|
123
123
|
def log_on_entry(func):
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
from
|
|
1
|
+
from collections.abc import Sequence
|
|
2
|
+
from typing import Any, Literal
|
|
2
3
|
|
|
3
4
|
from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import ChipType
|
|
4
5
|
from mx_bluesky.beamlines.i24.serial.parameters.experiment_parameters import (
|
|
@@ -13,8 +14,27 @@ class EmptyMapError(Exception):
|
|
|
13
14
|
pass
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
def get_chip_format(
|
|
17
|
-
|
|
17
|
+
def get_chip_format(
|
|
18
|
+
chip_type: ChipType,
|
|
19
|
+
format: Sequence[int | float] | None = None,
|
|
20
|
+
origin: Literal["edm", "web"] = "edm",
|
|
21
|
+
) -> ChipDescription:
|
|
22
|
+
"""Get the default parameter values for the requested chip type.
|
|
23
|
+
|
|
24
|
+
For an Oxford-type chip, the default values are hard coded as the dimensions are
|
|
25
|
+
always the same. For a Custom chip instead, the number of steps and step size in
|
|
26
|
+
each direction must be entered through the GUI - web or edm. If the collection is
|
|
27
|
+
run through the edm, the values will be read from the general purpose PVs set on
|
|
28
|
+
there. If instead the plan is run from the web UI, the values will be passed in the
|
|
29
|
+
form of a list/tuple of 4 values.
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
chip_type (ChipType): Chip in use
|
|
33
|
+
custom_format (Sequence[int | float], optional): Number and size of steps input
|
|
34
|
+
from the web ui. Format should be: [int, int, float, float].
|
|
35
|
+
Defaults to None.
|
|
36
|
+
origin (str, optional): UI in use, can be either web or edm. Defaults to edm.
|
|
37
|
+
"""
|
|
18
38
|
defaults: dict[str, int | float] = {}
|
|
19
39
|
match chip_type:
|
|
20
40
|
case ChipType.Oxford:
|
|
@@ -33,10 +53,19 @@ def get_chip_format(chip_type: ChipType) -> ChipDescription:
|
|
|
33
53
|
defaults["x_blocks"] = defaults["y_blocks"] = 1
|
|
34
54
|
defaults["b2b_horz"] = defaults["b2b_vert"] = 0.0
|
|
35
55
|
case ChipType.Custom:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
56
|
+
if origin == "edm":
|
|
57
|
+
defaults["x_num_steps"] = int(caget(pv.me14e_gp6))
|
|
58
|
+
defaults["y_num_steps"] = int(caget(pv.me14e_gp7))
|
|
59
|
+
defaults["x_step_size"] = float(caget(pv.me14e_gp8))
|
|
60
|
+
defaults["y_step_size"] = float(caget(pv.me14e_gp99))
|
|
61
|
+
else:
|
|
62
|
+
# NOTE Test for WEB GUI
|
|
63
|
+
if not format:
|
|
64
|
+
raise ValueError("Format for custom chip not passed")
|
|
65
|
+
defaults["x_num_steps"] = format[0]
|
|
66
|
+
defaults["y_num_steps"] = format[1]
|
|
67
|
+
defaults["x_step_size"] = format[2]
|
|
68
|
+
defaults["y_step_size"] = format[3]
|
|
40
69
|
defaults["x_blocks"] = defaults["y_blocks"] = 1
|
|
41
70
|
defaults["b2b_horz"] = defaults["b2b_vert"] = 0.0
|
|
42
71
|
case ChipType.MISP:
|
|
@@ -154,7 +154,6 @@ dcm_gap = "BL24I-MO-DCM-01:GAP"
|
|
|
154
154
|
dcm_roll1 = "BL24I-MO-DCM-01:XTAL1:ROLL"
|
|
155
155
|
dcm_roll2 = "BL24I-MO-DCM-01:XTAL2:ROLL"
|
|
156
156
|
dcm_pitch2 = "BL24I-MO-DCM-01:XTAL2:PITCH"
|
|
157
|
-
dcm_lambda = "BL24I-MO-DCM-01:LAMBDA"
|
|
158
157
|
dcm_energy = "BL24I-MO-DCM-01:ENERGY"
|
|
159
158
|
|
|
160
159
|
# S2
|
|
@@ -258,22 +257,22 @@ step09_pmac_response = "BL24I-MO-IOC-09:ASYN9.AINP"
|
|
|
258
257
|
step10_pmac_response = "BL24I-MO-IOC-10:ASYN10.AINP"
|
|
259
258
|
step11_pmac_response = "BL24I-MO-IOC-11:ASYN11.AINP"
|
|
260
259
|
step12_pmac_response = "BL24I-MO-IOC-12:ASYN12.AINP"
|
|
261
|
-
# General Purpose PV
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
260
|
+
# General Purpose PV. Now use STEP13
|
|
261
|
+
ioc13_gp1 = "BL24I-MO-IOC-13:GP1"
|
|
262
|
+
ioc13_gp2 = "BL24I-MO-IOC-13:GP2"
|
|
263
|
+
ioc13_gp3 = "BL24I-MO-IOC-13:GP3"
|
|
264
|
+
ioc13_gp4 = "BL24I-MO-IOC-13:GP4"
|
|
265
|
+
ioc13_gp5 = "BL24I-MO-IOC-13:GP5"
|
|
266
|
+
ioc13_gp6 = "BL24I-MO-IOC-13:GP6"
|
|
267
|
+
ioc13_gp7 = "BL24I-MO-IOC-13:GP7"
|
|
268
|
+
ioc13_gp8 = "BL24I-MO-IOC-13:GP8"
|
|
269
|
+
ioc13_gp9 = "BL24I-MO-IOC-13:GP9"
|
|
270
|
+
ioc13_gp10 = "BL24I-MO-IOC-13:GP10"
|
|
271
|
+
ioc13_gp11 = "BL24I-MO-IOC-13:GP11"
|
|
272
|
+
ioc13_gp12 = "BL24I-MO-IOC-13:GP12"
|
|
273
|
+
ioc13_gp13 = "BL24I-MO-IOC-13:GP13"
|
|
274
|
+
ioc13_gp14 = "BL24I-MO-IOC-13:GP14"
|
|
275
|
+
ioc13_gp15 = "BL24I-MO-IOC-13:GP15"
|
|
277
276
|
# ME14E
|
|
278
277
|
me14e_pmac_str = "ME14E-MO-CHIP-01:PMAC_STRING"
|
|
279
278
|
me14e_stage_x = "ME14E-MO-CHIP-01:X"
|
|
@@ -19,8 +19,8 @@ class Pilatus:
|
|
|
19
19
|
round(a * b, 3) for a, b in zip(image_size_pixels, pixel_size_mm, strict=False)
|
|
20
20
|
)
|
|
21
21
|
|
|
22
|
-
det_y_threshold =
|
|
23
|
-
det_y_target =
|
|
22
|
+
det_y_threshold = 640.0
|
|
23
|
+
det_y_target = 647.0
|
|
24
24
|
|
|
25
25
|
class pv:
|
|
26
26
|
detector_distance = pv.pilat_detdist
|
|
@@ -48,8 +48,8 @@ class Eiger:
|
|
|
48
48
|
round(a * b, 3) for a, b in zip(image_size_pixels, pixel_size_mm, strict=False)
|
|
49
49
|
)
|
|
50
50
|
|
|
51
|
-
det_y_threshold =
|
|
52
|
-
det_y_target =
|
|
51
|
+
det_y_threshold = 70.0
|
|
52
|
+
det_y_target = 59.0
|
|
53
53
|
|
|
54
54
|
class pv:
|
|
55
55
|
detector_distance = pv.eiger_detdist
|