projects
/
pypiezo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
57eb7bc
)
Add `steps` and `sleep` options for gentler `jump()`s.
author
W. Trevor King
<wking@drexel.edu>
Wed, 14 Mar 2012 20:18:23 +0000
(16:18 -0400)
committer
W. Trevor King
<wking@drexel.edu>
Wed, 14 Mar 2012 20:18:23 +0000
(16:18 -0400)
pypiezo/base.py
patch
|
blob
|
history
diff --git
a/pypiezo/base.py
b/pypiezo/base.py
index c74c8761df93ebef8cd3d042217543446a914a61..8594646b0b1de149ea79f82552c40a993b12c37b 100644
(file)
--- a/
pypiezo/base.py
+++ b/
pypiezo/base.py
@@
-516,9
+516,15
@@
class Piezo (object):
_LOG.debug('current position: %s' % ret)
return ret
_LOG.debug('current position: %s' % ret)
return ret
- def jump(self, axis_name, position):
+ def jump(self, axis_name, position
, steps=1, sleep=None
):
"Move the output named `axis_name` to `position`."
"Move the output named `axis_name` to `position`."
- _LOG.debug('jump %s to %s' % (axis_name, position))
+ _LOG.debug('jump %s to %s in %d steps' % (axis_name, position, steps))
+ if steps > 1:
+ orig_pos = self.last_output[axis_name]
+ for pos in _numpy.linspace(orig_pos, position, steps+1)[1:]:
+ self.jump(axis_name=axis_name, position=pos)
+ if sleep:
+ _sleep(sleep)
position = int(position)
channel = self.channel_by_name(name=axis_name)
channel.data_write(position)
position = int(position)
channel = self.channel_by_name(name=axis_name)
channel.data_write(position)