afm: Optionally return stepper_approach data with `record_data`
authorW. Trevor King <wking@tremily.us>
Sat, 19 Jan 2013 03:54:49 +0000 (22:54 -0500)
committerW. Trevor King <wking@tremily.us>
Sat, 19 Jan 2013 03:54:49 +0000 (22:54 -0500)
Sometimes these approach curves are pretty funky, so I'll start
recording them by default in calibcant-calibrate.py.

pyafm/afm.py

index 60741c63590615959b471298d7d041aa4dc3c368..e76b1181fd016c89ecb980a78243ba94a833a352 100644 (file)
@@ -460,10 +460,11 @@ class AFM (object):
         _LOG.warn(e)
         raise e
 
-    def stepper_approach(self, target_deflection):
+    def stepper_approach(self, target_deflection, record_data=None):
         _LOG.info('approach with stepper until deflection > {}'.format(
                 target_deflection))
-        record_data = _package_config['matplotlib']
+        if record_data is None:
+            record_data = _package_config['matplotlib']
         if record_data:
             position = []
             deflection = []
@@ -490,6 +491,8 @@ class AFM (object):
                 figure.show()
             if not _matplotlib.is_interactive():
                 _matplotlib_pyplot.show()
+        if record_data:
+            return (position, deflection)
 
     def move_toward_surface(self, distance):
         """Step in approximately `distance` meters.