dls-dodal 1.34.1__py3-none-any.whl → 1.36.0__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.
- {dls_dodal-1.34.1.dist-info → dls_dodal-1.36.0.dist-info}/METADATA +4 -2
- dls_dodal-1.36.0.dist-info/RECORD +152 -0
- {dls_dodal-1.34.1.dist-info → dls_dodal-1.36.0.dist-info}/WHEEL +1 -1
- dodal/_version.py +2 -2
- dodal/beamlines/i22.py +24 -11
- dodal/beamlines/i24.py +4 -4
- dodal/beamlines/p38.py +23 -11
- dodal/common/beamlines/beamline_utils.py +1 -2
- dodal/common/crystal_metadata.py +61 -0
- dodal/common/signal_utils.py +10 -14
- dodal/devices/CTAB.py +1 -1
- dodal/devices/aperture.py +1 -1
- dodal/devices/aperturescatterguard.py +20 -8
- dodal/devices/apple2_undulator.py +30 -29
- dodal/devices/areadetector/plugins/CAM.py +3 -5
- dodal/devices/areadetector/plugins/MJPG.py +1 -1
- dodal/devices/attenuator.py +1 -1
- dodal/devices/backlight.py +4 -5
- dodal/devices/cryostream.py +3 -5
- dodal/devices/dcm.py +26 -2
- dodal/devices/detector/detector_motion.py +3 -5
- dodal/devices/diamond_filter.py +3 -4
- dodal/devices/eiger.py +88 -49
- dodal/devices/fast_grid_scan.py +1 -1
- dodal/devices/fluorescence_detector_motion.py +5 -7
- dodal/devices/focusing_mirror.py +12 -11
- dodal/devices/hutch_shutter.py +4 -5
- dodal/devices/i10/i10_apple2.py +20 -19
- dodal/devices/i10/i10_setting_data.py +2 -2
- dodal/devices/i22/dcm.py +43 -75
- dodal/devices/i22/fswitch.py +5 -5
- dodal/devices/i24/aperture.py +3 -5
- dodal/devices/i24/beamstop.py +3 -5
- dodal/devices/i24/dcm.py +1 -1
- dodal/devices/i24/dual_backlight.py +4 -6
- dodal/devices/i24/pmac.py +35 -46
- dodal/devices/i24/vgonio.py +16 -0
- dodal/devices/ipin.py +5 -3
- dodal/devices/linkam3.py +7 -7
- dodal/devices/oav/oav_detector.py +3 -3
- dodal/devices/oav/oav_to_redis_forwarder.py +8 -7
- dodal/devices/oav/pin_image_recognition/__init__.py +9 -7
- dodal/devices/oav/snapshots/grid_overlay.py +16 -16
- dodal/devices/oav/snapshots/snapshot_with_beam_centre.py +5 -5
- dodal/devices/oav/snapshots/snapshot_with_grid.py +6 -6
- dodal/devices/oav/utils.py +2 -2
- dodal/devices/p99/sample_stage.py +3 -5
- dodal/devices/pgm.py +5 -6
- dodal/devices/qbpm.py +1 -1
- dodal/devices/robot.py +3 -3
- dodal/devices/smargon.py +1 -1
- dodal/devices/synchrotron.py +9 -4
- dodal/devices/tetramm.py +7 -7
- dodal/devices/thawer.py +13 -7
- dodal/devices/undulator.py +5 -5
- dodal/devices/util/epics_util.py +1 -1
- dodal/devices/watsonmarlow323_pump.py +45 -0
- dodal/devices/webcam.py +9 -2
- dodal/devices/xbpm_feedback.py +3 -5
- dodal/devices/xspress3/xspress3.py +8 -9
- dodal/devices/xspress3/xspress3_channel.py +3 -5
- dodal/devices/zebra.py +7 -6
- dodal/devices/zebra_controlled_shutter.py +5 -6
- dodal/devices/zocalo/__init__.py +2 -2
- dodal/devices/zocalo/zocalo_constants.py +3 -0
- dodal/devices/zocalo/zocalo_interaction.py +2 -1
- dodal/devices/zocalo/zocalo_results.py +92 -79
- dodal/plan_stubs/__init__.py +0 -0
- dodal/{plans/data_session_metadata.py → plan_stubs/data_session.py} +2 -2
- dodal/{plans/motor_util_plans.py → plan_stubs/motor_utils.py} +2 -2
- dodal/plan_stubs/wrapped.py +150 -0
- dodal/plans/__init__.py +4 -0
- dodal/plans/scanspec.py +66 -0
- dodal/plans/wrapped.py +57 -0
- dodal/utils.py +4 -0
- dls_dodal-1.34.1.dist-info/RECORD +0 -144
- dodal/devices/i24/i24_vgonio.py +0 -17
- {dls_dodal-1.34.1.dist-info → dls_dodal-1.36.0.dist-info}/LICENSE +0 -0
- {dls_dodal-1.34.1.dist-info → dls_dodal-1.36.0.dist-info}/entry_points.txt +0 -0
- {dls_dodal-1.34.1.dist-info → dls_dodal-1.36.0.dist-info}/top_level.txt +0 -0
- /dodal/{plans → plan_stubs}/check_topup.py +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from ophyd_async.core import StandardReadable, StandardReadableFormat, StrictEnum
|
|
2
|
+
from ophyd_async.epics.core import epics_signal_rw
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class WatsonMarlow323PumpEnable(StrictEnum):
|
|
6
|
+
DISABLED = "Disabled"
|
|
7
|
+
ENABLED = "Enabled"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class WatsonMarlow323PumpDirection(StrictEnum):
|
|
11
|
+
CLOCKWISE = "CW"
|
|
12
|
+
COUNTER_CLOCKWISE = "CCW"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class WatsonMarlow323PumpState(StrictEnum):
|
|
16
|
+
STOPPED = "STOP"
|
|
17
|
+
STARTED = "START"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class WatsonMarlow323Pump(StandardReadable):
|
|
21
|
+
"""Watson Marlow 323 Peristaltic Pump device"""
|
|
22
|
+
|
|
23
|
+
def __init__(self, prefix: str, name: str = "") -> None:
|
|
24
|
+
with self.add_children_as_readables():
|
|
25
|
+
self.direction = epics_signal_rw(
|
|
26
|
+
WatsonMarlow323PumpDirection,
|
|
27
|
+
read_pv=prefix + "INFO:DIR",
|
|
28
|
+
write_pv=prefix + "SET:DIR",
|
|
29
|
+
)
|
|
30
|
+
self.state = epics_signal_rw(
|
|
31
|
+
WatsonMarlow323PumpState,
|
|
32
|
+
read_pv=prefix + "INFO:RUN",
|
|
33
|
+
write_pv=prefix + "SET:RUN",
|
|
34
|
+
)
|
|
35
|
+
self.speed = epics_signal_rw(
|
|
36
|
+
float, read_pv=prefix + "INFO:SPD", write_pv=prefix + "SET:SPD"
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
with self.add_children_as_readables(StandardReadableFormat.CONFIG_SIGNAL):
|
|
40
|
+
self.enabled = epics_signal_rw(
|
|
41
|
+
WatsonMarlow323PumpEnable,
|
|
42
|
+
prefix + "DISABLE",
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
super().__init__(name=name)
|
dodal/devices/webcam.py
CHANGED
|
@@ -5,7 +5,12 @@ from pathlib import Path
|
|
|
5
5
|
import aiofiles
|
|
6
6
|
from aiohttp import ClientSession
|
|
7
7
|
from bluesky.protocols import Triggerable
|
|
8
|
-
from ophyd_async.core import
|
|
8
|
+
from ophyd_async.core import (
|
|
9
|
+
AsyncStatus,
|
|
10
|
+
StandardReadable,
|
|
11
|
+
StandardReadableFormat,
|
|
12
|
+
soft_signal_rw,
|
|
13
|
+
)
|
|
9
14
|
from PIL import Image
|
|
10
15
|
|
|
11
16
|
from dodal.log import LOGGER
|
|
@@ -27,7 +32,9 @@ class Webcam(StandardReadable, Triggerable):
|
|
|
27
32
|
self.directory = soft_signal_rw(str, name="directory")
|
|
28
33
|
self.last_saved_path = soft_signal_rw(str, name="last_saved_path")
|
|
29
34
|
|
|
30
|
-
self.add_readables(
|
|
35
|
+
self.add_readables(
|
|
36
|
+
[self.last_saved_path], format=StandardReadableFormat.HINTED_SIGNAL
|
|
37
|
+
)
|
|
31
38
|
super().__init__(name=name)
|
|
32
39
|
|
|
33
40
|
async def _write_image(self, file_path: str, image: ByteString):
|
dodal/devices/xbpm_feedback.py
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
from enum import Enum
|
|
2
|
-
|
|
3
1
|
from bluesky.protocols import Triggerable
|
|
4
|
-
from ophyd_async.core import AsyncStatus, Device, observe_value
|
|
5
|
-
from ophyd_async.epics.
|
|
2
|
+
from ophyd_async.core import AsyncStatus, Device, StrictEnum, observe_value
|
|
3
|
+
from ophyd_async.epics.core import epics_signal_r, epics_signal_rw
|
|
6
4
|
|
|
7
5
|
|
|
8
|
-
class Pause(
|
|
6
|
+
class Pause(StrictEnum):
|
|
9
7
|
PAUSE = "Paused" # 0
|
|
10
8
|
RUN = "Ok to Run" # 1
|
|
11
9
|
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
from enum import Enum
|
|
2
|
-
|
|
3
1
|
from bluesky.protocols import Stageable
|
|
4
2
|
from numpy import float64
|
|
5
|
-
from numpy.typing import NDArray
|
|
6
3
|
from ophyd_async.core import (
|
|
4
|
+
Array1D,
|
|
7
5
|
AsyncStatus,
|
|
8
6
|
Device,
|
|
9
7
|
DeviceVector,
|
|
8
|
+
StrictEnum,
|
|
10
9
|
wait_for_value,
|
|
11
10
|
)
|
|
12
|
-
from ophyd_async.epics.
|
|
11
|
+
from ophyd_async.epics.core import (
|
|
13
12
|
epics_signal_r,
|
|
14
13
|
epics_signal_rw,
|
|
15
14
|
epics_signal_rw_rbv,
|
|
@@ -23,7 +22,7 @@ from dodal.devices.xspress3.xspress3_channel import (
|
|
|
23
22
|
from dodal.log import LOGGER
|
|
24
23
|
|
|
25
24
|
|
|
26
|
-
class TriggerMode(
|
|
25
|
+
class TriggerMode(StrictEnum):
|
|
27
26
|
SOFTWARE = "Software"
|
|
28
27
|
HARDWARE = "Hardware"
|
|
29
28
|
BURST = "Burst"
|
|
@@ -35,17 +34,17 @@ class TriggerMode(str, Enum):
|
|
|
35
34
|
LVDS_both = "LVDS Both"
|
|
36
35
|
|
|
37
36
|
|
|
38
|
-
class UpdateRBV(
|
|
37
|
+
class UpdateRBV(StrictEnum):
|
|
39
38
|
DISABLED = "Disabled"
|
|
40
39
|
ENABLED = "Enabled"
|
|
41
40
|
|
|
42
41
|
|
|
43
|
-
class AcquireRBVState(
|
|
42
|
+
class AcquireRBVState(StrictEnum):
|
|
44
43
|
DONE = "Done"
|
|
45
44
|
ACQUIRE = "Acquiring"
|
|
46
45
|
|
|
47
46
|
|
|
48
|
-
class DetectorState(
|
|
47
|
+
class DetectorState(StrictEnum):
|
|
49
48
|
IDLE = "Idle"
|
|
50
49
|
ACQUIRE = "Acquire"
|
|
51
50
|
READOUT = "Readout"
|
|
@@ -101,7 +100,7 @@ class Xspress3(Device, Stageable):
|
|
|
101
100
|
"""signal for the corrected MCA spectrum (1d array)"""
|
|
102
101
|
self.dt_corrected_latest_mca = DeviceVector(
|
|
103
102
|
{
|
|
104
|
-
i: epics_signal_r(
|
|
103
|
+
i: epics_signal_r(Array1D[float64], f"{prefix}ARR{i}:ArrayData")
|
|
105
104
|
for i in range(1, num_channels + 1)
|
|
106
105
|
}
|
|
107
106
|
)
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
from
|
|
1
|
+
from ophyd_async.core import Device, StrictEnum
|
|
2
|
+
from ophyd_async.epics.core import epics_signal_r, epics_signal_rw
|
|
2
3
|
|
|
3
|
-
from ophyd_async.core import Device
|
|
4
|
-
from ophyd_async.epics.signal import epics_signal_r, epics_signal_rw
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
class AcquireState(str, Enum):
|
|
5
|
+
class AcquireState(StrictEnum):
|
|
8
6
|
DONE = "Done"
|
|
9
7
|
ACQUIRE = "Acquire"
|
|
10
8
|
|
dodal/devices/zebra.py
CHANGED
|
@@ -9,9 +9,10 @@ from ophyd_async.core import (
|
|
|
9
9
|
DeviceVector,
|
|
10
10
|
SignalRW,
|
|
11
11
|
StandardReadable,
|
|
12
|
+
StrictEnum,
|
|
12
13
|
observe_value,
|
|
13
14
|
)
|
|
14
|
-
from ophyd_async.epics.
|
|
15
|
+
from ophyd_async.epics.core import epics_signal_r, epics_signal_rw
|
|
15
16
|
|
|
16
17
|
# These constants refer to I03's Zebra. See https://github.com/DiamondLightSource/dodal/issues/772
|
|
17
18
|
# Sources
|
|
@@ -46,18 +47,18 @@ AUTO_SHUTTER_INPUT_1 = 1
|
|
|
46
47
|
AUTO_SHUTTER_INPUT_2 = 2
|
|
47
48
|
|
|
48
49
|
|
|
49
|
-
class ArmSource(
|
|
50
|
+
class ArmSource(StrictEnum):
|
|
50
51
|
SOFT = "Soft"
|
|
51
52
|
EXTERNAL = "External"
|
|
52
53
|
|
|
53
54
|
|
|
54
|
-
class TrigSource(
|
|
55
|
+
class TrigSource(StrictEnum):
|
|
55
56
|
POSITION = "Position"
|
|
56
57
|
TIME = "Time"
|
|
57
58
|
EXTERNAL = "External"
|
|
58
59
|
|
|
59
60
|
|
|
60
|
-
class EncEnum(
|
|
61
|
+
class EncEnum(StrictEnum):
|
|
61
62
|
Enc1 = "Enc1"
|
|
62
63
|
Enc2 = "Enc2"
|
|
63
64
|
Enc3 = "Enc3"
|
|
@@ -79,7 +80,7 @@ class I24Axes:
|
|
|
79
80
|
VGON_YH = EncEnum.Enc4
|
|
80
81
|
|
|
81
82
|
|
|
82
|
-
class RotationDirection(
|
|
83
|
+
class RotationDirection(StrictEnum):
|
|
83
84
|
POSITIVE = "Positive"
|
|
84
85
|
NEGATIVE = "Negative"
|
|
85
86
|
|
|
@@ -93,7 +94,7 @@ class ArmDemand(Enum):
|
|
|
93
94
|
DISARM = 0
|
|
94
95
|
|
|
95
96
|
|
|
96
|
-
class SoftInState(
|
|
97
|
+
class SoftInState(StrictEnum):
|
|
97
98
|
YES = "Yes"
|
|
98
99
|
NO = "No"
|
|
99
100
|
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
from enum import Enum
|
|
2
|
-
|
|
3
1
|
from bluesky.protocols import Movable
|
|
4
2
|
from ophyd_async.core import (
|
|
5
3
|
DEFAULT_TIMEOUT,
|
|
6
4
|
AsyncStatus,
|
|
7
5
|
StandardReadable,
|
|
6
|
+
StrictEnum,
|
|
8
7
|
wait_for_value,
|
|
9
8
|
)
|
|
10
|
-
from ophyd_async.epics.
|
|
9
|
+
from ophyd_async.epics.core import epics_signal_r, epics_signal_rw, epics_signal_w
|
|
11
10
|
|
|
12
11
|
|
|
13
|
-
class ZebraShutterState(
|
|
12
|
+
class ZebraShutterState(StrictEnum):
|
|
14
13
|
CLOSE = "Close"
|
|
15
14
|
OPEN = "Open"
|
|
16
15
|
|
|
17
16
|
|
|
18
|
-
class ZebraShutterControl(
|
|
17
|
+
class ZebraShutterControl(StrictEnum):
|
|
19
18
|
MANUAL = "Manual"
|
|
20
19
|
AUTO = "Auto"
|
|
21
20
|
|
|
@@ -26,7 +25,7 @@ class ZebraShutter(StandardReadable, Movable):
|
|
|
26
25
|
Internally in the zebra there are two AND gates, one for manual control and one for
|
|
27
26
|
automatic control. A soft input (aliased to control_mode) will switch between
|
|
28
27
|
which of these AND gates to use. For the manual gate the shutter is then controlled
|
|
29
|
-
by a different soft input (aliased to
|
|
28
|
+
by a different soft input (aliased to manual_position_setpoint). Both these AND
|
|
30
29
|
gates then feed into an OR gate, which then feeds to the shutter."""
|
|
31
30
|
|
|
32
31
|
def __init__(self, prefix: str, name: str):
|
dodal/devices/zocalo/__init__.py
CHANGED
|
@@ -4,14 +4,14 @@ from dodal.devices.zocalo.zocalo_results import (
|
|
|
4
4
|
NoZocaloSubscription,
|
|
5
5
|
XrcResult,
|
|
6
6
|
ZocaloResults,
|
|
7
|
-
|
|
7
|
+
get_full_processing_results,
|
|
8
8
|
)
|
|
9
9
|
|
|
10
10
|
__all__ = [
|
|
11
11
|
"ZocaloResults",
|
|
12
12
|
"XrcResult",
|
|
13
13
|
"ZocaloTrigger",
|
|
14
|
-
"
|
|
14
|
+
"get_full_processing_results",
|
|
15
15
|
"ZOCALO_READING_PLAN_NAME",
|
|
16
16
|
"NoResultsFromZocalo",
|
|
17
17
|
"NoZocaloSubscription",
|
|
@@ -7,6 +7,7 @@ from dataclasses import dataclass
|
|
|
7
7
|
import zocalo.configuration
|
|
8
8
|
from workflows.transport import lookup
|
|
9
9
|
|
|
10
|
+
from dodal.devices.zocalo.zocalo_constants import ZOCALO_ENV
|
|
10
11
|
from dodal.log import LOGGER
|
|
11
12
|
|
|
12
13
|
|
|
@@ -56,7 +57,7 @@ class ZocaloTrigger:
|
|
|
56
57
|
|
|
57
58
|
see https://github.com/DiamondLightSource/dodal/wiki/How-to-Interact-with-Zocalo"""
|
|
58
59
|
|
|
59
|
-
def __init__(self, environment: str =
|
|
60
|
+
def __init__(self, environment: str = ZOCALO_ENV):
|
|
60
61
|
self.zocalo_environment: str = environment
|
|
61
62
|
|
|
62
63
|
def _send_to_zocalo(self, parameters: dict):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
-
from collections import OrderedDict
|
|
3
2
|
from collections.abc import Generator, Sequence
|
|
4
3
|
from enum import Enum
|
|
4
|
+
from inspect import get_annotations
|
|
5
5
|
from queue import Empty, Queue
|
|
6
6
|
from typing import Any, TypedDict
|
|
7
7
|
|
|
@@ -9,17 +9,19 @@ import bluesky.plan_stubs as bps
|
|
|
9
9
|
import numpy as np
|
|
10
10
|
import workflows.recipe
|
|
11
11
|
import workflows.transport
|
|
12
|
-
from bluesky.protocols import
|
|
12
|
+
from bluesky.protocols import Triggerable
|
|
13
|
+
from bluesky.utils import Msg
|
|
13
14
|
from deepdiff import DeepDiff
|
|
14
15
|
from numpy.typing import NDArray
|
|
15
16
|
from ophyd_async.core import (
|
|
16
17
|
AsyncStatus,
|
|
17
|
-
HintedSignal,
|
|
18
18
|
StandardReadable,
|
|
19
|
+
StandardReadableFormat,
|
|
19
20
|
soft_signal_r_and_setter,
|
|
20
21
|
)
|
|
21
22
|
from workflows.transport.common_transport import CommonTransport
|
|
22
23
|
|
|
24
|
+
from dodal.devices.zocalo.zocalo_constants import ZOCALO_ENV
|
|
23
25
|
from dodal.devices.zocalo.zocalo_interaction import _get_zocalo_connection
|
|
24
26
|
from dodal.log import LOGGER
|
|
25
27
|
|
|
@@ -51,7 +53,7 @@ ZOCALO_STAGE_GROUP = "clear zocalo queue"
|
|
|
51
53
|
|
|
52
54
|
|
|
53
55
|
class XrcResult(TypedDict):
|
|
54
|
-
centre_of_mass: list[
|
|
56
|
+
centre_of_mass: list[float]
|
|
55
57
|
max_voxel: list[int]
|
|
56
58
|
max_count: int
|
|
57
59
|
n_voxels: int
|
|
@@ -114,7 +116,7 @@ class ZocaloResults(StandardReadable, Triggerable):
|
|
|
114
116
|
def __init__(
|
|
115
117
|
self,
|
|
116
118
|
name: str = "zocalo",
|
|
117
|
-
zocalo_environment: str =
|
|
119
|
+
zocalo_environment: str = ZOCALO_ENV,
|
|
118
120
|
channel: str = "xrc.i03",
|
|
119
121
|
sort_key: str = DEFAULT_SORT_KEY.value,
|
|
120
122
|
timeout_s: float = DEFAULT_TIMEOUT,
|
|
@@ -130,14 +132,23 @@ class ZocaloResults(StandardReadable, Triggerable):
|
|
|
130
132
|
self.transport: CommonTransport | None = None
|
|
131
133
|
self.use_cpu_and_gpu = use_cpu_and_gpu
|
|
132
134
|
|
|
133
|
-
self.
|
|
134
|
-
|
|
135
|
+
self.centre_of_mass, self._com_setter = soft_signal_r_and_setter(
|
|
136
|
+
NDArray[np.uint64], name="centre_of_mass"
|
|
135
137
|
)
|
|
136
|
-
self.
|
|
137
|
-
NDArray[np.uint64], name="
|
|
138
|
+
self.bounding_box, self._bounding_box_setter = soft_signal_r_and_setter(
|
|
139
|
+
NDArray[np.uint64], name="bounding_box"
|
|
138
140
|
)
|
|
139
|
-
self.
|
|
140
|
-
NDArray[np.uint64], "
|
|
141
|
+
self.max_voxel, self._max_voxel_setter = soft_signal_r_and_setter(
|
|
142
|
+
NDArray[np.uint64], name="max_voxel"
|
|
143
|
+
)
|
|
144
|
+
self.max_count, self._max_count_setter = soft_signal_r_and_setter(
|
|
145
|
+
NDArray[np.uint64], name="max_count"
|
|
146
|
+
)
|
|
147
|
+
self.n_voxels, self._n_voxels_setter = soft_signal_r_and_setter(
|
|
148
|
+
NDArray[np.uint64], name="n_voxels"
|
|
149
|
+
)
|
|
150
|
+
self.total_count, self._total_count_setter = soft_signal_r_and_setter(
|
|
151
|
+
NDArray[np.uint64], name="total_count"
|
|
141
152
|
)
|
|
142
153
|
self.ispyb_dcid, self._ispyb_dcid_setter = soft_signal_r_and_setter(
|
|
143
154
|
int, name="ispyb_dcid"
|
|
@@ -147,22 +158,27 @@ class ZocaloResults(StandardReadable, Triggerable):
|
|
|
147
158
|
)
|
|
148
159
|
self.add_readables(
|
|
149
160
|
[
|
|
150
|
-
self.
|
|
151
|
-
self.
|
|
152
|
-
self.
|
|
161
|
+
self.max_voxel,
|
|
162
|
+
self.max_count,
|
|
163
|
+
self.n_voxels,
|
|
164
|
+
self.total_count,
|
|
165
|
+
self.centre_of_mass,
|
|
166
|
+
self.bounding_box,
|
|
153
167
|
self.ispyb_dcid,
|
|
154
168
|
self.ispyb_dcgid,
|
|
155
169
|
],
|
|
156
|
-
|
|
170
|
+
format=StandardReadableFormat.HINTED_SIGNAL,
|
|
157
171
|
)
|
|
158
172
|
super().__init__(name)
|
|
159
173
|
|
|
160
174
|
async def _put_results(self, results: Sequence[XrcResult], recipe_parameters):
|
|
161
|
-
self._results_setter(list(results))
|
|
162
175
|
centres_of_mass = np.array([r["centre_of_mass"] for r in results])
|
|
163
|
-
bbox_sizes = np.array([bbox_size(r) for r in results])
|
|
164
176
|
self._com_setter(centres_of_mass)
|
|
165
|
-
self.
|
|
177
|
+
self._bounding_box_setter(np.array([r["bounding_box"] for r in results]))
|
|
178
|
+
self._max_voxel_setter(np.array([r["max_voxel"] for r in results]))
|
|
179
|
+
self._max_count_setter(np.array([r["max_count"] for r in results]))
|
|
180
|
+
self._n_voxels_setter(np.array([r["n_voxels"] for r in results]))
|
|
181
|
+
self._total_count_setter(np.array([r["total_count"] for r in results]))
|
|
166
182
|
self._ispyb_dcid_setter(recipe_parameters["dcid"])
|
|
167
183
|
self._ispyb_dcgid_setter(recipe_parameters["dcgid"])
|
|
168
184
|
|
|
@@ -286,48 +302,6 @@ class ZocaloResults(StandardReadable, Triggerable):
|
|
|
286
302
|
finally:
|
|
287
303
|
self._kickoff_run = False
|
|
288
304
|
|
|
289
|
-
async def describe(self) -> dict[str, Descriptor]:
|
|
290
|
-
zocalo_array_type: Descriptor = {
|
|
291
|
-
"source": f"zocalo_service:{self.zocalo_environment}",
|
|
292
|
-
"dtype": "array",
|
|
293
|
-
"shape": [-1, 3],
|
|
294
|
-
}
|
|
295
|
-
zocalo_int_type: Descriptor = {
|
|
296
|
-
"source": f"zocalo_service:{self.zocalo_environment}",
|
|
297
|
-
"dtype": "integer",
|
|
298
|
-
"shape": [0],
|
|
299
|
-
}
|
|
300
|
-
return OrderedDict(
|
|
301
|
-
[
|
|
302
|
-
(
|
|
303
|
-
self._name + "-results",
|
|
304
|
-
{
|
|
305
|
-
"source": f"zocalo_service:{self.zocalo_environment}",
|
|
306
|
-
"dtype": "array",
|
|
307
|
-
"shape": [
|
|
308
|
-
-1,
|
|
309
|
-
], # TODO describe properly - see https://github.com/DiamondLightSource/dodal/issues/253
|
|
310
|
-
},
|
|
311
|
-
),
|
|
312
|
-
(
|
|
313
|
-
self._name + "-centres_of_mass",
|
|
314
|
-
zocalo_array_type,
|
|
315
|
-
),
|
|
316
|
-
(
|
|
317
|
-
self._name + "-bbox_sizes",
|
|
318
|
-
zocalo_array_type,
|
|
319
|
-
),
|
|
320
|
-
(
|
|
321
|
-
self._name + "-ispyb_dcid",
|
|
322
|
-
zocalo_int_type,
|
|
323
|
-
),
|
|
324
|
-
(
|
|
325
|
-
self._name + "-ispyb_dcgid",
|
|
326
|
-
zocalo_int_type,
|
|
327
|
-
),
|
|
328
|
-
],
|
|
329
|
-
)
|
|
330
|
-
|
|
331
305
|
def _subscribe_to_results(self):
|
|
332
306
|
self.transport = _get_zocalo_connection(self.zocalo_environment)
|
|
333
307
|
|
|
@@ -364,23 +338,62 @@ class ZocaloResults(StandardReadable, Triggerable):
|
|
|
364
338
|
)
|
|
365
339
|
|
|
366
340
|
|
|
367
|
-
def
|
|
341
|
+
def _corrected_xrc_result(uncorrected: XrcResult) -> XrcResult:
|
|
342
|
+
corrected = XrcResult(**uncorrected)
|
|
343
|
+
corrected["centre_of_mass"] = [
|
|
344
|
+
coord - 0.5 for coord in uncorrected["centre_of_mass"]
|
|
345
|
+
]
|
|
346
|
+
return corrected
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
def get_full_processing_results(
|
|
368
350
|
zocalo: ZocaloResults,
|
|
369
|
-
) -> Generator[
|
|
370
|
-
"""A
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
351
|
+
) -> Generator[Msg, Any, Sequence[XrcResult]]:
|
|
352
|
+
"""A plan that will return the raw zocalo results, ranked in descending order according to the sort key.
|
|
353
|
+
Returns empty list in the event no results found."""
|
|
354
|
+
LOGGER.info("Retrieving raw zocalo processing results")
|
|
355
|
+
com = yield from bps.rd(zocalo.centre_of_mass, default_value=[]) # type: ignore
|
|
356
|
+
max_voxel = yield from bps.rd(zocalo.max_voxel, default_value=[]) # type: ignore
|
|
357
|
+
max_count = yield from bps.rd(zocalo.max_count, default_value=[]) # type: ignore
|
|
358
|
+
n_voxels = yield from bps.rd(zocalo.n_voxels, default_value=[]) # type: ignore
|
|
359
|
+
total_count = yield from bps.rd(zocalo.total_count, default_value=[]) # type: ignore
|
|
360
|
+
bounding_box = yield from bps.rd(zocalo.bounding_box, default_value=[]) # type: ignore
|
|
361
|
+
return [
|
|
362
|
+
_corrected_xrc_result(
|
|
363
|
+
XrcResult(
|
|
364
|
+
centre_of_mass=com.tolist(),
|
|
365
|
+
max_voxel=mv.tolist(),
|
|
366
|
+
max_count=int(mc),
|
|
367
|
+
n_voxels=int(n),
|
|
368
|
+
total_count=int(tc),
|
|
369
|
+
bounding_box=bb.tolist(),
|
|
370
|
+
)
|
|
371
|
+
)
|
|
372
|
+
for com, mv, mc, n, tc, bb in zip(
|
|
373
|
+
com, max_voxel, max_count, n_voxels, total_count, bounding_box, strict=True
|
|
374
|
+
)
|
|
375
|
+
]
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
def get_processing_results_from_event(
|
|
379
|
+
device_name: str, doc: dict
|
|
380
|
+
) -> Sequence[XrcResult]:
|
|
381
|
+
"""
|
|
382
|
+
Decode an event document into the corresponding x-ray centring results
|
|
383
|
+
|
|
384
|
+
Args:
|
|
385
|
+
doc A bluesky event document containing the signals read from the ZocaloResults
|
|
386
|
+
device_name The device name prefix to prepend to the document keys
|
|
387
|
+
|
|
388
|
+
Returns:
|
|
389
|
+
The list of XrcResults decoded from the event document
|
|
390
|
+
"""
|
|
391
|
+
results_keys = get_annotations(XrcResult).keys()
|
|
392
|
+
results_dict = {k: doc["data"][f"{device_name}-{k}"] for k in results_keys}
|
|
393
|
+
results_values = [results_dict[k].tolist() for k in results_keys]
|
|
394
|
+
|
|
395
|
+
def create_result(*argv):
|
|
396
|
+
kwargs = dict(zip(results_keys, argv, strict=False))
|
|
397
|
+
return XrcResult(**kwargs)
|
|
398
|
+
|
|
399
|
+
return list(map(create_result, *results_values))
|
|
File without changes
|
|
@@ -2,7 +2,7 @@ from bluesky import plan_stubs as bps
|
|
|
2
2
|
from bluesky import preprocessors as bpp
|
|
3
3
|
from bluesky.utils import MsgGenerator, make_decorator
|
|
4
4
|
|
|
5
|
-
from dodal.common.beamlines import
|
|
5
|
+
from dodal.common.beamlines.beamline_utils import get_path_provider
|
|
6
6
|
from dodal.common.types import UpdatingPathProvider
|
|
7
7
|
|
|
8
8
|
DATA_SESSION = "data_session"
|
|
@@ -31,7 +31,7 @@ def attach_data_session_metadata_wrapper(
|
|
|
31
31
|
Iterator[Msg]: Plan messages
|
|
32
32
|
"""
|
|
33
33
|
if provider is None:
|
|
34
|
-
provider =
|
|
34
|
+
provider = get_path_provider()
|
|
35
35
|
yield from bps.wait_for([provider.update])
|
|
36
36
|
ress = yield from bps.wait_for([provider.data_session])
|
|
37
37
|
data_session = ress[0].result()
|
|
@@ -23,7 +23,7 @@ class MoveTooLarge(Exception):
|
|
|
23
23
|
super().__init__(*args)
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
def
|
|
26
|
+
def check_and_cache_values(
|
|
27
27
|
devices_and_positions: dict[MovableReadableDevice, float],
|
|
28
28
|
smallest_move: float,
|
|
29
29
|
maximum_move: float,
|
|
@@ -89,7 +89,7 @@ def move_and_reset_wrapper(
|
|
|
89
89
|
on. If false it is left up to the caller to wait on
|
|
90
90
|
them. Defaults to True.
|
|
91
91
|
"""
|
|
92
|
-
initial_positions = yield from
|
|
92
|
+
initial_positions = yield from check_and_cache_values(
|
|
93
93
|
device_and_positions, smallest_move, maximum_move
|
|
94
94
|
)
|
|
95
95
|
|