Adjust surface parameter guessing to be resilient to off-surface bumps.
authorW. Trevor King <wking@drexel.edu>
Fri, 30 Sep 2011 19:52:53 +0000 (15:52 -0400)
committerW. Trevor King <wking@drexel.edu>
Fri, 30 Sep 2011 19:55:17 +0000 (15:55 -0400)
Not that these should happen, but if they do they shouldn't crash the
calibration.

calibcant/bump_analyze.py

index 9f5412e7ae54b1f64d941142844b617127149ef3..5890f70f4d02de9e8c8b0bb97c2ac625fae24bdf 100644 (file)
@@ -280,9 +280,8 @@ def limited_linear_param_guess(x, y):
     i_high = i
     x_contact = float(x[i_low])
     x_high = float(x[i_high])
-    if x_high == x_contact:
-        x.tofile('x-bad.dat', sep='\n')
-        y.tofile('y-bad.dat', sep='\n')
+    if x_high == x_contact:  # things must be pretty flat
+        x_contact = (x_contact + x[0]) / 2
     slope = (y_high - y_contact) / (x_high - x_contact)
     return (x_contact, y_contact, slope)