dls-dodal 1.32.0__py3-none-any.whl → 1.34.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.
- {dls_dodal-1.32.0.dist-info → dls_dodal-1.34.1.dist-info}/METADATA +3 -3
- {dls_dodal-1.32.0.dist-info → dls_dodal-1.34.1.dist-info}/RECORD +53 -43
- {dls_dodal-1.32.0.dist-info → dls_dodal-1.34.1.dist-info}/WHEEL +1 -1
- dodal/__init__.py +8 -0
- dodal/_version.py +2 -2
- dodal/beamline_specific_utils/i03.py +6 -2
- dodal/beamlines/__init__.py +2 -3
- dodal/beamlines/b01_1.py +77 -0
- dodal/beamlines/i03.py +41 -9
- dodal/beamlines/i04.py +26 -4
- dodal/beamlines/i10.py +257 -0
- dodal/beamlines/i22.py +1 -2
- dodal/beamlines/i24.py +7 -7
- dodal/beamlines/p38.py +1 -2
- dodal/common/signal_utils.py +53 -0
- dodal/common/types.py +2 -7
- dodal/devices/aperturescatterguard.py +12 -15
- dodal/devices/apple2_undulator.py +602 -0
- dodal/devices/areadetector/plugins/CAM.py +31 -0
- dodal/devices/areadetector/plugins/MJPG.py +51 -106
- dodal/devices/backlight.py +7 -6
- dodal/devices/diamond_filter.py +47 -0
- dodal/devices/eiger.py +6 -2
- dodal/devices/eiger_odin.py +48 -39
- dodal/devices/focusing_mirror.py +14 -8
- dodal/devices/i10/i10_apple2.py +398 -0
- dodal/devices/i10/i10_setting_data.py +7 -0
- dodal/devices/i22/dcm.py +7 -8
- dodal/devices/i24/dual_backlight.py +5 -5
- dodal/devices/oav/oav_calculations.py +22 -0
- dodal/devices/oav/oav_detector.py +118 -97
- dodal/devices/oav/oav_parameters.py +50 -104
- dodal/devices/oav/oav_to_redis_forwarder.py +75 -34
- dodal/devices/oav/{grid_overlay.py → snapshots/grid_overlay.py} +0 -43
- dodal/devices/oav/snapshots/snapshot_with_beam_centre.py +64 -0
- dodal/devices/oav/snapshots/snapshot_with_grid.py +57 -0
- dodal/devices/oav/utils.py +26 -25
- dodal/devices/pgm.py +41 -0
- dodal/devices/qbpm.py +18 -0
- dodal/devices/robot.py +2 -2
- dodal/devices/smargon.py +2 -2
- dodal/devices/tetramm.py +2 -2
- dodal/devices/undulator.py +2 -1
- dodal/devices/util/adjuster_plans.py +1 -1
- dodal/devices/util/lookup_tables.py +4 -5
- dodal/devices/zebra.py +5 -2
- dodal/devices/zocalo/zocalo_results.py +13 -10
- dodal/plans/data_session_metadata.py +2 -2
- dodal/plans/motor_util_plans.py +11 -9
- dodal/utils.py +7 -0
- dodal/beamlines/i04_1.py +0 -140
- dodal/devices/oav/oav_errors.py +0 -35
- {dls_dodal-1.32.0.dist-info → dls_dodal-1.34.1.dist-info}/LICENSE +0 -0
- {dls_dodal-1.32.0.dist-info → dls_dodal-1.34.1.dist-info}/entry_points.txt +0 -0
- {dls_dodal-1.32.0.dist-info → dls_dodal-1.34.1.dist-info}/top_level.txt +0 -0
dodal/beamlines/i10.py
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from dodal.common.beamlines.beamline_utils import device_instantiation
|
|
4
|
+
from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
|
|
5
|
+
from dodal.devices.apple2_undulator import (
|
|
6
|
+
UndulatorGap,
|
|
7
|
+
UndulatorJawPhase,
|
|
8
|
+
UndulatorPhaseAxes,
|
|
9
|
+
)
|
|
10
|
+
from dodal.devices.i10.i10_apple2 import (
|
|
11
|
+
I10Apple2,
|
|
12
|
+
I10Apple2PGM,
|
|
13
|
+
I10Apple2Pol,
|
|
14
|
+
LinearArbitraryAngle,
|
|
15
|
+
)
|
|
16
|
+
from dodal.devices.i10.i10_setting_data import I10Grating
|
|
17
|
+
from dodal.devices.pgm import PGM
|
|
18
|
+
from dodal.log import set_beamline as set_log_beamline
|
|
19
|
+
from dodal.utils import BeamlinePrefix, get_beamline_name
|
|
20
|
+
|
|
21
|
+
BL = get_beamline_name("i10")
|
|
22
|
+
set_log_beamline(BL)
|
|
23
|
+
set_utils_beamline(BL)
|
|
24
|
+
|
|
25
|
+
LOOK_UPTABLE_DIR = "/dls_sw/i10/software/gda/workspace_git/gda-diamond.git/configurations/i10-shared/lookupTables/"
|
|
26
|
+
"""
|
|
27
|
+
I10 has two insertion devices one up(idu) and one down stream(idd).
|
|
28
|
+
It is worth noting that the down stream device is slightly longer,
|
|
29
|
+
so it can reach Mn edge for linear arbitrary.
|
|
30
|
+
idd == id1
|
|
31
|
+
and
|
|
32
|
+
idu == id2.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def idd_gap(
|
|
37
|
+
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
|
|
38
|
+
) -> UndulatorGap:
|
|
39
|
+
return device_instantiation(
|
|
40
|
+
device_factory=UndulatorGap,
|
|
41
|
+
name="idd_gap",
|
|
42
|
+
prefix=f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-01:",
|
|
43
|
+
wait=wait_for_connection,
|
|
44
|
+
fake=fake_with_ophyd_sim,
|
|
45
|
+
bl_prefix=False,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def idd_phase_axes(
|
|
50
|
+
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
|
|
51
|
+
) -> UndulatorPhaseAxes:
|
|
52
|
+
return device_instantiation(
|
|
53
|
+
device_factory=UndulatorPhaseAxes,
|
|
54
|
+
name="idd_phase_axes",
|
|
55
|
+
prefix=f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-01:",
|
|
56
|
+
top_outer="RPQ1",
|
|
57
|
+
top_inner="RPQ2",
|
|
58
|
+
btm_inner="RPQ3",
|
|
59
|
+
btm_outer="RPQ4",
|
|
60
|
+
wait=wait_for_connection,
|
|
61
|
+
fake=fake_with_ophyd_sim,
|
|
62
|
+
bl_prefix=False,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def idd_jaw(
|
|
67
|
+
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
|
|
68
|
+
) -> UndulatorJawPhase:
|
|
69
|
+
return device_instantiation(
|
|
70
|
+
device_factory=UndulatorJawPhase,
|
|
71
|
+
name="idd_jaw",
|
|
72
|
+
prefix=f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-01:",
|
|
73
|
+
move_pv="RPQ1",
|
|
74
|
+
wait=wait_for_connection,
|
|
75
|
+
fake=fake_with_ophyd_sim,
|
|
76
|
+
bl_prefix=False,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def idu_gap(
|
|
81
|
+
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
|
|
82
|
+
) -> UndulatorGap:
|
|
83
|
+
return device_instantiation(
|
|
84
|
+
device_factory=UndulatorGap,
|
|
85
|
+
name="idu_gap",
|
|
86
|
+
prefix=f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-21:",
|
|
87
|
+
wait=wait_for_connection,
|
|
88
|
+
fake=fake_with_ophyd_sim,
|
|
89
|
+
bl_prefix=False,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def idu_phase_axes(
|
|
94
|
+
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
|
|
95
|
+
) -> UndulatorPhaseAxes:
|
|
96
|
+
return device_instantiation(
|
|
97
|
+
device_factory=UndulatorPhaseAxes,
|
|
98
|
+
name="idu_phase_axes",
|
|
99
|
+
prefix=f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-21:",
|
|
100
|
+
top_outer="RPQ1",
|
|
101
|
+
top_inner="RPQ2",
|
|
102
|
+
btm_inner="RPQ3",
|
|
103
|
+
btm_outer="RPQ4",
|
|
104
|
+
wait=wait_for_connection,
|
|
105
|
+
fake=fake_with_ophyd_sim,
|
|
106
|
+
bl_prefix=False,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def idu_jaw(
|
|
111
|
+
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
|
|
112
|
+
) -> UndulatorJawPhase:
|
|
113
|
+
return device_instantiation(
|
|
114
|
+
device_factory=UndulatorJawPhase,
|
|
115
|
+
name="idu_jaw",
|
|
116
|
+
prefix=f"{BeamlinePrefix(BL).insertion_prefix}-MO-SERVC-21:",
|
|
117
|
+
move_pv="RPQ1",
|
|
118
|
+
wait=wait_for_connection,
|
|
119
|
+
fake=fake_with_ophyd_sim,
|
|
120
|
+
bl_prefix=False,
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def pgm(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) -> PGM:
|
|
125
|
+
return device_instantiation(
|
|
126
|
+
device_factory=PGM,
|
|
127
|
+
name="pgm",
|
|
128
|
+
prefix="-OP-PGM-01:",
|
|
129
|
+
grating=I10Grating,
|
|
130
|
+
gratingPv="NLINES2",
|
|
131
|
+
wait=wait_for_connection,
|
|
132
|
+
fake=fake_with_ophyd_sim,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def idu_gap_phase(
|
|
137
|
+
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
|
|
138
|
+
) -> I10Apple2:
|
|
139
|
+
return device_instantiation(
|
|
140
|
+
device_factory=I10Apple2,
|
|
141
|
+
id_gap=idu_gap(wait_for_connection, fake_with_ophyd_sim),
|
|
142
|
+
id_phase=idu_phase_axes(wait_for_connection, fake_with_ophyd_sim),
|
|
143
|
+
id_jaw_phase=idu_jaw(wait_for_connection, fake_with_ophyd_sim),
|
|
144
|
+
energy_gap_table_path=Path(
|
|
145
|
+
LOOK_UPTABLE_DIR + "IDEnergy2GapCalibrations.csv",
|
|
146
|
+
),
|
|
147
|
+
energy_phase_table_path=Path(
|
|
148
|
+
LOOK_UPTABLE_DIR + "IDEnergy2PhaseCalibrations.csv",
|
|
149
|
+
),
|
|
150
|
+
source=("Source", "idu"),
|
|
151
|
+
name="idu_gap_phase",
|
|
152
|
+
prefix="",
|
|
153
|
+
wait=wait_for_connection,
|
|
154
|
+
fake=fake_with_ophyd_sim,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def idd_gap_phase(
|
|
159
|
+
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
|
|
160
|
+
) -> I10Apple2:
|
|
161
|
+
return device_instantiation(
|
|
162
|
+
device_factory=I10Apple2,
|
|
163
|
+
id_gap=idd_gap(wait_for_connection, fake_with_ophyd_sim),
|
|
164
|
+
id_phase=idd_phase_axes(wait_for_connection, fake_with_ophyd_sim),
|
|
165
|
+
id_jaw_phase=idd_jaw(wait_for_connection, fake_with_ophyd_sim),
|
|
166
|
+
energy_gap_table_path=Path(
|
|
167
|
+
LOOK_UPTABLE_DIR + "IDEnergy2GapCalibrations.csv",
|
|
168
|
+
),
|
|
169
|
+
energy_phase_table_path=Path(
|
|
170
|
+
LOOK_UPTABLE_DIR + "IDEnergy2PhaseCalibrations.csv",
|
|
171
|
+
),
|
|
172
|
+
source=("Source", "idd"),
|
|
173
|
+
name="idd_gap_phase",
|
|
174
|
+
prefix="",
|
|
175
|
+
wait=wait_for_connection,
|
|
176
|
+
fake=fake_with_ophyd_sim,
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def idu_pol(
|
|
181
|
+
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
|
|
182
|
+
) -> I10Apple2Pol:
|
|
183
|
+
return device_instantiation(
|
|
184
|
+
device_factory=I10Apple2Pol,
|
|
185
|
+
prefix="",
|
|
186
|
+
id=idu_gap_phase(wait_for_connection, fake_with_ophyd_sim),
|
|
187
|
+
name="idu_pol",
|
|
188
|
+
wait=wait_for_connection,
|
|
189
|
+
fake=fake_with_ophyd_sim,
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def idd_pol(
|
|
194
|
+
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
|
|
195
|
+
) -> I10Apple2Pol:
|
|
196
|
+
return device_instantiation(
|
|
197
|
+
device_factory=I10Apple2Pol,
|
|
198
|
+
prefix="",
|
|
199
|
+
id=idd_gap_phase(wait_for_connection, fake_with_ophyd_sim),
|
|
200
|
+
name="idd_pol",
|
|
201
|
+
wait=wait_for_connection,
|
|
202
|
+
fake=fake_with_ophyd_sim,
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def idu(
|
|
207
|
+
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
|
|
208
|
+
) -> I10Apple2PGM:
|
|
209
|
+
return device_instantiation(
|
|
210
|
+
device_factory=I10Apple2PGM,
|
|
211
|
+
prefix="",
|
|
212
|
+
id=idu_gap_phase(wait_for_connection, fake_with_ophyd_sim),
|
|
213
|
+
pgm=pgm(wait_for_connection, fake_with_ophyd_sim),
|
|
214
|
+
name="idu",
|
|
215
|
+
wait=wait_for_connection,
|
|
216
|
+
fake=fake_with_ophyd_sim,
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def idd(
|
|
221
|
+
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
|
|
222
|
+
) -> I10Apple2PGM:
|
|
223
|
+
return device_instantiation(
|
|
224
|
+
device_factory=I10Apple2PGM,
|
|
225
|
+
prefix="",
|
|
226
|
+
id=idd_gap_phase(wait_for_connection, fake_with_ophyd_sim),
|
|
227
|
+
pgm=pgm(wait_for_connection, fake_with_ophyd_sim),
|
|
228
|
+
name="idd",
|
|
229
|
+
wait=wait_for_connection,
|
|
230
|
+
fake=fake_with_ophyd_sim,
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def idu_la_angle(
|
|
235
|
+
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
|
|
236
|
+
) -> LinearArbitraryAngle:
|
|
237
|
+
return device_instantiation(
|
|
238
|
+
device_factory=LinearArbitraryAngle,
|
|
239
|
+
prefix="",
|
|
240
|
+
id=idu(wait_for_connection, fake_with_ophyd_sim),
|
|
241
|
+
name="idu_la_angle",
|
|
242
|
+
wait=wait_for_connection,
|
|
243
|
+
fake=fake_with_ophyd_sim,
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
def idd_la_angle(
|
|
248
|
+
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
|
|
249
|
+
) -> LinearArbitraryAngle:
|
|
250
|
+
return device_instantiation(
|
|
251
|
+
device_factory=LinearArbitraryAngle,
|
|
252
|
+
prefix="",
|
|
253
|
+
id=idu(wait_for_connection, fake_with_ophyd_sim),
|
|
254
|
+
name="idd_la_angle",
|
|
255
|
+
wait=wait_for_connection,
|
|
256
|
+
fake=fake_with_ophyd_sim,
|
|
257
|
+
)
|
dodal/beamlines/i22.py
CHANGED
|
@@ -165,11 +165,10 @@ def dcm(
|
|
|
165
165
|
return device_instantiation(
|
|
166
166
|
DoubleCrystalMonochromator,
|
|
167
167
|
"dcm",
|
|
168
|
-
"",
|
|
168
|
+
f"{BeamlinePrefix(BL).beamline_prefix}-MO-DCM-01:",
|
|
169
169
|
wait_for_connection,
|
|
170
170
|
fake_with_ophyd_sim,
|
|
171
171
|
bl_prefix=False,
|
|
172
|
-
motion_prefix=f"{BeamlinePrefix(BL).beamline_prefix}-MO-DCM-01:",
|
|
173
172
|
temperature_prefix=f"{BeamlinePrefix(BL).beamline_prefix}-DI-DCM-01:",
|
|
174
173
|
crystal_1_metadata=CrystalMetadata(
|
|
175
174
|
usage="Bragg",
|
dodal/beamlines/i24.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
from dodal.common.beamlines.beamline_utils import
|
|
1
|
+
from dodal.common.beamlines.beamline_utils import (
|
|
2
|
+
BL,
|
|
3
|
+
device_instantiation,
|
|
4
|
+
)
|
|
2
5
|
from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
|
|
3
6
|
from dodal.devices.detector import DetectorParams
|
|
4
7
|
from dodal.devices.eiger import EigerDetector
|
|
@@ -11,7 +14,7 @@ from dodal.devices.i24.i24_detector_motion import DetectorMotion
|
|
|
11
14
|
from dodal.devices.i24.i24_vgonio import VGonio
|
|
12
15
|
from dodal.devices.i24.pmac import PMAC
|
|
13
16
|
from dodal.devices.oav.oav_detector import OAV
|
|
14
|
-
from dodal.devices.oav.oav_parameters import
|
|
17
|
+
from dodal.devices.oav.oav_parameters import OAVConfig
|
|
15
18
|
from dodal.devices.zebra import Zebra
|
|
16
19
|
from dodal.log import set_beamline as set_log_beamline
|
|
17
20
|
from dodal.utils import get_beamline_name, skip_device
|
|
@@ -138,16 +141,13 @@ def pmac(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) ->
|
|
|
138
141
|
|
|
139
142
|
@skip_device(lambda: BL == "s24")
|
|
140
143
|
def oav(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) -> OAV:
|
|
141
|
-
"""Get the i24 OAV device, instantiate it if it hasn't already been.
|
|
142
|
-
If this is called when already instantiated in i24, it will return the existing object.
|
|
143
|
-
"""
|
|
144
144
|
return device_instantiation(
|
|
145
145
|
OAV,
|
|
146
146
|
"oav",
|
|
147
|
-
"",
|
|
147
|
+
"-DI-OAV-01:",
|
|
148
148
|
wait_for_connection,
|
|
149
149
|
fake_with_ophyd_sim,
|
|
150
|
-
|
|
150
|
+
config=OAVConfig(ZOOM_PARAMS_FILE, DISPLAY_CONFIG),
|
|
151
151
|
)
|
|
152
152
|
|
|
153
153
|
|
dodal/beamlines/p38.py
CHANGED
|
@@ -222,11 +222,10 @@ def dcm(
|
|
|
222
222
|
return device_instantiation(
|
|
223
223
|
DoubleCrystalMonochromator,
|
|
224
224
|
"dcm",
|
|
225
|
-
"",
|
|
225
|
+
f"{BeamlinePrefix(BL).beamline_prefix}-MO-DCM-01:",
|
|
226
226
|
wait_for_connection,
|
|
227
227
|
fake_with_ophyd_sim,
|
|
228
228
|
bl_prefix=False,
|
|
229
|
-
motion_prefix=f"{BeamlinePrefix(BL).beamline_prefix}-MO-DCM-01:",
|
|
230
229
|
temperature_prefix=f"{BeamlinePrefix(BL).beamline_prefix}-DI-DCM-01:",
|
|
231
230
|
crystal_1_metadata=CrystalMetadata(
|
|
232
231
|
usage="Bragg",
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from collections.abc import Callable, Coroutine
|
|
2
|
+
from typing import Any, TypeVar
|
|
3
|
+
|
|
4
|
+
from bluesky.protocols import Reading
|
|
5
|
+
from ophyd_async.core import SignalR, SoftSignalBackend
|
|
6
|
+
from ophyd_async.core._soft_signal_backend import SignalMetadata
|
|
7
|
+
|
|
8
|
+
T = TypeVar("T")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class HarwareBackedSoftSignalBackend(SoftSignalBackend[T]):
|
|
12
|
+
def __init__(
|
|
13
|
+
self,
|
|
14
|
+
get_from_hardware_func: Callable[[], Coroutine[Any, Any, T]],
|
|
15
|
+
*args,
|
|
16
|
+
**kwargs,
|
|
17
|
+
) -> None:
|
|
18
|
+
self.get_from_hardware_func = get_from_hardware_func
|
|
19
|
+
super().__init__(*args, **kwargs)
|
|
20
|
+
|
|
21
|
+
async def _update_value(self):
|
|
22
|
+
new_value = await self.get_from_hardware_func()
|
|
23
|
+
await self.put(new_value)
|
|
24
|
+
|
|
25
|
+
async def get_reading(self) -> Reading:
|
|
26
|
+
await self._update_value()
|
|
27
|
+
return await super().get_reading()
|
|
28
|
+
|
|
29
|
+
async def get_value(self) -> T:
|
|
30
|
+
await self._update_value()
|
|
31
|
+
return await super().get_value()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def create_hardware_backed_soft_signal(
|
|
35
|
+
datatype: type[T],
|
|
36
|
+
get_from_hardware_func: Callable[[], Coroutine[Any, Any, T]],
|
|
37
|
+
units: str | None = None,
|
|
38
|
+
precision: int | None = None,
|
|
39
|
+
):
|
|
40
|
+
"""Creates a soft signal that, when read will call the function passed into
|
|
41
|
+
`get_from_hardware_func` and return this.
|
|
42
|
+
|
|
43
|
+
This will allow you to make soft signals derived from arbitrary hardware signals.
|
|
44
|
+
However, calling subscribe on this signal does not give you a sensible value and
|
|
45
|
+
the signal is currently read only. See https://github.com/bluesky/ophyd-async/issues/525
|
|
46
|
+
for a more full solution.
|
|
47
|
+
"""
|
|
48
|
+
metadata = SignalMetadata(units=units, precision=precision)
|
|
49
|
+
return SignalR(
|
|
50
|
+
backend=HarwareBackedSoftSignalBackend(
|
|
51
|
+
get_from_hardware_func, datatype, metadata=metadata
|
|
52
|
+
)
|
|
53
|
+
)
|
dodal/common/types.py
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
|
-
from collections.abc import Callable
|
|
3
|
-
from typing import (
|
|
4
|
-
Any,
|
|
5
|
-
)
|
|
2
|
+
from collections.abc import Callable
|
|
6
3
|
|
|
7
|
-
from bluesky.utils import
|
|
4
|
+
from bluesky.utils import MsgGenerator
|
|
8
5
|
from ophyd_async.core import PathProvider
|
|
9
6
|
|
|
10
7
|
# String identifier used by 'wait' or stubs that await
|
|
11
8
|
Group = str
|
|
12
|
-
# A true 'plan', usually the output of a generator function
|
|
13
|
-
MsgGenerator = Generator[Msg, Any, None]
|
|
14
9
|
# A function that generates a plan
|
|
15
10
|
PlanGenerator = Callable[..., MsgGenerator]
|
|
16
11
|
|
|
@@ -8,11 +8,11 @@ from ophyd_async.core import (
|
|
|
8
8
|
AsyncStatus,
|
|
9
9
|
HintedSignal,
|
|
10
10
|
StandardReadable,
|
|
11
|
-
soft_signal_rw,
|
|
12
11
|
)
|
|
13
12
|
from pydantic import BaseModel, Field
|
|
14
13
|
|
|
15
14
|
from dodal.common.beamlines.beamline_parameters import GDABeamlineParameters
|
|
15
|
+
from dodal.common.signal_utils import create_hardware_backed_soft_signal
|
|
16
16
|
from dodal.devices.aperture import Aperture
|
|
17
17
|
from dodal.devices.scatterguard import Scatterguard
|
|
18
18
|
|
|
@@ -105,7 +105,9 @@ class ApertureScatterguard(StandardReadable, Movable):
|
|
|
105
105
|
) -> None:
|
|
106
106
|
self.aperture = Aperture(prefix + "-MO-MAPT-01:")
|
|
107
107
|
self.scatterguard = Scatterguard(prefix + "-MO-SCAT-01:")
|
|
108
|
-
self.radius =
|
|
108
|
+
self.radius = create_hardware_backed_soft_signal(
|
|
109
|
+
float, self._get_current_radius, units="µm"
|
|
110
|
+
)
|
|
109
111
|
self._loaded_positions = loaded_positions
|
|
110
112
|
self._tolerances = tolerances
|
|
111
113
|
self.add_readables(
|
|
@@ -119,7 +121,9 @@ class ApertureScatterguard(StandardReadable, Movable):
|
|
|
119
121
|
],
|
|
120
122
|
)
|
|
121
123
|
with self.add_children_as_readables(HintedSignal):
|
|
122
|
-
self.selected_aperture =
|
|
124
|
+
self.selected_aperture = create_hardware_backed_soft_signal(
|
|
125
|
+
ApertureValue, self._get_current_aperture_position
|
|
126
|
+
)
|
|
123
127
|
|
|
124
128
|
super().__init__(name)
|
|
125
129
|
|
|
@@ -136,9 +140,6 @@ class ApertureScatterguard(StandardReadable, Movable):
|
|
|
136
140
|
@AsyncStatus.wrap
|
|
137
141
|
async def _set_raw_unsafe(self, position: AperturePosition):
|
|
138
142
|
"""Accept the risks and move in an unsafe way. Collisions possible."""
|
|
139
|
-
if position.radius is not None:
|
|
140
|
-
await self.radius.set(position.radius)
|
|
141
|
-
|
|
142
143
|
aperture_x, aperture_y, aperture_z, scatterguard_x, scatterguard_y = (
|
|
143
144
|
position.values
|
|
144
145
|
)
|
|
@@ -150,13 +151,8 @@ class ApertureScatterguard(StandardReadable, Movable):
|
|
|
150
151
|
self.scatterguard.x.set(scatterguard_x),
|
|
151
152
|
self.scatterguard.y.set(scatterguard_y),
|
|
152
153
|
)
|
|
153
|
-
try:
|
|
154
|
-
value = await self.get_current_aperture_position()
|
|
155
|
-
self.selected_aperture.set(value)
|
|
156
|
-
except InvalidApertureMove:
|
|
157
|
-
self.selected_aperture.set(None) # type: ignore
|
|
158
154
|
|
|
159
|
-
async def
|
|
155
|
+
async def _get_current_aperture_position(self) -> ApertureValue:
|
|
160
156
|
"""
|
|
161
157
|
Returns the current aperture position using readback values
|
|
162
158
|
for SMALL, MEDIUM, LARGE. ROBOT_LOAD position defined when
|
|
@@ -176,6 +172,10 @@ class ApertureScatterguard(StandardReadable, Movable):
|
|
|
176
172
|
|
|
177
173
|
raise InvalidApertureMove("Current aperture/scatterguard state unrecognised")
|
|
178
174
|
|
|
175
|
+
async def _get_current_radius(self) -> float | None:
|
|
176
|
+
current_value = await self._get_current_aperture_position()
|
|
177
|
+
return self._loaded_positions[current_value].radius
|
|
178
|
+
|
|
179
179
|
async def _safe_move_within_datacollection_range(
|
|
180
180
|
self, position: AperturePosition, value: ApertureValue
|
|
181
181
|
):
|
|
@@ -203,8 +203,6 @@ class ApertureScatterguard(StandardReadable, Movable):
|
|
|
203
203
|
)
|
|
204
204
|
|
|
205
205
|
current_ap_y = await self.aperture.y.user_readback.get_value()
|
|
206
|
-
if position.radius is not None:
|
|
207
|
-
await self.radius.set(position.radius)
|
|
208
206
|
|
|
209
207
|
aperture_x, aperture_y, aperture_z, scatterguard_x, scatterguard_y = (
|
|
210
208
|
position.values
|
|
@@ -231,4 +229,3 @@ class ApertureScatterguard(StandardReadable, Movable):
|
|
|
231
229
|
self.scatterguard.x.set(scatterguard_x),
|
|
232
230
|
self.scatterguard.y.set(scatterguard_y),
|
|
233
231
|
)
|
|
234
|
-
await self.selected_aperture.set(value)
|