vibration_analyze.py: Don't use the peak power for D_guess
[calibcant.git] / calibcant / bump_analyze.py
index 140add37fc05485bf6670751998e8265f23b00bd..d5e0f9cc8bbe6ca7160d4eddfd7f05f3b75a3438 100644 (file)
@@ -234,6 +234,8 @@ def limited_linear_param_guess(x, y):
     x_high = float(x[i_high])
     if x_high == x_contact:  # things must be pretty flat
         x_contact = (x_contact + x[0]) / 2
+    if x_high == x_contact:
+        x_high = x[1]
     slope = (y_high - y_contact) / (x_high - x_contact)
     return (x_contact, y_contact, slope)
 
@@ -320,7 +322,7 @@ def fit(z, deflection, high_voltage_rail,
     except ValueError:
         zd = _numpy.ndarray(list(z.shape) + [2], dtype=z.dtype)
         zd[:,0] = z
-        zd[:,1] = d
+        zd[:,1] = deflection
         _numpy.savetxt('/tmp/z-deflection.dat', zd, delimiter='\t')
         raise
     _LOG.debug('fitted params: %s' % p)