From: W. Trevor King Date: Mon, 14 Jun 2010 14:08:21 +0000 (-0400) Subject: Avoid possible negative p[2] values in SurfacePositionModel. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7e36ee956a4829951b07b4da777cf58235630af2;p=hooke.git Avoid possible negative p[2] values in SurfacePositionModel. --- diff --git a/hooke/plugin/vclamp.py b/hooke/plugin/vclamp.py index c57c11a..0dfaeab 100644 --- a/hooke/plugin/vclamp.py +++ b/hooke/plugin/vclamp.py @@ -97,7 +97,7 @@ class SurfacePositionModel (ModelFitter): if self.info.get('force zero non-contact slope', None) == True: p = list(p) p.append(0.) # restore the non-contact slope parameter - r2 = numpy.round(p[2]) + r2 = numpy.round(abs(p[2])) if r2 >= 1: self._model_data[:r2] = p[0] + p[1] * numpy.arange(r2) if r2 < len(self._data)-1: @@ -165,6 +165,7 @@ class SurfacePositionModel (ModelFitter): def fit(self, *args, **kwargs): self.info['guessed contact slope'] = None params = super(SurfacePositionModel, self).fit(*args, **kwargs) + params[2] = abs(params[2]) if self.info.get('force zero non-contact slope', None) == True: params = list(params) params.append(0.) # restore the non-contact slope parameter