mx-bluesky 1.2.0__py3-none-any.whl → 1.4.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mx_bluesky/__init__.py +8 -3
- mx_bluesky/__main__.py +12 -7
- mx_bluesky/_version.py +2 -2
- mx_bluesky/beamlines/i04/callbacks/murko_callback.py +14 -4
- mx_bluesky/beamlines/i04/redis_to_murko_forwarder.py +178 -0
- mx_bluesky/beamlines/i04/thawing_plan.py +49 -11
- mx_bluesky/beamlines/i24/serial/__init__.py +3 -0
- mx_bluesky/beamlines/i24/serial/dcid.py +143 -171
- mx_bluesky/beamlines/i24/serial/extruder/EX-gui-edm/DiamondExtruder-I24-py3v1.edl +1 -1
- mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +121 -110
- mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/DiamondChipI24-py3v1.edl +3 -6
- mx_bluesky/beamlines/i24/serial/fixed_target/ft_utils.py +0 -1
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +164 -169
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +149 -225
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_StartUp_py3v1.py +7 -216
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py +18 -17
- mx_bluesky/beamlines/i24/serial/log.py +58 -49
- mx_bluesky/beamlines/i24/serial/parameters/__init__.py +4 -0
- mx_bluesky/beamlines/i24/serial/parameters/constants.py +6 -1
- mx_bluesky/beamlines/i24/serial/parameters/experiment_parameters.py +42 -15
- mx_bluesky/beamlines/i24/serial/parameters/fixed_target/cs/cs_maker.json +3 -3
- mx_bluesky/beamlines/i24/serial/run_extruder.sh +30 -5
- mx_bluesky/beamlines/i24/serial/run_fixed_target.sh +30 -5
- mx_bluesky/beamlines/i24/serial/run_serial.py +24 -8
- mx_bluesky/beamlines/i24/serial/setup_beamline/ca.py +0 -2
- mx_bluesky/beamlines/i24/serial/setup_beamline/pv.py +2 -0
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +104 -82
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +9 -20
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +26 -28
- mx_bluesky/beamlines/i24/serial/write_nexus.py +74 -72
- mx_bluesky/common/__init__.py +0 -0
- mx_bluesky/common/device_setup_plans/read_hardware_for_setup.py +14 -0
- mx_bluesky/common/external_interaction/config_server.py +46 -0
- mx_bluesky/common/parameters/components.py +258 -0
- mx_bluesky/common/parameters/constants.py +143 -0
- mx_bluesky/common/parameters/gridscan.py +94 -0
- mx_bluesky/common/parameters/robot_load.py +16 -0
- mx_bluesky/common/plans/__init__.py +1 -0
- mx_bluesky/common/plans/do_fgs.py +121 -0
- mx_bluesky/common/utils/log.py +118 -0
- mx_bluesky/{hyperion → common/utils}/tracing.py +2 -2
- mx_bluesky/hyperion/__main__.py +13 -10
- mx_bluesky/hyperion/device_setup_plans/dcm_pitch_roll_mirror_adjuster.py +47 -52
- mx_bluesky/hyperion/device_setup_plans/read_hardware_for_setup.py +6 -12
- mx_bluesky/hyperion/device_setup_plans/setup_oav.py +6 -12
- mx_bluesky/hyperion/device_setup_plans/setup_panda.py +5 -6
- mx_bluesky/hyperion/device_setup_plans/setup_zebra.py +49 -18
- mx_bluesky/hyperion/device_setup_plans/smargon.py +9 -9
- mx_bluesky/hyperion/device_setup_plans/utils.py +2 -2
- mx_bluesky/hyperion/device_setup_plans/xbpm_feedback.py +4 -4
- mx_bluesky/hyperion/exceptions.py +13 -1
- mx_bluesky/hyperion/experiment_plans/__init__.py +4 -0
- mx_bluesky/hyperion/experiment_plans/change_aperture_then_move_plan.py +83 -0
- mx_bluesky/hyperion/experiment_plans/common/xrc_result.py +47 -0
- mx_bluesky/hyperion/experiment_plans/experiment_registry.py +9 -9
- mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py +147 -169
- mx_bluesky/hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py +48 -22
- mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +75 -9
- mx_bluesky/hyperion/experiment_plans/oav_grid_detection_plan.py +21 -20
- mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +9 -6
- mx_bluesky/hyperion/experiment_plans/optimise_attenuation_plan.py +2 -2
- mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +40 -21
- mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +22 -22
- mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +43 -39
- mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +69 -18
- mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +17 -7
- mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +13 -13
- mx_bluesky/hyperion/external_interaction/callbacks/__init__.py +0 -4
- mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +5 -2
- mx_bluesky/hyperion/external_interaction/callbacks/common/abstract_event.py +66 -0
- mx_bluesky/hyperion/external_interaction/callbacks/common/callback_util.py +5 -0
- mx_bluesky/hyperion/external_interaction/callbacks/common/ispyb_mapping.py +1 -1
- mx_bluesky/hyperion/external_interaction/callbacks/grid_detection_callback.py +30 -25
- mx_bluesky/hyperion/external_interaction/callbacks/ispyb_callback_base.py +29 -12
- mx_bluesky/hyperion/external_interaction/callbacks/log_uid_tag_callback.py +1 -1
- mx_bluesky/hyperion/external_interaction/callbacks/robot_load/ispyb_callback.py +19 -11
- mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_callback.py +7 -4
- mx_bluesky/hyperion/external_interaction/callbacks/rotation/nexus_callback.py +5 -3
- mx_bluesky/hyperion/external_interaction/callbacks/sample_handling/__init__.py +0 -0
- mx_bluesky/hyperion/external_interaction/callbacks/sample_handling/sample_handling_callback.py +84 -0
- mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/ispyb_callback.py +38 -27
- mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/nexus_callback.py +5 -4
- mx_bluesky/hyperion/external_interaction/config_server.py +11 -28
- mx_bluesky/hyperion/external_interaction/exceptions.py +0 -9
- mx_bluesky/hyperion/external_interaction/ispyb/exp_eye_store.py +65 -15
- mx_bluesky/hyperion/external_interaction/ispyb/ispyb_store.py +1 -1
- mx_bluesky/hyperion/external_interaction/nexus/nexus_utils.py +2 -2
- mx_bluesky/hyperion/external_interaction/nexus/write_nexus.py +1 -1
- mx_bluesky/hyperion/log.py +0 -84
- mx_bluesky/hyperion/parameters/components.py +4 -251
- mx_bluesky/hyperion/parameters/constants.py +22 -119
- mx_bluesky/hyperion/parameters/gridscan.py +35 -74
- mx_bluesky/hyperion/parameters/load_centre_collect.py +16 -11
- mx_bluesky/hyperion/parameters/rotation.py +23 -10
- mx_bluesky/hyperion/utils/utils.py +17 -0
- mx_bluesky/hyperion/utils/validation.py +5 -6
- {mx_bluesky-1.2.0.dist-info → mx_bluesky-1.4.1.dist-info}/METADATA +36 -33
- {mx_bluesky-1.2.0.dist-info → mx_bluesky-1.4.1.dist-info}/RECORD +102 -89
- {mx_bluesky-1.2.0.dist-info → mx_bluesky-1.4.1.dist-info}/WHEEL +1 -1
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Mapping_py3v1.py +0 -161
- mx_bluesky/example.py +0 -19
- mx_bluesky/hyperion/parameters/robot_load.py +0 -16
- {mx_bluesky-1.2.0.dist-info → mx_bluesky-1.4.1.dist-info}/LICENSE +0 -0
- {mx_bluesky-1.2.0.dist-info → mx_bluesky-1.4.1.dist-info}/entry_points.txt +0 -0
- {mx_bluesky-1.2.0.dist-info → mx_bluesky-1.4.1.dist-info}/top_level.txt +0 -0
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import json
|
|
2
|
+
from abc import abstractmethod
|
|
2
3
|
from pathlib import Path
|
|
3
4
|
from typing import Literal
|
|
4
5
|
|
|
5
|
-
from pydantic import BaseModel, field_validator
|
|
6
|
+
from pydantic import BaseModel, ConfigDict, field_validator
|
|
6
7
|
|
|
7
8
|
from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import (
|
|
8
9
|
ChipType,
|
|
9
10
|
MappingType,
|
|
10
11
|
PumpProbeSetting,
|
|
11
12
|
)
|
|
13
|
+
from mx_bluesky.beamlines.i24.serial.parameters.constants import SSXType
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
class SerialExperiment(BaseModel):
|
|
@@ -20,6 +22,7 @@ class SerialExperiment(BaseModel):
|
|
|
20
22
|
exposure_time_s: float
|
|
21
23
|
detector_distance_mm: float
|
|
22
24
|
detector_name: Literal["eiger", "pilatus"]
|
|
25
|
+
transmission: float
|
|
23
26
|
|
|
24
27
|
@field_validator("visit", mode="before")
|
|
25
28
|
@classmethod
|
|
@@ -36,23 +39,38 @@ class SerialExperiment(BaseModel):
|
|
|
36
39
|
class LaserExperiment(BaseModel):
|
|
37
40
|
"""Laser settings for pump probe serial collections."""
|
|
38
41
|
|
|
39
|
-
laser_dwell_s: float
|
|
40
|
-
laser_delay_s: float
|
|
42
|
+
laser_dwell_s: float = 0.0 # pump exposure time
|
|
43
|
+
laser_delay_s: float = 0.0 # pump delay
|
|
41
44
|
pre_pump_exposure_s: float | None = None # Pre illumination, just for chip
|
|
42
45
|
|
|
43
46
|
|
|
44
|
-
class
|
|
45
|
-
"""Extruder parameter model."""
|
|
46
|
-
|
|
47
|
-
num_images: int
|
|
48
|
-
pump_status: bool
|
|
49
|
-
|
|
47
|
+
class SerialAndLaserExperiment(SerialExperiment, LaserExperiment):
|
|
50
48
|
@classmethod
|
|
51
49
|
def from_file(cls, filename: str | Path):
|
|
52
50
|
with open(filename) as fh:
|
|
53
51
|
raw_params = json.load(fh)
|
|
54
52
|
return cls(**raw_params)
|
|
55
53
|
|
|
54
|
+
@property
|
|
55
|
+
@abstractmethod
|
|
56
|
+
def nexgen_experiment_type(self) -> str:
|
|
57
|
+
pass
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class ExtruderParameters(SerialAndLaserExperiment):
|
|
61
|
+
"""Extruder parameter model."""
|
|
62
|
+
|
|
63
|
+
num_images: int
|
|
64
|
+
pump_status: bool
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def nexgen_experiment_type(self) -> str:
|
|
68
|
+
return "extruder"
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def ispyb_experiment_type(self) -> SSXType:
|
|
72
|
+
return SSXType.EXTRUDER
|
|
73
|
+
|
|
56
74
|
|
|
57
75
|
class ChipDescription(BaseModel):
|
|
58
76
|
"""Parameters defining the chip in use for FT collection."""
|
|
@@ -86,7 +104,7 @@ class ChipDescription(BaseModel):
|
|
|
86
104
|
return ((self.y_num_steps - 1) * self.y_step_size) + self.b2b_vert
|
|
87
105
|
|
|
88
106
|
|
|
89
|
-
class FixedTargetParameters(
|
|
107
|
+
class FixedTargetParameters(SerialAndLaserExperiment):
|
|
90
108
|
"""Fixed target parameter model."""
|
|
91
109
|
|
|
92
110
|
num_exposures: int
|
|
@@ -96,8 +114,17 @@ class FixedTargetParameters(SerialExperiment, LaserExperiment):
|
|
|
96
114
|
checker_pattern: bool = False
|
|
97
115
|
total_num_images: int = 0 # Calculated in the code for now
|
|
98
116
|
|
|
99
|
-
@
|
|
100
|
-
def
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
117
|
+
@property
|
|
118
|
+
def nexgen_experiment_type(self) -> str:
|
|
119
|
+
return "fixed-target"
|
|
120
|
+
|
|
121
|
+
@property
|
|
122
|
+
def ispyb_experiment_type(self) -> SSXType:
|
|
123
|
+
return SSXType.FIXED
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class BeamSettings(BaseModel):
|
|
127
|
+
model_config = ConfigDict(frozen=True)
|
|
128
|
+
wavelength_in_a: float
|
|
129
|
+
beam_size_in_um: tuple[float, float]
|
|
130
|
+
beam_center_in_mm: tuple[float, float]
|
|
@@ -1,19 +1,44 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
+
NO_PROCESERV_TEST=false
|
|
4
|
+
|
|
5
|
+
case "$2" in
|
|
6
|
+
-t | --test)
|
|
7
|
+
echo "Will run serial in test mode without procserv."
|
|
8
|
+
NO_PROCESERV_TEST=true
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
|
|
3
13
|
# Get edm path from input
|
|
4
14
|
edm_path=$1
|
|
5
15
|
|
|
6
16
|
# Get the directory of this script
|
|
7
17
|
current=$( realpath "$( dirname "$0" )" )
|
|
8
18
|
|
|
9
|
-
|
|
10
|
-
|
|
19
|
+
if [[ $NO_PROCESERV_TEST == true ]]; then
|
|
20
|
+
echo "Start the blueapi sever"
|
|
21
|
+
|
|
22
|
+
# Run script to start blueapi serve
|
|
23
|
+
. $current/start_blueapi.sh
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
echo "Set up logging configuration"
|
|
27
|
+
blueapi -c "${current}/blueapi_config.yaml" controller run setup_collection_logs '{"expt":"Serial Jet"}'
|
|
11
28
|
|
|
12
29
|
# Open the edm screen for an extruder serial collection
|
|
13
30
|
echo "Starting extruder edm screen."
|
|
14
31
|
edm -x "${edm_path}/EX-gui/DiamondExtruder-I24-py3v1.edl"
|
|
15
32
|
|
|
16
|
-
echo "Edm screen closed
|
|
33
|
+
echo "Edm screen closed"
|
|
34
|
+
|
|
35
|
+
echo "Clean up log configuration"
|
|
36
|
+
blueapi -c "${current}/blueapi_config.yaml" controller run clean_up_log_config_at_end
|
|
37
|
+
|
|
38
|
+
if [[ $NO_PROCESERV_TEST == true ]]; then
|
|
39
|
+
# In this case blueapi server needs to be killed.
|
|
40
|
+
pgrep blueapi | xargs kill
|
|
41
|
+
echo "Blueapi process killed"
|
|
42
|
+
fi
|
|
17
43
|
|
|
18
|
-
|
|
19
|
-
echo "Blueapi process killed"
|
|
44
|
+
echo "All done, bye!"
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
+
NO_PROCESERV_TEST=false
|
|
4
|
+
|
|
5
|
+
case "$2" in
|
|
6
|
+
-t | --test)
|
|
7
|
+
echo "Will run serial in test mode without procserv."
|
|
8
|
+
NO_PROCESERV_TEST=true
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
3
12
|
# Get edm path from input
|
|
4
13
|
edm_path=$1
|
|
5
14
|
|
|
@@ -9,14 +18,30 @@ export EDMDATAFILES="/dls_sw/prod/R3.14.12.3/support/motor/6-7-1dls14/motorApp/o
|
|
|
9
18
|
# Get the directory of this script
|
|
10
19
|
current=$( realpath "$( dirname "$0" )" )
|
|
11
20
|
|
|
12
|
-
|
|
13
|
-
|
|
21
|
+
|
|
22
|
+
if [[ $NO_PROCESERV_TEST == true ]]; then
|
|
23
|
+
echo "Start the blueapi sever"
|
|
24
|
+
|
|
25
|
+
# Run script to start blueapi serve
|
|
26
|
+
. $current/start_blueapi.sh
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
echo "Set up logging configuration"
|
|
30
|
+
blueapi -c "${current}/blueapi_config.yaml" controller run setup_collection_logs '{"expt":"Serial Fixed"}'
|
|
14
31
|
|
|
15
32
|
# Open the edm screen for a fixed target serial collection
|
|
16
33
|
echo "Starting fixed target edm screen."
|
|
17
34
|
edm -x "${edm_path}/FT-gui/DiamondChipI24-py3v1.edl"
|
|
18
35
|
|
|
19
|
-
echo "Edm screen closed
|
|
36
|
+
echo "Edm screen closed"
|
|
37
|
+
|
|
38
|
+
echo "Clean up log configuration"
|
|
39
|
+
blueapi -c "${current}/blueapi_config.yaml" controller run clean_up_log_config_at_end
|
|
40
|
+
|
|
41
|
+
if [[ $NO_PROCESERV_TEST == true ]]; then
|
|
42
|
+
# In this case blueapi server needs to be killed.
|
|
43
|
+
pgrep blueapi | xargs kill
|
|
44
|
+
echo "Blueapi process killed"
|
|
45
|
+
fi
|
|
20
46
|
|
|
21
|
-
|
|
22
|
-
echo "Blueapi process killed"
|
|
47
|
+
echo "All done, bye!"
|
|
@@ -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
|