Skip to content

Commit

Permalink
Merge pull request #78 from ZLLentz/control-arg
Browse files Browse the repository at this point in the history
MNT: Allow Controls Arg to Accept PseudoPositioners
  • Loading branch information
ZLLentz authored Aug 29, 2020
2 parents 9a88fa8 + 7f78e20 commit eb30cca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pcdsdaq/daq.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,10 @@ def _ctrl_arg(self, controls):
val = device.position
except AttributeError:
val = device.get()
try:
val = val[0]
except Exception:
pass
ctrl_arg.append((name, val))
return ctrl_arg

Expand Down
9 changes: 9 additions & 0 deletions pcdsdaq/sim/pydaq.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import numbers
import time
import threading
import logging
Expand Down Expand Up @@ -92,6 +93,14 @@ def configure(self, *, record=False, key=0, events=None, l1t_events=None,
raise RuntimeError('configure requires events or duration')
else:
self._duration = dur
if controls is not None:
for name, value in controls:
if not isinstance(name, str):
raise RuntimeError('Expected a string name, got '
f'{name}')
if not isinstance(value, numbers.Number):
raise RuntimeError('Expected a numeric position, got '
f'{value}')

def begin(self, *, events=None, l1t_events=None, l3t_events=None,
duration=None, controls=None, monitors=None):
Expand Down

0 comments on commit eb30cca

Please sign in to comment.