From 9ef4026c67a8b895175b1feb46d8c823da74dea2 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 5 Nov 2010 10:30:08 -0700 Subject: [PATCH] ModelFitter.fit() should always return a list (even for single-parameter fits). --- pysawsim/fit.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pysawsim/fit.py b/pysawsim/fit.py index 377d983..6b325da 100755 --- a/pysawsim/fit.py +++ b/pysawsim/fit.py @@ -265,13 +265,11 @@ class ModelFitter (object): params,cov,info,mesg,ier = leastsq( func=self.residual, x0=active_params, full_output=True, diag=scale, **kwargs) + if len(initial_params) == 1: + params = [params] if self._rescale == True: active_params = params - 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)] + params = [p*s for p,s in zip(params, self._param_scale_factors)] else: active_params = params self.fit_info = { -- 2.26.2