From: W. Trevor King Date: Fri, 5 Nov 2010 17:30:08 +0000 (-0700) Subject: ModelFitter.fit() should always return a list (even for single-parameter fits). X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9ef4026c67a8b895175b1feb46d8c823da74dea2;p=sawsim.git ModelFitter.fit() should always return a list (even for single-parameter fits). --- 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 = {