Skip to content

Commit

Permalink
Linting: black, and isort.
Browse files Browse the repository at this point in the history
  • Loading branch information
canismarko committed Nov 29, 2024
1 parent 5228b7f commit 828f69d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
8 changes: 2 additions & 6 deletions src/haven/devices/detectors/aravis.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ophyd_async.core import SubsetEnum, PathProvider
from ophyd_async.core import PathProvider, SubsetEnum
from ophyd_async.epics.adaravis import AravisDetector as DetectorBase
from ophyd_async.epics.core import epics_signal_rw_rbv

Expand All @@ -14,11 +14,7 @@ class AravisDetector(HavenDetector, DetectorBase):
_ophyd_labels_ = {"cameras", "detectors"}

def __init__(
self,
prefix,
*args,
path_provider: PathProvider | None = None,
**kwargs
self, prefix, *args, path_provider: PathProvider | None = None, **kwargs
):
if path_provider is None:
path_provider = default_path_provider()
Expand Down
3 changes: 1 addition & 2 deletions src/haven/devices/detectors/area_detectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from ..._iconfig import load_config


class HavenDetector:
...
class HavenDetector: ...


def default_path_provider(path: Path = None, config=None):
Expand Down
10 changes: 5 additions & 5 deletions src/haven/devices/detectors/xspress.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
from collections.abc import Sequence

from ophyd_async.core import (
AsyncStatus,
DetectorController,
DetectorTrigger,
PathProvider,
SignalR,
StandardDetector,
DetectorController,
DetectorTrigger,
AsyncStatus,
TriggerInfo,
StrictEnum,
TriggerInfo,
set_and_wait_for_value,
)
from ophyd_async.epics import adcore
from ophyd_async.epics.core import epics_signal_rw, epics_signal_x

from .area_detectors import default_path_provider, HavenDetector
from .area_detectors import HavenDetector, default_path_provider


class XspressTriggerMode(StrictEnum):
Expand Down
19 changes: 14 additions & 5 deletions src/haven/tests/test_xspress.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
from pathlib import Path

import pytest
from ophyd_async.core import (
StaticPathProvider,
TriggerInfo,
UUIDFilenameProvider,
get_mock_put,
set_mock_value,
)

from ophyd_async.core import TriggerInfo, UUIDFilenameProvider, StaticPathProvider, set_mock_value, get_mock_put

from haven.devices.detectors.xspress import Xspress3Detector
from haven.devices.detectors.area_detectors import default_path_provider

from haven.devices.detectors.xspress import Xspress3Detector

this_dir = Path(__file__).parent


@pytest.fixture()
async def detector():
det = Xspress3Detector("255id_xsp:", name="vortex_me4")
Expand All @@ -22,9 +27,12 @@ async def detector():
def test_mca_signals(detector):
# Spot-check some PVs
# print(list(detector.drv.children()))
assert detector.drv.acquire_time.source == "mock+ca://255id_xsp:det1:AcquireTime_RBV"
assert (
detector.drv.acquire_time.source == "mock+ca://255id_xsp:det1:AcquireTime_RBV"
)
assert detector.drv.acquire.source == "mock+ca://255id_xsp:det1:Acquire_RBV"


async def test_trigger(detector):
trigger_info = TriggerInfo(number_of_triggers=1)
status = detector.trigger()
Expand All @@ -34,6 +42,7 @@ async def test_trigger(detector):
# Check that signals were set
get_mock_put(detector.drv.num_images).assert_called_once_with(1, wait=True)


async def test_stage(detector):
assert not get_mock_put(detector.drv.erase).called
await detector.stage()
Expand Down

0 comments on commit 828f69d

Please sign in to comment.