dls-dodal 1.62.0__py3-none-any.whl → 1.64.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.62.0.dist-info → dls_dodal-1.64.0.dist-info}/METADATA +3 -3
- {dls_dodal-1.62.0.dist-info → dls_dodal-1.64.0.dist-info}/RECORD +89 -76
- dls_dodal-1.64.0.dist-info/entry_points.txt +3 -0
- dodal/_version.py +2 -2
- dodal/beamlines/__init__.py +1 -0
- dodal/beamlines/adsim.py +5 -3
- dodal/beamlines/b21.py +3 -1
- dodal/beamlines/i02_2.py +32 -0
- dodal/beamlines/i03.py +9 -0
- dodal/beamlines/i07.py +21 -0
- dodal/beamlines/i09.py +11 -4
- dodal/beamlines/i09_1.py +10 -4
- dodal/beamlines/i09_2.py +30 -0
- dodal/beamlines/i10.py +7 -69
- dodal/beamlines/i10_1.py +35 -0
- dodal/beamlines/i10_optics.py +231 -0
- dodal/beamlines/i15_1.py +5 -5
- dodal/beamlines/i17.py +60 -1
- dodal/beamlines/i18.py +15 -9
- dodal/beamlines/i19_1.py +3 -3
- dodal/beamlines/i19_2.py +2 -2
- dodal/beamlines/i19_optics.py +4 -1
- dodal/beamlines/i21.py +31 -1
- dodal/beamlines/i24.py +3 -3
- dodal/cli.py +7 -7
- dodal/common/visit.py +4 -4
- dodal/devices/aperturescatterguard.py +6 -4
- dodal/devices/apple2_undulator.py +225 -126
- dodal/devices/attenuator/filter_selections.py +6 -6
- dodal/devices/b07_1/ccmc.py +1 -1
- dodal/devices/common_dcm.py +63 -16
- dodal/devices/current_amplifiers/femto.py +4 -4
- dodal/devices/current_amplifiers/sr570.py +3 -3
- dodal/devices/fast_grid_scan.py +4 -4
- dodal/devices/fast_shutter.py +19 -7
- dodal/devices/i02_2/__init__.py +0 -0
- dodal/devices/i03/dcm.py +4 -2
- dodal/devices/i03/undulator_dcm.py +1 -1
- dodal/devices/i04/murko_results.py +35 -14
- dodal/devices/i07/__init__.py +0 -0
- dodal/devices/i07/dcm.py +33 -0
- dodal/devices/i09/__init__.py +1 -2
- dodal/devices/i09_1_shared/__init__.py +3 -0
- dodal/devices/i09_1_shared/hard_undulator_functions.py +111 -0
- dodal/devices/i10/__init__.py +29 -0
- dodal/devices/i10/diagnostics.py +37 -5
- dodal/devices/i10/i10_apple2.py +125 -229
- dodal/devices/i10/slits.py +38 -6
- dodal/devices/i15/dcm.py +7 -46
- dodal/devices/i17/__init__.py +0 -0
- dodal/devices/i17/i17_apple2.py +51 -0
- dodal/devices/i19/access_controlled/__init__.py +0 -0
- dodal/devices/i19/{shutter.py → access_controlled/shutter.py} +7 -4
- dodal/devices/i22/dcm.py +3 -3
- dodal/devices/i24/dcm.py +2 -2
- dodal/devices/oav/oav_detector.py +1 -1
- dodal/devices/oav/oav_parameters.py +4 -4
- dodal/devices/oav/oav_to_redis_forwarder.py +4 -4
- dodal/devices/oav/pin_image_recognition/__init__.py +3 -3
- dodal/devices/oav/pin_image_recognition/utils.py +1 -1
- dodal/devices/oav/snapshots/snapshot.py +1 -1
- dodal/devices/oav/snapshots/snapshot_image_processing.py +12 -12
- dodal/devices/oav/snapshots/snapshot_with_grid.py +1 -1
- dodal/devices/oav/utils.py +2 -2
- dodal/devices/pgm.py +3 -3
- dodal/devices/robot.py +5 -5
- dodal/devices/tetramm.py +9 -5
- dodal/devices/thawer.py +0 -4
- dodal/devices/util/lookup_tables.py +8 -2
- dodal/devices/v2f.py +2 -2
- dodal/devices/zebra/zebra_constants_mapping.py +2 -2
- dodal/devices/zocalo/__init__.py +4 -4
- dodal/devices/zocalo/zocalo_results.py +4 -4
- dodal/log.py +9 -9
- dodal/plan_stubs/motor_utils.py +4 -4
- dodal/plans/configure_arm_trigger_and_disarm_detector.py +2 -2
- dodal/plans/save_panda.py +7 -7
- dodal/plans/verify_undulator_gap.py +4 -4
- dodal/testing/fixtures/__init__.py +0 -0
- dodal/testing/fixtures/run_engine.py +46 -0
- dodal/testing/fixtures/utils.py +57 -0
- dls_dodal-1.62.0.dist-info/entry_points.txt +0 -3
- dodal/beamlines/i10-1.py +0 -25
- dodal/devices/i09/dcm.py +0 -26
- {dls_dodal-1.62.0.dist-info → dls_dodal-1.64.0.dist-info}/WHEEL +0 -0
- {dls_dodal-1.62.0.dist-info → dls_dodal-1.64.0.dist-info}/licenses/LICENSE +0 -0
- {dls_dodal-1.62.0.dist-info → dls_dodal-1.64.0.dist-info}/top_level.txt +0 -0
- /dodal/devices/areadetector/plugins/{CAM.py → cam.py} +0 -0
- /dodal/devices/areadetector/plugins/{MJPG.py → mjpg.py} +0 -0
- /dodal/devices/i18/{KBMirror.py → kb_mirror.py} +0 -0
- /dodal/devices/i19/{blueapi_device.py → access_controlled/blueapi_device.py} +0 -0
- /dodal/devices/i19/{hutch_access.py → access_controlled/hutch_access.py} +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Allow external repos to reuse these fixtures so defined in single place.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
import time
|
|
7
|
+
from collections.abc import Mapping
|
|
8
|
+
|
|
9
|
+
import pytest
|
|
10
|
+
from bluesky.run_engine import RunEngine
|
|
11
|
+
from bluesky.simulators import RunEngineSimulator
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@pytest.fixture(scope="session", autouse=True)
|
|
15
|
+
async def _ensure_running_bluesky_event_loop():
|
|
16
|
+
run_engine = RunEngine()
|
|
17
|
+
# make sure the event loop is thoroughly up and running before we try to create
|
|
18
|
+
# any ophyd_async devices which might need it
|
|
19
|
+
timeout = time.monotonic() + 1
|
|
20
|
+
while not run_engine.loop.is_running():
|
|
21
|
+
await asyncio.sleep(0)
|
|
22
|
+
if time.monotonic() > timeout:
|
|
23
|
+
raise TimeoutError("This really shouldn't happen but just in case...")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@pytest.fixture()
|
|
27
|
+
async def run_engine():
|
|
28
|
+
yield RunEngine()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@pytest.fixture
|
|
32
|
+
def sim_run_engine() -> RunEngineSimulator:
|
|
33
|
+
return RunEngineSimulator()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@pytest.fixture
|
|
37
|
+
def run_engine_documents(run_engine: RunEngine) -> Mapping[str, list[dict]]:
|
|
38
|
+
docs: dict[str, list[dict]] = {}
|
|
39
|
+
|
|
40
|
+
def append_and_print(name, doc):
|
|
41
|
+
if name not in docs:
|
|
42
|
+
docs[name] = []
|
|
43
|
+
docs[name] += [doc]
|
|
44
|
+
|
|
45
|
+
run_engine.subscribe(append_and_print)
|
|
46
|
+
return docs
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import threading
|
|
3
|
+
import time
|
|
4
|
+
from random import random
|
|
5
|
+
from threading import Thread
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.fixture
|
|
11
|
+
async def event_loop_fuzzing():
|
|
12
|
+
"""
|
|
13
|
+
This fixture can be used to try and detect / reproduce intermittent test failures
|
|
14
|
+
caused by race conditions and timing issues, which are often difficult to replicate
|
|
15
|
+
due to caching etc. causing timing to be different on a development machine compared
|
|
16
|
+
to when the test runs in CI.
|
|
17
|
+
|
|
18
|
+
It works by attaching a fuzzer to the current event loop which randomly schedules
|
|
19
|
+
a fixed delay into the event loop thread every few milliseconds. The idea is that
|
|
20
|
+
over a number of iterations, there should be sufficient timing variation introduced
|
|
21
|
+
that the failure can be reproduced.
|
|
22
|
+
|
|
23
|
+
Examples:
|
|
24
|
+
Example usage:
|
|
25
|
+
>>> import pytest
|
|
26
|
+
>>> # repeat the test a number of times
|
|
27
|
+
>>> @pytest.mark.parametrize("i", range(0, 100))
|
|
28
|
+
... async def my_unreliable_test(i, event_loop_fuzzing):
|
|
29
|
+
... # Do some stuff in here
|
|
30
|
+
... ...
|
|
31
|
+
"""
|
|
32
|
+
fuzz_probability = 0.05
|
|
33
|
+
fuzz_delay_s = 0.05
|
|
34
|
+
fuzz_period_s = 0.001
|
|
35
|
+
stop_running = threading.Event()
|
|
36
|
+
event_loop = asyncio.get_running_loop()
|
|
37
|
+
|
|
38
|
+
def delay(finished_event: threading.Event):
|
|
39
|
+
time.sleep(fuzz_delay_s) # noqa: TID251
|
|
40
|
+
finished_event.set()
|
|
41
|
+
|
|
42
|
+
def fuzz():
|
|
43
|
+
while not stop_running.is_set():
|
|
44
|
+
if random() < fuzz_probability:
|
|
45
|
+
delay_is_finished = threading.Event()
|
|
46
|
+
event_loop.call_soon_threadsafe(delay, delay_is_finished)
|
|
47
|
+
delay_is_finished.wait()
|
|
48
|
+
|
|
49
|
+
time.sleep(fuzz_period_s) # noqa: TID251
|
|
50
|
+
|
|
51
|
+
fuzzer_thread = Thread(group=None, target=fuzz, name="Event loop fuzzer")
|
|
52
|
+
fuzzer_thread.start()
|
|
53
|
+
try:
|
|
54
|
+
yield None
|
|
55
|
+
finally:
|
|
56
|
+
stop_running.set()
|
|
57
|
+
fuzzer_thread.join()
|
dodal/beamlines/i10-1.py
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
from dodal.common.beamlines.beamline_utils import (
|
|
2
|
-
device_factory,
|
|
3
|
-
)
|
|
4
|
-
from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
|
|
5
|
-
from dodal.devices.synchrotron import Synchrotron
|
|
6
|
-
from dodal.devices.temperture_controller import Lakeshore336
|
|
7
|
-
from dodal.log import set_beamline as set_log_beamline
|
|
8
|
-
from dodal.utils import BeamlinePrefix, get_beamline_name
|
|
9
|
-
|
|
10
|
-
BL = get_beamline_name("i10-1")
|
|
11
|
-
PREFIX = BeamlinePrefix(BL, suffix="J")
|
|
12
|
-
set_log_beamline(BL)
|
|
13
|
-
set_utils_beamline(BL)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@device_factory()
|
|
17
|
-
def synchrotron() -> Synchrotron:
|
|
18
|
-
return Synchrotron()
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
@device_factory()
|
|
22
|
-
def em_temperature_controller() -> Lakeshore336:
|
|
23
|
-
return Lakeshore336(
|
|
24
|
-
prefix=f"{PREFIX.beamline_prefix}-EA-TCTRL-41:",
|
|
25
|
-
)
|
dodal/devices/i09/dcm.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
from ophyd_async.core import derived_signal_r
|
|
2
|
-
|
|
3
|
-
from dodal.devices.common_dcm import BaseDCM, PitchAndRollCrystal, StationaryCrystal
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class DCM(BaseDCM[PitchAndRollCrystal, StationaryCrystal]):
|
|
7
|
-
"""
|
|
8
|
-
I09 double crystal monochromator (DCM), used to select the energy of the beam.
|
|
9
|
-
Differences:
|
|
10
|
-
|
|
11
|
-
1. Can provide energy in eV via dcm.energy_in_ev read signal
|
|
12
|
-
|
|
13
|
-
This DCM is available on i09 and i09_1 endstations.
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
def __init__(self, prefix: str, name: str = "") -> None:
|
|
17
|
-
super().__init__(prefix, PitchAndRollCrystal, StationaryCrystal, name)
|
|
18
|
-
self.energy_in_ev = derived_signal_r(
|
|
19
|
-
self._convert_keV_to_eV, energy_signal=self.energy_in_kev.user_readback
|
|
20
|
-
)
|
|
21
|
-
# Set name so that new child signals get correct name
|
|
22
|
-
# need to do it until https://github.com/bluesky/ophyd-async/pull/899 merged
|
|
23
|
-
self.set_name(self.name)
|
|
24
|
-
|
|
25
|
-
def _convert_keV_to_eV(self, energy_signal: float) -> float:
|
|
26
|
-
return energy_signal * 1000
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|