Skip to content

Commit

Permalink
catch up to ophyd 0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Relm-Arrowny committed Oct 15, 2024
1 parent a1c468b commit 1f19633
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import asyncio

from ophyd_async.core import DetectorControl, DetectorTrigger
from ophyd_async.core import DetectorController, DetectorTrigger
from ophyd_async.core._detector import TriggerInfo
from ophyd_async.epics import adcore
from ophyd_async.epics.adcore import (
Expand All @@ -19,7 +19,7 @@
DEFAULT_MAX_NUM_IMAGE = 999_999


class Andor2Controller(DetectorControl):
class Andor2Controller(DetectorController):
_supported_trigger_types = {
DetectorTrigger.internal: Andor2TriggerMode.internal,
DetectorTrigger.edge_trigger: Andor2TriggerMode.ext_trigger,
Expand Down Expand Up @@ -49,8 +49,8 @@ async def prepare(self, trigger_info: TriggerInfo):
self._drv.trigger_mode.set(self._get_trigger_mode(trigger_info.trigger)),
self._drv.num_images.set(
DEFAULT_MAX_NUM_IMAGE
if trigger_info.number == 0
else trigger_info.number
if trigger_info.total_number_of_triggers == 0
else trigger_info.total_number_of_triggers
),
self._drv.image_mode.set(ImageMode.multiple),
)
Expand Down
8 changes: 5 additions & 3 deletions tests/devices/unit_tests/areadetector/test_andor2.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ async def andor_controller() -> Andor2Controller:
async def test_andor_controller_prepare_and_arm_with_TriggerInfo(
RE, andor_controller: Andor2Controller
):
await andor_controller.prepare(trigger_info=TriggerInfo(number=1, livetime=0.002))
await andor_controller.prepare(
trigger_info=TriggerInfo(number_of_triggers=1, livetime=0.002)
)
await andor_controller.arm()

driver = andor_controller._drv
Expand All @@ -82,7 +84,7 @@ async def test_andor_controller_prepare_and_arm_with_no_livetime(
default_count_time = 2141
driver = andor_controller._drv
set_mock_value(driver.acquire_time, default_count_time)
await andor_controller.prepare(trigger_info=TriggerInfo(number=5))
await andor_controller.prepare(trigger_info=TriggerInfo(number_of_triggers=5))
await andor_controller.arm()

assert await driver.num_images.get_value() == 5
Expand All @@ -99,7 +101,7 @@ async def test_andor_controller_prepare_and_arm_with_trigger_number_of_zero(
default_count_time = 1231
driver = andor_controller._drv
set_mock_value(driver.acquire_time, default_count_time)
await andor_controller.prepare(trigger_info=TriggerInfo(number=0))
await andor_controller.prepare(trigger_info=TriggerInfo(number_of_triggers=0))
await andor_controller.arm()

assert await driver.num_images.get_value() == DEFAULT_MAX_NUM_IMAGE
Expand Down

0 comments on commit 1f19633

Please sign in to comment.