mx-bluesky 1.5.1__py3-none-any.whl → 1.5.3__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 +16 -3
- mx_bluesky/beamlines/i04/__init__.py +8 -1
- mx_bluesky/beamlines/i04/callbacks/murko_callback.py +56 -1
- mx_bluesky/beamlines/i04/experiment_plans/__init__.py +0 -0
- mx_bluesky/beamlines/i04/experiment_plans/i04_grid_detect_then_xray_centre_plan.py +262 -0
- mx_bluesky/beamlines/i24/serial/blueapi_config.yaml +2 -2
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +3 -1
- mx_bluesky/common/experiment_plans/change_aperture_then_move_plan.py +5 -1
- mx_bluesky/common/experiment_plans/common_flyscan_xray_centre_plan.py +26 -3
- mx_bluesky/common/experiment_plans/common_grid_detect_then_xray_centre_plan.py +1 -0
- mx_bluesky/common/experiment_plans/inner_plans/do_fgs.py +3 -1
- mx_bluesky/common/experiment_plans/oav_grid_detection_plan.py +12 -2
- mx_bluesky/common/external_interaction/alerting/__init__.py +13 -0
- mx_bluesky/common/external_interaction/alerting/_service.py +82 -0
- mx_bluesky/common/external_interaction/alerting/log_based_service.py +57 -0
- mx_bluesky/common/external_interaction/callbacks/sample_handling/sample_handling_callback.py +28 -4
- mx_bluesky/common/external_interaction/config_server.py +151 -54
- mx_bluesky/common/external_interaction/ispyb/ispyb_store.py +11 -6
- mx_bluesky/common/parameters/__init__.py +0 -0
- mx_bluesky/common/parameters/constants.py +27 -8
- mx_bluesky/common/parameters/device_composites.py +1 -1
- mx_bluesky/common/parameters/gridscan.py +2 -1
- mx_bluesky/hyperion/__main__.py +51 -179
- mx_bluesky/hyperion/baton_handler.py +142 -54
- mx_bluesky/hyperion/device_setup_plans/dcm_pitch_roll_mirror_adjuster.py +29 -24
- mx_bluesky/hyperion/device_setup_plans/setup_zebra.py +4 -93
- mx_bluesky/hyperion/experiment_plans/hyperion_flyscan_xray_centre_plan.py +23 -38
- mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +12 -4
- mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +1 -1
- mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +7 -8
- mx_bluesky/hyperion/external_interaction/agamemnon.py +128 -73
- mx_bluesky/hyperion/external_interaction/alerting/__init__.py +0 -0
- mx_bluesky/hyperion/external_interaction/alerting/constants.py +12 -0
- mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +5 -0
- mx_bluesky/hyperion/external_interaction/callbacks/rotation/nexus_callback.py +2 -2
- mx_bluesky/hyperion/external_interaction/config_server.py +12 -31
- mx_bluesky/hyperion/parameters/cli.py +15 -3
- mx_bluesky/hyperion/parameters/components.py +7 -5
- mx_bluesky/hyperion/parameters/constants.py +21 -6
- mx_bluesky/hyperion/parameters/gridscan.py +22 -14
- mx_bluesky/hyperion/parameters/load_centre_collect.py +1 -14
- mx_bluesky/hyperion/parameters/robot_load.py +1 -4
- mx_bluesky/hyperion/parameters/rotation.py +1 -2
- mx_bluesky/hyperion/plan_runner.py +78 -0
- mx_bluesky/hyperion/runner.py +189 -0
- mx_bluesky/hyperion/utils/context.py +19 -5
- mx_bluesky/phase1_zebra/__init__.py +1 -0
- mx_bluesky/phase1_zebra/device_setup_plans/__init__.py +0 -0
- mx_bluesky/phase1_zebra/device_setup_plans/setup_zebra.py +112 -0
- {mx_bluesky-1.5.1.dist-info → mx_bluesky-1.5.3.dist-info}/METADATA +5 -4
- {mx_bluesky-1.5.1.dist-info → mx_bluesky-1.5.3.dist-info}/RECORD +57 -44
- {mx_bluesky-1.5.1.dist-info → mx_bluesky-1.5.3.dist-info}/entry_points.txt +0 -2
- /mx_bluesky/common/experiment_plans/{read_hardware.py → inner_plans/read_hardware.py} +0 -0
- /mx_bluesky/common/experiment_plans/{write_sample_status.py → inner_plans/write_sample_status.py} +0 -0
- {mx_bluesky-1.5.1.dist-info → mx_bluesky-1.5.3.dist-info}/WHEEL +0 -0
- {mx_bluesky-1.5.1.dist-info → mx_bluesky-1.5.3.dist-info}/licenses/LICENSE +0 -0
- {mx_bluesky-1.5.1.dist-info → mx_bluesky-1.5.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from typing import cast
|
|
3
|
+
|
|
4
|
+
from dodal.log import LOGGER
|
|
5
|
+
from dodal.utils import get_beamline_name
|
|
6
|
+
|
|
7
|
+
from mx_bluesky.common.external_interaction.alerting import Metadata
|
|
8
|
+
from mx_bluesky.common.external_interaction.alerting._service import (
|
|
9
|
+
ExtraMetadata,
|
|
10
|
+
graylog_url,
|
|
11
|
+
ispyb_url,
|
|
12
|
+
)
|
|
13
|
+
from mx_bluesky.common.external_interaction.callbacks.common.ispyb_mapping import (
|
|
14
|
+
get_proposal_and_session_from_visit_string,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class LoggingAlertService:
|
|
19
|
+
"""
|
|
20
|
+
Implement an alert service that raises alerts by generating a specially formatted
|
|
21
|
+
log message, that may be intercepted by a logging service such as graylog and
|
|
22
|
+
used to dispatch the alert.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
def __init__(self, graylog_stream_id: str, level=logging.WARNING):
|
|
26
|
+
"""
|
|
27
|
+
Create a new instance of the service
|
|
28
|
+
Args:
|
|
29
|
+
level: The python logging level at which to generate the message
|
|
30
|
+
"""
|
|
31
|
+
super().__init__()
|
|
32
|
+
self._level = level
|
|
33
|
+
self._graylog_stream_id = graylog_stream_id
|
|
34
|
+
|
|
35
|
+
def _append_extra_metadata(self, metadata: dict[Metadata, str]) -> dict[str, str]:
|
|
36
|
+
with_extras = cast(dict, metadata.copy())
|
|
37
|
+
with_extras[ExtraMetadata.GRAYLOG_URL] = graylog_url(self._graylog_stream_id)
|
|
38
|
+
with_extras[ExtraMetadata.BEAMLINE] = get_beamline_name("")
|
|
39
|
+
if sample_id := metadata.get(Metadata.SAMPLE_ID, None):
|
|
40
|
+
with_extras[ExtraMetadata.ISPYB_URL] = ispyb_url(sample_id)
|
|
41
|
+
if visit := metadata.get(Metadata.VISIT, None):
|
|
42
|
+
proposal, _ = get_proposal_and_session_from_visit_string(visit)
|
|
43
|
+
with_extras[ExtraMetadata.PROPOSAL] = proposal
|
|
44
|
+
return with_extras
|
|
45
|
+
|
|
46
|
+
def raise_alert(self, summary: str, content: str, metadata: dict[Metadata, str]):
|
|
47
|
+
message = f"***ALERT*** summary={summary} content={content}"
|
|
48
|
+
with_extras = self._append_extra_metadata(metadata)
|
|
49
|
+
LOGGER.log(
|
|
50
|
+
self._level,
|
|
51
|
+
message,
|
|
52
|
+
extra={
|
|
53
|
+
ExtraMetadata.ALERT_SUMMARY: summary,
|
|
54
|
+
ExtraMetadata.ALERT_CONTENT: content,
|
|
55
|
+
}
|
|
56
|
+
| with_extras,
|
|
57
|
+
)
|
mx_bluesky/common/external_interaction/callbacks/sample_handling/sample_handling_callback.py
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
from dodal.utils import get_beamline_name
|
|
1
2
|
from event_model import RunStart, RunStop
|
|
2
3
|
|
|
4
|
+
from mx_bluesky.common.external_interaction.alerting import (
|
|
5
|
+
Metadata,
|
|
6
|
+
get_alerting_service,
|
|
7
|
+
)
|
|
3
8
|
from mx_bluesky.common.external_interaction.callbacks.common.plan_reactive_callback import (
|
|
4
9
|
PlanReactiveCallback,
|
|
5
10
|
)
|
|
@@ -18,30 +23,36 @@ class SampleHandlingCallback(PlanReactiveCallback):
|
|
|
18
23
|
def __init__(self, record_loaded_on_success=False):
|
|
19
24
|
super().__init__(log=ISPYB_ZOCALO_CALLBACK_LOGGER)
|
|
20
25
|
self._sample_id: int | None = None
|
|
26
|
+
self._visit: str | None = None
|
|
21
27
|
self._descriptor: str | None = None
|
|
22
28
|
self._run_id: str | None = None
|
|
29
|
+
self._container: int | None = None
|
|
23
30
|
|
|
24
31
|
# Record 'sample loaded' if document successfully stops
|
|
25
32
|
self.record_loaded_on_success = record_loaded_on_success
|
|
26
33
|
|
|
27
34
|
def activity_gated_start(self, doc: RunStart):
|
|
28
35
|
if not self._sample_id and self.active:
|
|
29
|
-
|
|
36
|
+
metadata = doc.get("metadata", {})
|
|
37
|
+
sample_id = metadata.get("sample_id")
|
|
30
38
|
self.log.info(f"Recording sample ID at run start {sample_id}")
|
|
31
39
|
self._sample_id = sample_id
|
|
40
|
+
self._visit = metadata.get("visit")
|
|
32
41
|
self._run_id = self.activity_uid
|
|
42
|
+
self._container = metadata.get("container")
|
|
33
43
|
|
|
34
44
|
def activity_gated_stop(self, doc: RunStop) -> RunStop:
|
|
35
45
|
if self._run_id == doc.get("run_start"):
|
|
36
46
|
expeye = ExpeyeInteraction()
|
|
37
47
|
if doc["exit_status"] != "success":
|
|
48
|
+
reason = doc.get("reason", "")
|
|
38
49
|
exception_type, message = SampleException.type_and_message_from_reason(
|
|
39
|
-
|
|
50
|
+
reason
|
|
40
51
|
)
|
|
41
52
|
self.log.info(
|
|
42
53
|
f"Sample handling callback intercepted exception of type {exception_type}: {message}"
|
|
43
54
|
)
|
|
44
|
-
self._record_exception(exception_type, expeye)
|
|
55
|
+
self._record_exception(exception_type, expeye, reason)
|
|
45
56
|
|
|
46
57
|
elif self.record_loaded_on_success:
|
|
47
58
|
self._record_loaded(expeye)
|
|
@@ -51,10 +62,23 @@ class SampleHandlingCallback(PlanReactiveCallback):
|
|
|
51
62
|
|
|
52
63
|
return doc
|
|
53
64
|
|
|
54
|
-
def _record_exception(
|
|
65
|
+
def _record_exception(
|
|
66
|
+
self, exception_type: str, expeye: ExpeyeInteraction, reason: str
|
|
67
|
+
):
|
|
55
68
|
assert self._sample_id, "Unable to record exception due to no sample ID"
|
|
56
69
|
sample_status = self._decode_sample_status(exception_type)
|
|
57
70
|
expeye.update_sample_status(self._sample_id, sample_status)
|
|
71
|
+
if sample_status == BLSampleStatus.ERROR_BEAMLINE:
|
|
72
|
+
beamline = get_beamline_name("")
|
|
73
|
+
get_alerting_service().raise_alert(
|
|
74
|
+
f"UDC encountered an error on {beamline}",
|
|
75
|
+
f"Hyperion encountered the following beamline error: {reason}",
|
|
76
|
+
{
|
|
77
|
+
Metadata.SAMPLE_ID: str(self._sample_id),
|
|
78
|
+
Metadata.VISIT: self._visit or "",
|
|
79
|
+
Metadata.CONTAINER: str(self._container),
|
|
80
|
+
},
|
|
81
|
+
)
|
|
58
82
|
|
|
59
83
|
def _decode_sample_status(self, exception_type: str) -> BLSampleStatus:
|
|
60
84
|
match exception_type:
|
|
@@ -1,57 +1,154 @@
|
|
|
1
|
-
|
|
2
|
-
from
|
|
1
|
+
import json
|
|
2
|
+
from dataclasses import fields
|
|
3
|
+
from enum import Enum
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Any, Generic, TypeVar
|
|
3
6
|
|
|
4
7
|
from daq_config_server.client import ConfigServer
|
|
5
|
-
from pydantic import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
8
|
+
from pydantic import TypeAdapter
|
|
9
|
+
|
|
10
|
+
from mx_bluesky.common.parameters.constants import (
|
|
11
|
+
GDA_DOMAIN_PROPERTIES_PATH,
|
|
12
|
+
FeatureSetting,
|
|
13
|
+
FeatureSettingources,
|
|
14
|
+
OavConstants,
|
|
15
|
+
)
|
|
16
|
+
from mx_bluesky.common.utils.log import LOGGER
|
|
17
|
+
|
|
18
|
+
FEATURE_FLAG_CACHE_LENGTH_S = 60 * 5
|
|
19
|
+
# Used by the config server when refreshing its cache
|
|
20
|
+
_JSON_CONFIG_PATHS = [OavConstants.OAV_CONFIG_JSON]
|
|
21
|
+
|
|
22
|
+
T = TypeVar("T", bound=FeatureSetting)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class MXConfigClient(ConfigServer, Generic[T]):
|
|
26
|
+
def __init__(
|
|
27
|
+
self,
|
|
28
|
+
feature_sources: type[FeatureSettingources],
|
|
29
|
+
feature_dc: type[T],
|
|
30
|
+
url: str = "https://daq-config.diamond.ac.uk",
|
|
31
|
+
):
|
|
32
|
+
"""MX implementation of the config server client. Makes requests to the config server to retrieve config while falling back to
|
|
33
|
+
the filesystem in the case that the request failed.
|
|
34
|
+
|
|
35
|
+
See mx_bluesky/hyperion/external_interaction/config_server.py for example implementation.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
feature_sources: A StrEnum containing available features, where the string is the name of that feature toggle in a beamline's GDA
|
|
39
|
+
domain.properties.
|
|
40
|
+
|
|
41
|
+
feature_dc: A dataclass containing available features along with their default flags. This dataclass must contain the same keys
|
|
42
|
+
as the feature_sources parameter. These defaults are used when a server request fails.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
self.feature_sources = feature_sources
|
|
46
|
+
self.feature_dc: type[T] = feature_dc
|
|
47
|
+
self._cached_features: T | None = None
|
|
48
|
+
self._cached_json_config: dict[str, dict[str, Any]] = {}
|
|
49
|
+
self._time_of_last_feature_get: float = 0
|
|
50
|
+
self._verify_feature_parameters()
|
|
51
|
+
super().__init__(url)
|
|
52
|
+
|
|
53
|
+
def get_feature_flags(self) -> T:
|
|
54
|
+
"""Get feature flags by making a request to the config server. If the request fails, use the hardcoded defaults. Store results in a cache
|
|
55
|
+
which should be updated at the start of a plan using self.refresh_cache()
|
|
56
|
+
"""
|
|
57
|
+
return self._get_feature_flags()
|
|
58
|
+
|
|
59
|
+
def get_json_config(self, path_to_json: Path | str) -> dict[str, Any]:
|
|
60
|
+
"""Get the OAV config in the form of a python dictionary. Store results in a cache
|
|
61
|
+
which should be updated at the start of a plan using self.refresh_cache().
|
|
62
|
+
|
|
63
|
+
Note that this method replicates the functionality of the config server, but provides
|
|
64
|
+
a fallback incase of server. It will be removed once the config server has been run reliably
|
|
65
|
+
for several months.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
path_to_json: Absolute file path to json file
|
|
69
|
+
"""
|
|
70
|
+
return self._get_json_config(path_to_json)
|
|
71
|
+
|
|
72
|
+
def refresh_cache(self):
|
|
73
|
+
"""Refresh the client's cache. Use at the beginning of a plan"""
|
|
74
|
+
self._get_feature_flags(reset_cached_result=True)
|
|
75
|
+
for path in _JSON_CONFIG_PATHS:
|
|
76
|
+
self._get_json_config(path, reset_cached_result=True)
|
|
77
|
+
|
|
78
|
+
def _verify_feature_parameters(self):
|
|
79
|
+
sources_keys = {feature.name for feature in self.feature_sources}
|
|
80
|
+
feature_dc_keys = {key.name for key in fields(self.feature_dc)}
|
|
81
|
+
assert sources_keys == feature_dc_keys, (
|
|
82
|
+
f"MXConfig server feature_sources names do not match feature_dc keys: {sources_keys} != {feature_dc_keys}"
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
def _get_feature_flags(self, reset_cached_result=False) -> T:
|
|
86
|
+
"""
|
|
87
|
+
Args:
|
|
88
|
+
reset_cached_result (bool): Force refresh the cache for this request
|
|
89
|
+
"""
|
|
90
|
+
try:
|
|
91
|
+
if reset_cached_result:
|
|
92
|
+
self._cached_features = None
|
|
93
|
+
if not self._cached_features:
|
|
94
|
+
self._cached_features = None
|
|
95
|
+
# Construct self.feature_dc by reading the domain.properties file
|
|
96
|
+
all_features = list(self.feature_sources)
|
|
97
|
+
feature_dict = {}
|
|
98
|
+
domain_properties = self.get_file_contents(
|
|
99
|
+
GDA_DOMAIN_PROPERTIES_PATH, reset_cached_result=reset_cached_result
|
|
100
|
+
).splitlines()
|
|
101
|
+
for line in domain_properties:
|
|
102
|
+
line = line.strip()
|
|
103
|
+
if not line or line.startswith("#"):
|
|
104
|
+
continue
|
|
105
|
+
line = line.split("#", 1)[0].strip() # Remove inline comments
|
|
106
|
+
if "=" in line:
|
|
107
|
+
key, value = map(str.strip, line.split("=", 1))
|
|
108
|
+
for feature in all_features:
|
|
109
|
+
assert isinstance(feature, Enum)
|
|
110
|
+
if key == feature.value:
|
|
111
|
+
feature_dict[feature.name] = value
|
|
112
|
+
self._check_missing_fields(
|
|
113
|
+
{f.name for f in fields(self.feature_dc)}, set(feature_dict.keys())
|
|
114
|
+
)
|
|
115
|
+
self._cached_features = self.feature_dc(**feature_dict)
|
|
116
|
+
return self._cached_features
|
|
117
|
+
except Exception as e:
|
|
118
|
+
LOGGER.warning(
|
|
119
|
+
f"Failed to get feature flags from config server: {e} \nUsing defaults..."
|
|
120
|
+
)
|
|
121
|
+
return self.feature_dc()
|
|
122
|
+
|
|
123
|
+
def _check_missing_fields(self, expected: set, actual: set):
|
|
124
|
+
missing = expected - actual
|
|
125
|
+
if missing:
|
|
126
|
+
LOGGER.warning(
|
|
127
|
+
f"Missing features from domain.properties: {missing}.\n Using defaults for missing features"
|
|
56
128
|
)
|
|
57
|
-
|
|
129
|
+
|
|
130
|
+
def _get_json_config(
|
|
131
|
+
self, path_to_json: Path | str, reset_cached_result=False
|
|
132
|
+
) -> dict[str, Any]:
|
|
133
|
+
"""
|
|
134
|
+
Args:
|
|
135
|
+
reset_cached_result (bool): Force refresh the cache for this request
|
|
136
|
+
"""
|
|
137
|
+
if reset_cached_result:
|
|
138
|
+
self._cached_json_config = {}
|
|
139
|
+
str_to_json = str(path_to_json)
|
|
140
|
+
if str_to_json not in self._cached_json_config:
|
|
141
|
+
try:
|
|
142
|
+
self._cached_json_config[str_to_json] = self.get_file_contents(
|
|
143
|
+
path_to_json, dict, reset_cached_result=reset_cached_result
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
except Exception as e:
|
|
147
|
+
LOGGER.warning(
|
|
148
|
+
f"Failed to get json config from config server: {e} \nReading the file directly..."
|
|
149
|
+
)
|
|
150
|
+
with open(path_to_json) as f:
|
|
151
|
+
self._cached_json_config[str_to_json] = TypeAdapter(
|
|
152
|
+
dict[str, Any]
|
|
153
|
+
).validate_python(json.loads(f.read()))
|
|
154
|
+
return self._cached_json_config[str_to_json]
|
|
@@ -145,11 +145,17 @@ class StoreInIspyb:
|
|
|
145
145
|
def append_to_comment(
|
|
146
146
|
self, data_collection_id: int, comment: str, delimiter: str = " "
|
|
147
147
|
) -> None:
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
try:
|
|
149
|
+
with ispyb.open(self.ISPYB_CONFIG_PATH) as conn:
|
|
150
|
+
assert conn is not None, "Failed to connect to ISPyB!"
|
|
151
|
+
mx_acquisition: MXAcquisition = conn.mx_acquisition
|
|
152
|
+
mx_acquisition.update_data_collection_append_comments(
|
|
153
|
+
data_collection_id, comment, delimiter
|
|
154
|
+
)
|
|
155
|
+
except ispyb.ReadWriteError as e:
|
|
156
|
+
ISPYB_ZOCALO_CALLBACK_LOGGER.warning(
|
|
157
|
+
f"Unable to log comment, comment probably exceeded column length: {comment}",
|
|
158
|
+
exc_info=e,
|
|
153
159
|
)
|
|
154
160
|
|
|
155
161
|
def update_data_collection_group_table(
|
|
@@ -186,7 +192,6 @@ class StoreInIspyb:
|
|
|
186
192
|
params["parentid"] = data_collection_group_id
|
|
187
193
|
params["endtime"] = end_time
|
|
188
194
|
params["run_status"] = run_status
|
|
189
|
-
|
|
190
195
|
mx_acquisition.upsert_data_collection(list(params.values()))
|
|
191
196
|
|
|
192
197
|
def _store_position_table(
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
-
from enum import Enum
|
|
2
|
+
from enum import Enum, StrEnum
|
|
3
3
|
|
|
4
4
|
from dodal.devices.aperturescatterguard import ApertureValue
|
|
5
5
|
from dodal.devices.detector import EIGER2_X_16M_SIZE
|
|
@@ -11,6 +11,13 @@ from mx_bluesky.definitions import ROOT_DIR
|
|
|
11
11
|
|
|
12
12
|
BEAMLINE = get_beamline_name("test")
|
|
13
13
|
TEST_MODE = BEAMLINE == "test"
|
|
14
|
+
ZEBRA_STATUS_TIMEOUT = 30
|
|
15
|
+
|
|
16
|
+
GDA_DOMAIN_PROPERTIES_PATH = (
|
|
17
|
+
"tests/test_data/test_domain_properties"
|
|
18
|
+
if TEST_MODE
|
|
19
|
+
else (f"/dls_sw/{BEAMLINE}/software/daq_configuration/domain/domain.properties")
|
|
20
|
+
)
|
|
14
21
|
|
|
15
22
|
|
|
16
23
|
@dataclass(frozen=True)
|
|
@@ -27,15 +34,18 @@ class DocDescriptorNames:
|
|
|
27
34
|
FLYSCAN_RESULTS = "flyscan_results_obtained"
|
|
28
35
|
|
|
29
36
|
|
|
37
|
+
def _get_oav_config_json_path():
|
|
38
|
+
if TEST_MODE:
|
|
39
|
+
return "tests/test_data/test_OAVCentring.json"
|
|
40
|
+
elif BEAMLINE == "i03":
|
|
41
|
+
return f"/dls_sw/{BEAMLINE}/software/daq_configuration/json/OAVCentring_hyperion.json"
|
|
42
|
+
else:
|
|
43
|
+
return f"/dls_sw/{BEAMLINE}/software/daq_configuration/json/OAVCentring.json"
|
|
44
|
+
|
|
45
|
+
|
|
30
46
|
@dataclass(frozen=True)
|
|
31
47
|
class OavConstants:
|
|
32
|
-
OAV_CONFIG_JSON = (
|
|
33
|
-
"tests/test_data/test_OAVCentring.json"
|
|
34
|
-
if TEST_MODE
|
|
35
|
-
else (
|
|
36
|
-
f"/dls_sw/{BEAMLINE}/software/daq_configuration/json/OAVCentring_hyperion.json"
|
|
37
|
-
)
|
|
38
|
-
)
|
|
48
|
+
OAV_CONFIG_JSON = _get_oav_config_json_path()
|
|
39
49
|
|
|
40
50
|
|
|
41
51
|
@dataclass(frozen=True)
|
|
@@ -149,3 +159,12 @@ class Status(Enum):
|
|
|
149
159
|
BUSY = "Busy"
|
|
150
160
|
ABORTING = "Aborting"
|
|
151
161
|
IDLE = "Idle"
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
@dataclass
|
|
165
|
+
class FeatureSetting: ... # List of features and their default values. Subclasses must also be a pydantic dataclass
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
class FeatureSettingources(
|
|
169
|
+
StrEnum
|
|
170
|
+
): ... # List of features and the name of that property in domain.properties
|
|
@@ -11,7 +11,7 @@ from dodal.devices.fast_grid_scan import (
|
|
|
11
11
|
ZebraFastGridScan,
|
|
12
12
|
)
|
|
13
13
|
from dodal.devices.flux import Flux
|
|
14
|
-
from dodal.devices.
|
|
14
|
+
from dodal.devices.mx_phase1.beamstop import Beamstop
|
|
15
15
|
from dodal.devices.oav.oav_detector import OAV
|
|
16
16
|
from dodal.devices.oav.pin_image_recognition import PinTipDetection
|
|
17
17
|
from dodal.devices.robot import BartRobot
|
|
@@ -30,6 +30,7 @@ DETECTOR_SIZE_PER_BEAMLINE = {
|
|
|
30
30
|
"i02-1": EIGER2_X_9M_SIZE,
|
|
31
31
|
"dev": EIGER2_X_16M_SIZE,
|
|
32
32
|
"i03": EIGER2_X_16M_SIZE,
|
|
33
|
+
"i04": EIGER2_X_16M_SIZE,
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
|
|
@@ -101,7 +102,7 @@ class SpecifiedThreeDGridScan(
|
|
|
101
102
|
"""Parameters representing a so-called 3D grid scan, which consists of doing a
|
|
102
103
|
gridscan in X and Y, followed by one in X and Z."""
|
|
103
104
|
|
|
104
|
-
grid1_omega_deg: float = Field(default=GridscanParamConstants.OMEGA_1)
|
|
105
|
+
grid1_omega_deg: float = Field(default=GridscanParamConstants.OMEGA_1)
|
|
105
106
|
grid2_omega_deg: float = Field(default=GridscanParamConstants.OMEGA_2)
|
|
106
107
|
x_step_size_um: float = Field(default=GridscanParamConstants.BOX_WIDTH_UM)
|
|
107
108
|
y_step_size_um: float = Field(default=GridscanParamConstants.BOX_WIDTH_UM)
|