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=b65044d5b8c77b9cda151fb57935102e4cb8c618;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: