forked from bluesky/ophyd-async
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved test covereage of demo devices. Added composite device Tango…
…Detector to demo which includes demonstrations of annotated subdevices.
- Loading branch information
Showing
7 changed files
with
66 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
from ._counter import TangoCounter, TangoCounterConfig | ||
from ._mover import TangoMover, TangoMoverConfig | ||
from ._counter import TangoCounter | ||
from ._detector import TangoDetector | ||
from ._mover import TangoMover | ||
from ._tango import DemoCounter, DemoMover | ||
|
||
__all__ = [ | ||
"DemoCounter", | ||
"DemoMover", | ||
"TangoCounter", | ||
"TangoCounterConfig", | ||
"TangoMover", | ||
"TangoMoverConfig", | ||
"TangoDetector", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import asyncio | ||
|
||
from ophyd_async.core import ( | ||
AsyncStatus, | ||
DeviceVector, | ||
) | ||
from ophyd_async.tango import TangoReadable | ||
|
||
from . import TangoCounter, TangoMover | ||
|
||
|
||
class TangoDetector(TangoReadable): | ||
counters: DeviceVector[TangoCounter] | ||
mover: TangoMover | ||
|
||
def __init__(self, *args, **kwargs): | ||
if "counters_kwargs" in kwargs: | ||
self._counters_kwargs = kwargs.pop("counters_kwargs") | ||
if "mover_kwargs" in kwargs: | ||
self._mover_kwargs = kwargs.pop("mover_kwargs") | ||
super().__init__(*args, **kwargs) | ||
self.add_readables([self.counters, self.mover]) | ||
|
||
def set(self, value): | ||
return self.mover.set(value) | ||
|
||
def stop(self): | ||
return self.mover.stop() | ||
|
||
@AsyncStatus.wrap | ||
async def trigger(self): | ||
statuses = [] | ||
for counter in self.counters.values(): | ||
statuses.append(counter.reset()) | ||
await asyncio.gather(*statuses) | ||
statuses.clear() | ||
for counter in self.counters.values(): | ||
statuses.append(counter.trigger()) | ||
await asyncio.gather(*statuses) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters