[SciPy-user] lsq problem
Gael Varoquaux
gael.varoquaux at normalesup.org
Thu Feb 15 01:54:59 EST 2007
Hi Tommy,
Maybe the cookook example at http://scipy.org/Cookbook/FittingData can
help you.
Gaël
On Wed, Feb 14, 2007 at 09:16:50PM -0500, Tommy Grav wrote:
> I need to fit a gaussian profile to a set of points and would like to
> use scipy (or numpy) to
> do the least square fitting if possible. I am however unsure if the
> proper routines are
> available, so I thought I would ask to get some hints to get going in
> the right direction.
> The input are two 1-dimensional arrays x and flux, together with a
> function
> def Gaussian(a,b,c,x1):
> return a*exp(-(pow(x1,2)/pow(c,2))) - c
> I would like to find the values of (a,b,c), such that the difference
> between the gaussian
> and fluxes are minimalized. Would scipy.linalg.lstsq be the right
> function to use, or is this
> problem not linear? (I know I could find out this particular problem
> with a little research, but
> I am under a little time pressure and I can not for the life of me
> remember my old math
> classes). If the problem is not linear, is there another function
> that can be used or do I have
> to code up my own lstsq function to solve the problem?
> Thanks in advance for any hints to the answers.
> Cheers
> Tommy
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
--
Gael Varoquaux,
Groupe d'optique atomique,
Laboratoire Charles Fabry de l'Institut d'Optique
Campus Polytechnique, RD 128
91127 Palaiseau cedex FRANCE
!!!! NEW Phone number !!!!
Tel : 33 (0) 1 64 53 33 49 - Fax : 33 (0) 1 64 53 31 01
Labs: 33 (0) 1 64 53 33 63 - 33 (0) 1 64 53 33 62
More information about the SciPy-User
mailing list