Don't plot missing surface detection regions in analyze_surface_position_data.
authorW. Trevor King <wking@tremily.us>
Sun, 19 Aug 2012 21:42:08 +0000 (17:42 -0400)
committerW. Trevor King <wking@tremily.us>
Sun, 19 Aug 2012 21:42:11 +0000 (17:42 -0400)
This allows us to use the surface-matplotlib option to debug the
surface-position algorithm even when it's used on phony data that only
contains 'approach'.

pypiezo/surface.py

index 4cea70d0c71e19d2232fd1526700079c4f245fc8..be696f4fbde4405ccd825ecac34ff5ac670b5ca8 100644 (file)
@@ -222,7 +222,8 @@ def analyze_surface_position_data(
                        ('ret2', 'second retract'),
                        ('approach', 'main approach'),
                        ('ret3', 'return to start')]:
-            axes.plot(ddict[n]['z'], ddict[n]['deflection'], label=name)
+            if n in ddict:
+                axes.plot(ddict[n]['z'], ddict[n]['deflection'], label=name)
         def fit_fn(x, params):
             if x <= params[2]:
                 return params[0] + params[1]*x