Add `steps` and `sleep` options to `move_just_onto_surface()`.
authorW. Trevor King <wking@drexel.edu>
Thu, 15 Mar 2012 11:39:52 +0000 (07:39 -0400)
committerW. Trevor King <wking@drexel.edu>
Thu, 15 Mar 2012 11:39:52 +0000 (07:39 -0400)
This takes advantage of yesterday's pypiezo commit:

  commit b66d6dbcb8cd381cf7515a42ab0aee4a4841beb3
  Author: W. Trevor King <wking@drexel.edu>
  Date:   Wed Mar 14 16:18:23 2012 -0400

    Add `steps` and `sleep` options for gentler `jump()`s.

and I've bumped the minimum pypiezo version accordingly.

When I was running some calibrations yesterday, I could hear the piezo
clicking, and after the calibration the deflection was shifted half a
volt or so from the initial deflection.  I attribute this to the
violent piezo jumps shaking the cantilever chip from its original
position.  The wimpy spring-loaded wire clips used in the MultiMode
fluid cells probably aren't helping any either ;).

pyafm/afm.py
setup.py

index fdacc81a38931aa39f9267608fafd195c22359a6..284349aaa0aedbff07b5dfdf2a6b84aada4ef8b1 100644 (file)
@@ -63,7 +63,8 @@ class AFM (object):
             return self.temperature.get_temperature()
 
     def move_just_onto_surface(self, depth=-50e-9, setpoint=2,
-                               min_slope_ratio=10, far=200):
+                               min_slope_ratio=10, far=200, steps=20,
+                               sleep=0.0001):
         """Position the AFM tip close to the surface.
 
         Uses `.piezo.get_surface_position()` to pinpoint the position
@@ -90,7 +91,8 @@ class AFM (object):
         self._check_target_deflection(deflection=target_def)
 
         _LOG.debug('zero the %s piezo output' % self.axis_name)
-        self.piezo.jump(axis_name=self.axis_name, position=zero)
+        self.piezo.jump(
+            axis_name=self.axis_name, position=zero, steps=steps, sleep=sleep)
 
         _LOG.debug("see if we're starting near the surface")
         try:
@@ -144,7 +146,7 @@ class AFM (object):
                   % self.axis_name)
         target_m = pos_m + depth
         target = _convert_meters_to_bits(axis.config, target_m)
-        self.piezo.jump(self.axis_name, target)
+        self.piezo.jump(self.axis_name, target, steps=steps, sleep=sleep)
 
         _LOG.debug(
             'positioned %g m into the surface at stepper %d, piezo %d (%g m)'
index 01b7e52d9432766064285fa904bea1a5e54da4d3..89fb172049a4cd8cccf5bb5ef2b9e4b8ac0ce038 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -36,5 +36,5 @@ setup(name=package_name,
       classifiers=filter(None, classifiers.split('\n')),
       packages=['pyafm'],
       provides=['pyafm (%s)' % __version__],
-      requires=['pypiezo (>= 0.4)'],
+      requires=['pypiezo (>= 0.6)'],
       )