Fix problems with the transition to the new nested-Config h5config package.
[calibcant.git] / calibcant / bump_analyze.py
index ab745b812db66439353bada260fd8744e72d0bb6..9f5412e7ae54b1f64d941142844b617127149ef3 100644 (file)
@@ -87,6 +87,8 @@ measured slope `Vphoto/Vout` is converted to `photo_sensitivity` with
       /bump/config/bump
         <HDF5 dataset "far-steps": shape (), type "<i4">
           200
+        <HDF5 dataset "initial-position": shape (), type "<f8">
+          -5e-08
         <HDF5 dataset "model": shape (), type "|S9">
           quadratic
         <HDF5 dataset "push-depth": shape (), type "<f8">
@@ -278,6 +280,9 @@ 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')
     slope = (y_high - y_contact) / (x_high - x_contact)
     return (x_contact, y_contact, slope)
 
@@ -368,7 +373,7 @@ def bump_fit(z, deflection, high_voltage_rail,
         _LOG.debug('solution converged')
     else:
         _LOG.debug('solution did not converge')
-    if plot or _package_config['matplotlib'] or True:
+    if plot or _package_config['matplotlib']:
         yguess = model(z, param_guess, high_voltage_rail=high_voltage_rail)
         yfit = model(z, p, high_voltage_rail=high_voltage_rail)
         bump_plot({'z': z, 'deflection': deflection}, yguess=yguess, yfit=yfit)
@@ -422,7 +427,7 @@ def bump_load(filename, group='/'):
                     filename=filename, group=group+key))
             configs.append(config)
         try:
-            processed_bump = f[group+'processed'][...]
+            processed_bump = float(f[group+'processed'][...])
         except KeyError:
             pass
     ret = [raw_bump]