Don't cast extreme values to ints in analyze_surface_position_data().
[pypiezo.git] / pypiezo / surface.py
index 7d7f8b554089c37fc3b26d118e5391e6a45a3c05..f038de437938b517294afa1b85499f2858bd6507 100644 (file)
@@ -174,17 +174,17 @@ def analyze_surface_position_data(
     #   = p0 + p1 p2 + p3 (x-p2)   for x >= p2
     dump_before_index = 0 # 25 # HACK!!
     # Generate a reasonable guess...
-    start_pos = int(data['z'].min())
-    final_pos = int(data['z'].max())
+    start_pos = data['z'].min()
+    final_pos = data['z'].max()
     if final_pos == start_pos:
         raise SurfaceError()
-    start_def = int(data['deflection'].min())
-    final_def = int(data['deflection'].max())
+    start_def = data['deflection'].min()
+    final_def = data['deflection'].max()
     # start_def and start_pos are probably for 2 different points
-    _LOG.info('min deflection %d, max deflection %d'
-               % (start_def, final_def))
-    _LOG.info('min position %d, max position %d'
-               % (start_pos, final_pos))
+    _LOG.info('min deflection {}, max deflection {}'.format(
+            start_def, final_def))
+    _LOG.info('min position {}, max position {}'.format(
+            start_pos, final_pos))
 
     left_offset   = start_def
     left_slope    = 0