From ed1cfed3df5ddd669a4250df23f387ae518fb2c9 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 30 Sep 2011 15:52:53 -0400 Subject: [PATCH] Adjust surface parameter guessing to be resilient to off-surface bumps. Not that these should happen, but if they do they shouldn't crash the calibration. --- calibcant/bump_analyze.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/calibcant/bump_analyze.py b/calibcant/bump_analyze.py index 9f5412e..5890f70 100644 --- a/calibcant/bump_analyze.py +++ b/calibcant/bump_analyze.py @@ -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) -- 2.26.2