Skip to content

Commit

Permalink
Use better example of PV string concat.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielballan committed Apr 15, 2019
1 parent 96b61f6 commit 6e21335
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 17 deletions.
31 changes: 20 additions & 11 deletions Device.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@
"from ophyd import Device, Component\n",
"\n",
"class RandomWalk(Device):\n",
" x = Component(EpicsSignalRO, ':x')\n",
" dt = Component(EpicsSignal, ':dt')\n",
" x = Component(EpicsSignalRO, 'x')\n",
" dt = Component(EpicsSignal, 'dt')\n",
" \n",
"random_walk = RandomWalk('random_walk', name='random_walk')\n",
"random_walk = RandomWalk('random_walk:', name='random_walk')\n",
"random_walk"
]
},
Expand Down Expand Up @@ -133,7 +133,7 @@
"metadata": {},
"outputs": [],
"source": [
"another_random_walk = RandomWalk('another_random_walk', name='another_random_walk')"
"another_random_walk = RandomWalk('random_walk:vert-', name='another_random_walk')"
]
},
{
Expand All @@ -159,13 +159,22 @@
"outputs": [],
"source": [
"class RandomWalks(Device):\n",
" a = Component(RandomWalk, 'random_walk')\n",
" b = Component(RandomWalk, 'another_random_walk')\n",
" vert = Component(RandomWalk, 'vert-')\n",
" horiz = Component(RandomWalk, 'horiz-')\n",
" \n",
"random_walks = RandomWalks('', name='random_walks')\n",
"random_walks = RandomWalks('random_walk:', name='random_walks')\n",
"random_walks"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"random_walks.vert.x.pvname"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -181,7 +190,7 @@
"metadata": {},
"outputs": [],
"source": [
"random_walks.a.read()"
"random_walks.vert.read()"
]
},
{
Expand All @@ -190,7 +199,7 @@
"metadata": {},
"outputs": [],
"source": [
"random_walks.a.x.read()"
"random_walks.vert.x.read()"
]
},
{
Expand All @@ -199,7 +208,7 @@
"source": [
"## Exercise\n",
"\n",
"Using the `random_walks` Device, set the PV `another_random_walk:dt` to `3`."
"Using the `random_walks` Device, set the PV `random_walk:horiz-dt` to `3`."
]
},
{
Expand All @@ -226,7 +235,7 @@
"metadata": {},
"outputs": [],
"source": [
"status = random_walks.a.dt.set(2)"
"status = random_walks.vert.dt.set(2)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion solutions/set_subcomponent_signal.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
random_walks.b.dt.set(3)
random_walks.horiz.dt.set(3)
5 changes: 0 additions & 5 deletions supervisor/conf.d/another_random_walk.conf

This file was deleted.

5 changes: 5 additions & 0 deletions supervisor/conf.d/random_walk_horiz.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[program:random_walk_horiz]
command = /usr/bin/env python3 -m caproto.ioc_examples.random_walk -v --interfaces=0.0.0.0 --prefix="random_walk:horiz-"
stdout_logfile = /tmp/random_walk_horiz_stdout.log
stderr_logfile = /tmp/random_walk_horiz_stderr.log
stopasgroup = true
5 changes: 5 additions & 0 deletions supervisor/conf.d/random_walk_vert.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[program:random_walk_vert]
command = /usr/bin/env python3 -m caproto.ioc_examples.random_walk -v --interfaces=0.0.0.0 --prefix="random_walk:vert-"
stdout_logfile = /tmp/random_walk_vert_stdout.log
stderr_logfile = /tmp/random_walk_vert_stderr.log
stopasgroup = true

0 comments on commit 6e21335

Please sign in to comment.