[SciPy-User] fitting data

Emmanuelle Gouillart emmanuelle.gouillart@normalesup....
Thu Jul 30 02:08:27 CDT 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__

	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.



More information about the SciPy-User mailing list