From d60866d06dce01cd693778828edaa7a8d599238f Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 23 Jan 2012 15:02:10 -0500 Subject: [PATCH] Add min_slope_ratio argument to AFM.move_just_onto_surface. To match the following calibcant commit: commit 7c934e1f5f0838a42a7a0b1d5a392e3f0686e1c4 Author: W. Trevor King Date: Mon Jan 23 14:41:10 2012 -0500 Add min-slope-ratio option to BumpConfig. --- pyafm/afm.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/pyafm/afm.py b/pyafm/afm.py index d99835e..92c0679 100644 --- a/pyafm/afm.py +++ b/pyafm/afm.py @@ -62,7 +62,8 @@ class AFM (object): if hasattr(self.temperature, 'get_temperature'): return self.temperature.get_temperature() - def move_just_onto_surface(self, depth=-50e-9, setpoint=2, far=200): + def move_just_onto_surface(self, depth=-50e-9, setpoint=2, + min_slope_ratio=10, far=200): """Position the AFM tip close to the surface. Uses `.piezo.get_surface_position()` to pinpoint the position @@ -92,15 +93,18 @@ class AFM (object): _LOG.debug("see if we're starting near the surface") try: pos = self.piezo.get_surface_position( - axis_name=self.axis_name, max_deflection=target_def) + axis_name=self.axis_name, max_deflection=target_def, + min_slope_ratio=min_slope_ratio) except _FlatFit, e: _LOG.info(e) pos = self._stepper_approach_again( - target_deflection=target_def, far=far) + target_deflection=target_def, min_slope_ratio=min_slope_ratio, + far=far) except _SurfaceError, e: _LOG.info(e) pos = self._stepper_approach_again( - target_deflection=target_def, far=far) + target_deflection=target_def, min_slope_ratio=min_slope_ratio, + far=far) pos_m = _convert_bits_to_meters(axis.config, pos) _LOG.debug('located surface at stepper %d, piezo %d (%g m)' @@ -112,7 +116,8 @@ class AFM (object): self.stepper.step_relative(-1, backlash_safe=True) try: pos = self.piezo.get_surface_position( - axis_name=self.axis_name, max_deflection=target_def) + axis_name=self.axis_name, max_deflection=target_def, + min_slope_ratio=min_slope_ratio) except _FlatFit, e: _LOG.debug(e) continue @@ -124,7 +129,8 @@ class AFM (object): self.stepper.step_relative(1) try: pos = self.piezo.get_surface_position( - axis_name=self.axis_name, max_deflection=target_def) + axis_name=self.axis_name, max_deflection=target_def, + min_slope_ratio=min_slope_ratio) except _FlatFit, e: _LOG.debug(e) continue @@ -143,7 +149,7 @@ class AFM (object): % (depth, self.stepper.position, target, target_m)) - def _stepper_approach_again(self, target_deflection, far): + def _stepper_approach_again(self, target_deflection, min_slope_ratio, far): _LOG.info('back off %d half steps and approach until deflection > %g' % (far, target_deflection)) # back away @@ -154,7 +160,8 @@ class AFM (object): 'additional surface location attempt (stepping backwards)') try: pos = self.piezo.get_surface_position( - axis_name=self.axis_name, max_deflection=target_deflection) + axis_name=self.axis_name, max_deflection=target_deflection, + min_slope_position=min_slope_postion) return pos except _SurfaceError, e: _LOG.info(e) -- 2.26.2