From: W. Trevor King Date: Fri, 16 Mar 2012 02:50:11 +0000 (-0400) Subject: Replace AFM.main_axis with AFM.config['main-axis']. X-Git-Tag: v0.4~16 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=94256043726726c8cec689de589505029c5f9d0e;p=pyafm.git Replace AFM.main_axis with AFM.config['main-axis']. --- diff --git a/pyafm/afm.py b/pyafm/afm.py index a6760c8..e6d7fb5 100644 --- a/pyafm/afm.py +++ b/pyafm/afm.py @@ -339,21 +339,22 @@ class AFM (object): stepper_tolerance = 2*self.stepper.step_size - axis = self.piezo.axis_by_name(self.axis_name) + axis = self.piezo.axis_by_name(self.config['main-axis']) def_config = self.piezo.config.select_config('inputs', 'deflection') zero = _convert_volts_to_bits(axis.config['channel'], 0) target_def = _convert_volts_to_bits(def_config, setpoint) self._check_target_deflection(deflection=target_def) - _LOG.debug('zero the %s piezo output' % self.axis_name) + _LOG.debug('zero the %s piezo output' % self.config['main-axis']) self.piezo.jump( - axis_name=self.axis_name, position=zero, steps=steps, sleep=sleep) + axis_name=self.config['main-axis'], position=zero, steps=steps, + sleep=sleep) _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.config['main-axis'], max_deflection=target_def, min_slope_ratio=min_slope_ratio) except _FlatFit, e: _LOG.info(e) @@ -376,7 +377,8 @@ class AFM (object): self.stepper.single_step(-1) try: pos = self.piezo.get_surface_position( - axis_name=self.axis_name, max_deflection=target_def, + axis_name=self.config['main-axis'], + max_deflection=target_def, min_slope_ratio=min_slope_ratio) except _FlatFit, e: _LOG.debug(e) @@ -389,7 +391,8 @@ class AFM (object): self.stepper.single_step(1) try: pos = self.piezo.get_surface_position( - axis_name=self.axis_name, max_deflection=target_def, + axis_name=self.config['main-axis'], + max_deflection=target_def, min_slope_ratio=min_slope_ratio) except _FlatFit, e: _LOG.debug(e) @@ -399,10 +402,11 @@ class AFM (object): % (self.stepper.position, pos, pos_m)) _LOG.debug('adjust the %s piezo to place us just onto the surface' - % self.axis_name) + % self.config['main-axis']) target_m = pos_m + depth target = _convert_meters_to_bits(axis.config, target_m) - self.piezo.jump(self.axis_name, target, steps=steps, sleep=sleep) + self.piezo.jump( + self.config['main-axis'], target, steps=steps, sleep=sleep) _LOG.debug( 'positioned %g m into the surface at stepper %d, piezo %d (%g m)' @@ -433,7 +437,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.config['main-axis'], + max_deflection=target_deflection, min_slope_ratio=min_slope_ratio) return pos except _SurfaceError, e: