From 74f7155b2ce5efeffedddf3563c98c8d14a49eb9 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 2 Jun 2010 01:25:52 -0400 Subject: [PATCH] Fixups in hooke.plugin.vclamp parameter guess and check. * guessing adjusted for +deflection for +tension. * checking adjusted for left-contact and possibly negative slopes. * added details to 'Too far' version of PoorFit. --- hooke/plugin/vclamp.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hooke/plugin/vclamp.py b/hooke/plugin/vclamp.py index 2ab0372..b83d5de 100644 --- a/hooke/plugin/vclamp.py +++ b/hooke/plugin/vclamp.py @@ -126,9 +126,9 @@ class SurfacePositionModel (ModelFitter): produces the maximum deflection at the left-most point, and the final (non-contact) slope (:math:`p_3`) is zero. """ - left_offset = self.info['max deflection'] - left_slope = 2*(-self.info['deflection range'] - /self.info['position range']) + left_offset = self.info['min deflection'] + left_slope = 2*(self.info['deflection range'] + /self.info['position range']) kink_position = (self.info['max position'] +self.info['min position'])/2.0 right_slope = 0 @@ -182,8 +182,9 @@ class SurfacePositionModel (ModelFitter): % (params[2], self.info['max position']-0.02*self.info['position range'])) if (self.info['guessed contact slope'] != None - and params[3] < 0.5 * self.info['guessed contact slope']): - raise PoorFit('Too far') + and abs(params[1]) < 0.5 * abs(self.info['guessed contact slope'])): + raise PoorFit('Too far (contact slope %g, but expected ~%g' + % (params[3], self.info['guessed contact slope'])) return params class VelocityClampPlugin (Builtin): -- 2.26.2