[SciPy-User] fitting data

Emmanuelle Gouillart emmanuelle.gouillart at normalesup.org
Thu Jul 30 03:08:27 EDT 2009


> from scipy import optimize
> def func(x,a): return a * fb(x) + (1-a) fo(x)
> fitp,cov=optimize.curve_fit(func,x,p)

	There is no optimize.curve_fit im my version scipy:
>>> from scipy import optimize
>>> help optimize.curve_fit
--> help(optimize.curve_fit)
------------------------------------------------------------
Traceback (most recent call last):
  File "<ipython console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'curve_fit'
>>> import scipy
>>> scipy.__version__
'0.7.0'

	Am I missing something?

	Bala, one of the classical solutions is to use
scipy.optimize.leastsq; there is a whole page on the scipy Cookbook
dedicated to fitting problems http://www.scipy.org/Cookbook/FittingData.
The page provides many examples of how to use leastsq for fitting data.

	Cheers,

	Emmanuelle



More information about the SciPy-User mailing list