Skip to content

Commit

Permalink
Moved tango_demo to docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
burkeds committed Sep 5, 2024
1 parent d59fb5f commit a1a0410
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 51 deletions.
53 changes: 53 additions & 0 deletions docs/examples/tango_demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import asyncio

import bluesky.plans as bp
from bluesky import RunEngine
from bluesky.callbacks.best_effort import BestEffortCallback
from bluesky.utils import ProgressBarManager

from ophyd_async.tango.demo import (
DemoCounter,
DemoMover,
TangoCounter,
TangoMover,
)
from tango.test_context import MultiDeviceTestContext

content = (
{
"class": DemoMover,
"devices": [{"name": "demo/motor/1"}],
},
{
"class": DemoCounter,
"devices": [{"name": "demo/counter/1"}, {"name": "demo/counter/2"}],
},
)

tango_context = MultiDeviceTestContext(content)


async def main():
with tango_context as context:
motor1 = TangoMover(
trl=context.get_device_access("demo/motor/1"), name="motor1"
)
counter1 = TangoCounter(
trl=context.get_device_access("demo/counter/1"), name="counter1"
)
counter2 = TangoCounter(
trl=context.get_device_access("demo/counter/2"), name="counter2"
)
await motor1.connect()
await counter1.connect()
await counter2.connect()

RE = RunEngine()
RE.subscribe(BestEffortCallback())
RE.waiting_hook = ProgressBarManager()
# RE(bps.mv(motor1, 1))
RE(bp.scan([counter1, counter2], motor1, -1, 1, 10))


if __name__ == "__main__":
asyncio.run(main())
51 changes: 0 additions & 51 deletions src/ophyd_async/tango/demo/README.md

This file was deleted.

0 comments on commit a1a0410

Please sign in to comment.