diff --git a/pyproject.toml b/pyproject.toml index 9d0126a..b8f2d99 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -124,7 +124,7 @@ reportMissingImports = false # Ignore missing stubs in imported modules addopts = """ --tb=native -vv --strict-markers --doctest-modules --doctest-glob="*.rst" --doctest-glob="*.md" - --ignore=docs/examples --ignore=src/hextools/profiles + --ignore=docs/examples --ignore=src/hextools/profiles --ignore=src/hextools/gui """ # https://iscinumpy.gitlab.io/post/bound-version-constraints/#watch-for-warnings filterwarnings = [ diff --git a/src/hextools/photon_delivery_system/dclm.py b/src/hextools/photon_delivery_system/dclm.py index 09956cd..44fa058 100644 --- a/src/hextools/photon_delivery_system/dclm.py +++ b/src/hextools/photon_delivery_system/dclm.py @@ -22,7 +22,7 @@ from ophyd_async.epics.core import EpicsDevice from ophyd_async.epics.motor import Motor as AsyncEpicsMotor -from ..utils import ensure_available +from ..utils import ensure_available, forward_watcher_updates from .shutter import Shutter, ensure_shutter_closed diff --git a/src/hextools/profiles/collection.py b/src/hextools/profiles/collection.py index dc11a61..0fc1a6e 100644 --- a/src/hextools/profiles/collection.py +++ b/src/hextools/profiles/collection.py @@ -226,7 +226,19 @@ sim_z = SimMotor(name="sim_z", instant=False) -RE.install_suspender(SuspendFloor(storage_ring.beam_current, 100, resume_thresh=390)) +# Install a suspender to pause the RunEngine if the beam current drops below 100 mA +# and resume when it rises above 390 mA, unless the ring is in maintenance/shutdown. +try: + _ops_mode = call_in_bluesky_event_loop(storage_ring.operating_mode.get_value()) +except Exception as e: + print(f"Could not read storage ring operating mode ({e}); beam suspender not installed.") +else: + if _ops_mode in (NSLS2OpsMode.MAINTENANCE, NSLS2OpsMode.SHUTDOWN): + print(f"Storage ring in {_ops_mode.value} mode; beam suspender not installed.") + else: + RE.install_suspender( + SuspendFloor(storage_ring.beam_current, 100, resume_thresh=390) + ) # Configure baseline supplemental data to include in the metadata of every run. sd = bpp.SupplementalData( diff --git a/tests/tomography/test_alignment.py b/tests/tomography/test_alignment.py index 97ba2e3..34b739f 100644 --- a/tests/tomography/test_alignment.py +++ b/tests/tomography/test_alignment.py @@ -407,7 +407,15 @@ async def test_tomo_alignment_scan_fails_if_fe_shutter_closed( ) with pytest.raises(ValueError, match="Front-end shutter is closed"): - RE(tomo_alignment_scan([], rotation_motor, fe_shutter, photon_shutter, 0.1)) + RE( + tomo_alignment_scan( + [], + 0.1, + fe_shutter=fe_shutter, + photon_shutter=photon_shutter, + rot_motor=rotation_motor, + ) + ) @pytest.mark.parametrize( @@ -469,14 +477,14 @@ def msg_hook(msg: Msg): runs: RunEngineResult = RE( tomo_alignment_scan( [ktx1], - rotation_motor, - fe_shutter, - photon_shutter, exposure_time, num_projections=num_projections, init_angle=init_angle, stop_angle=stop_angle, base_x_offset=base_x_offset, + fe_shutter=fe_shutter, + photon_shutter=photon_shutter, + rot_motor=rotation_motor, sample_stage_x=None if not include_sample_stage_x else sample_stage_x, ), cache_docs, # type: ignore