From: W. Trevor King Date: Wed, 2 Jun 2010 05:25:52 +0000 (-0400) Subject: Fixups in hooke.plugin.vclamp parameter guess and check. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=74f7155b2ce5efeffedddf3563c98c8d14a49eb9;p=hooke.git 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. --- 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):