[SciPy-user] Re: SciPy-user Digest, Vol 22, Issue 3
elcorto at gmx.net
Tue Jun 28 07:23:45 CDT 2005
or you can use mpfit for constrained optimization which is a (quite
fast) pure Python implementation of MINPACK's LMFIT routine.
http://cars9.uchicago.edu/software/python/index.html -> mpfit.py
I did some little bugfixes in this code (see attachment) and used it for
some time without problems.
Christian Kristukat wrote:
> aurelien.gourrier at free.fr wrote:
>> Hi all,
>> Can anyone tell me if there is a possibility to use constraints on the
>> method ? I need to do some bounded minimization of gaussians or
>> lorentzians on
>> 1-D data and couldn't find any way out so far...
> One method I'm using to add simple bounds is to map the parameters to
> some limits before calculating the residuals.
> def residuals(a):
> # mapping +/-inf to +/-1
> t = a/(abs(a)+1.0)
> # amin/amax are 1D arrays containing the bounds
> # map -1/+1 to amin/amax
> a = (amin+amax)/2.0+(amax-amin)/2.0*t
> # avealuate the function
> newy = func(a)
> return y-newy
> Regards, Christian
> SciPy-user mailing list
> SciPy-user at scipy.net
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 91220 bytes
Desc: not available
Url : http://www.scipy.net/pipermail/scipy-user/attachments/20050628/0f8a11f9/mpfit-0001.py
More information about the SciPy-user