From: W. Trevor King Date: Wed, 4 Aug 2010 15:53:33 +0000 (-0400) Subject: Fix single-parameter rescaling in hooke.util.fit.ModelFitter X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=eb506c1fb4282b43b8b04ea36492f9f3d1c17d50;p=hooke.git Fix single-parameter rescaling in hooke.util.fit.ModelFitter --- diff --git a/hooke/util/fit.py b/hooke/util/fit.py index aaa1ee4..4ae0e18 100644 --- a/hooke/util/fit.py +++ b/hooke/util/fit.py @@ -84,7 +84,7 @@ class ModelFitter (object): >>> m = LinearModel(data) >>> outqueue = Queue() >>> slope,offset = m.fit(outqueue=outqueue) - >>> info = outqueue.get() + >>> info = outqueue.get(block=False) >>> pprint(info) # doctest: +ELLIPSIS, +REPORT_UDIFF {'active fitted parameters': array([ 6.999..., -32.889...]), 'active parameters': array([ 6.999..., -32.889...]), @@ -194,7 +194,11 @@ class ModelFitter (object): diag=active_scale, **kwargs) if self._rescale == True: active_params = params - params = [p*s for p,s in zip(params, self._param_scale_factors)] + if len(initial_params) == 1: # params is a float + params = params * self._param_scale_factors[0] + else: + params = [p*s for p,s in zip(params, + self._param_scale_factors)] else: active_params = params if outqueue != None: