Replace AFM.main_axis with AFM.config['main-axis'].
authorW. Trevor King <wking@drexel.edu>
Fri, 16 Mar 2012 02:50:11 +0000 (22:50 -0400)
committerW. Trevor King <wking@drexel.edu>
Fri, 16 Mar 2012 02:50:11 +0000 (22:50 -0400)
pyafm/afm.py

index a6760c8bcec8030223c716605699f716f6e284d9..e6d7fb5fe1471c774a8576bd5c8ddce81e3b117a 100644 (file)
@@ -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: