[SciPy-user] non linear optimisation

David Huard david.huard@gmail....
Tue Jun 12 08:19:39 CDT 2007


Ramon,

If you want to calibrate all curves and parameters at once, my suggestion
would be to create a unique function with all the parameters, shared and
not.

Let's say you have
y1 = f1(x1,a,b,c,r1,s1)
y2 = f2(x2,a,b,c,r2,s2)
...
yn = fn(xn,a,b,c,rn,sn)
where a,b,c are the shared parameters, ri,si the individual parameters and
xi,yi the experimental data sets.

write a function
def residuals(a,b,c,r1,...rn, s1,...sn):
    z1 = y1 - f1(x1,a,b,c,r1,s1)
    z2 = y2 - f1(x2,a,b,c,r2,s2)
    ...
    zn = yn - fn(xn,a,b,c,rn,sn)

    sum zi**2 for all i
    return the sum of the zs

 and minimize the residuals with respect to the parameters using
optimize.fmin or the like.

Cheers,

David


2007/6/11, william ratcliff <william.ratcliff@gmail.com>:
>
> lorentz.sourceforge.net/
>
> :>
>
> I'll have to try this :>
>
> On 6/11/07, Christian K <ckkart@hoc.net> wrote:
> >
> > Ramon Crehuet wrote:
> > > Dear all,
> > >     I have a problem of non-linear optimisation (see below for a
> > > experimental description). I have many experimental curves (x,y) and
> > > want to fit the points to a non-linear function y=f(x; a,b,c...),
> > where
> > > a,b,c... are the parameters. I know how to do that. But the tricky
> > thing
> > > is that some parameters should be the same for all the curves, and
> > some
> > > are different for each curve, and I don't know if there is any module
> > > that can help me in doing this non-linear fit of *all* the curves at
> > the
> > > same time.
> > >     For the experimental scientists, I will say that these curves
> > > correspond to absorption spectra for the same compound in different
> > > solvents. The model curve f(x; a,b,c...) has some parameters that
> > depend
> > > on the solvent and others that depend only on the compound, and thus,
> > > should be the same for all the spectra.
> >
> > Isn't it sufficient to determine the parameters corresponding to the
> > absorption
> > peak that is apparent in all spectra once and then hold those parameters
> > fixed
> > when ftting the other ones? Generally I would reccomend peak-o-mat
> > (http://lorentz/sf/net) for peak fitting.  It allows to define
> > parameters as
> > fixed though it cannot fit many spectra at once like you want to do.
> >
> > Christian
> >
> > _______________________________________________
> > SciPy-user mailing list
> > SciPy-user@scipy.org
> > http://projects.scipy.org/mailman/listinfo/scipy-user
> >
>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20070612/86f83d12/attachment-0001.html 


More information about the SciPy-user mailing list