From 7d5323313891768160eceee7445abeab0687a1ea Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 30 Mar 2012 08:16:03 -0400 Subject: [PATCH] Don't cast extreme values to ints in analyze_surface_position_data(). Without the cast, we can also use this function to fit floating point data, where the deflection and offset ranges are less than one (e.g. nanometer sized sweeps stored in meters). --- pypiezo/surface.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pypiezo/surface.py b/pypiezo/surface.py index 7d7f8b5..f038de4 100644 --- a/pypiezo/surface.py +++ b/pypiezo/surface.py @@ -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 -- 2.26.2