[SciPy-User] forcing curve fit

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

[SciPy-User] forcing curve fit

Gabriele Brambilla
Hi,

is it possible to force curve_fit to search the values for the best fit parameters in a certain interval of values?

Because I have a fit routine that returns to me a lot of good curves but sometimes returns to me a curve with an amplitude that is 100, 1000 times smaller!

thanks

Gabriele

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: forcing curve fit

Michael Sarahan
The word that you are looking for is "constraint."  Here's a Stack Overflow post for you: http://stackoverflow.com/questions/16541171/how-do-i-put-a-constraint-on-scipy-curve-fit

HTH,
Mike


On Fri, May 9, 2014 at 7:33 AM, Gabriele Brambilla <[hidden email]> wrote:
Hi,

is it possible to force curve_fit to search the values for the best fit parameters in a certain interval of values?

Because I have a fit routine that returns to me a lot of good curves but sometimes returns to me a curve with an amplitude that is 100, 1000 times smaller!

thanks

Gabriele

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: forcing curve fit

Sturla Molden-3
In reply to this post by Gabriele Brambilla
It sounds like you need scipy.optimize.minimize with method SLSQP.

Sturla

Gabriele Brambilla <[hidden email]> wrote:

> Hi,
>
> is it possible to force curve_fit to search the values for the best fit
> parameters in a certain interval of values?
>
> Because I have a fit routine that returns to me a lot of good curves but
> sometimes returns to me a curve with an amplitude that is 100, 1000 times
> smaller!
>
> thanks
>
> Gabriele
>
> _______________________________________________
> SciPy-User mailing list
> [hidden email]
> <a
> href="http://mail.scipy.org/mailman/listinfo/scipy-user">http://mail.scipy.org/mailman/listinfo/scipy-user</a>

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: forcing curve fit

Matt Newville
In reply to this post by Gabriele Brambilla
Gabriele,


On Fri, May 9, 2014 at 9:33 AM, Gabriele Brambilla <[hidden email]> wrote:
Hi,

is it possible to force curve_fit to search the values for the best fit parameters in a certain interval of values?

Because I have a fit routine that returns to me a lot of good curves but sometimes returns to me a curve with an amplitude that is 100, 1000 times smaller!

thanks

Gabriele

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user



You might find the lmfit library (http://lmfit.github.io/lmfit-py) useful.   This allows one to write least squares problems in terms of Parameter objects which can have bounds set on their values, be fixed, or have values written as mathematical expressions of other Parameter values.  The lmfit library also allows you to switch between minimization algorithms easily, and also explore confidence intervals in detail.

--Matt




--
--Matt Newville <newville at cars.uchicago.edu> <a href="tel:630-252-0431" value="+16302520431" target="_blank">630-252-0431

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: forcing curve fit

Thøger Emil Rivera-Thorsen
Matt, are you the aothor of lmfit?
I am using it for a project I am working on at the moment and am very
happy with it.

On Fri 09 May 2014 09:21:27 PM CEST, Matt Newville wrote:

> Gabriele,
>
>
> On Fri, May 9, 2014 at 9:33 AM, Gabriele Brambilla
> <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi,
>
>     is it possible to force curve_fit to search the values for the
>     best fit parameters in a certain interval of values?
>
>     Because I have a fit routine that returns to me a lot of good
>     curves but sometimes returns to me a curve with an amplitude that
>     is 100, 1000 times smaller!
>
>     thanks
>
>     Gabriele
>
>     _______________________________________________
>     SciPy-User mailing list
>     [hidden email] <mailto:[hidden email]>
>     http://mail.scipy.org/mailman/listinfo/scipy-user
>
>
>
> You might find the lmfit library (http://lmfit.github.io/lmfit-py)
> useful.   This allows one to write least squares problems in terms of
> Parameter objects which can have bounds set on their values, be fixed,
> or have values written as mathematical expressions of other Parameter
> values.  The lmfit library also allows you to switch between
> minimization algorithms easily, and also explore confidence intervals
> in detail.
>
> --Matt
>
>
>
>
> --
> --Matt Newville <newville at cars.uchicago.edu
> <http://cars.uchicago.edu>> 630-252-0431 <tel:630-252-0431>
>
>
> _______________________________________________
> SciPy-User mailing list
> [hidden email]
> http://mail.scipy.org/mailman/listinfo/scipy-user
_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: forcing curve fit

Matt Newville
Hi Thoger,

On Fri, May 9, 2014 at 4:02 PM, Thøger Emil Rivera-Thorsen <[hidden email]> wrote:
Matt, are you the aothor of lmfit?
I am using it for a project I am working on at the moment and am very
happy with it.

 
I am, or I think I'm the main author.   There have been many contributions, especially from Till Stensitzki (who may have written more code than I), but several others as well, and it is certainly built on many previous works (ie, scipy.optimize).  I think such a high level wrapping of scipy.optimize addresses the common needs of fitting experimental data (such as adding bounds and "frozen" parameters)  is needed, and believe that may people using curve_fit() would find it useful.  

But I also feel somewhat detached from this. It's one of several side-projects somewhat related to my main research and responsibilities.   One might view it as essentially a "scikit", and if so I might be able to kid myself that this was giving something of value back to the scipy ecosystem.  I know that's not true, but I will support lmfit to the best of my abilities for the foreseeable future.  Then again, I feel no ownership of it, and if someone is interested in contributing or taking over, I'd be happy to help and encourage as much as I can.
 
Anyway, I'm very glad to hear you're happy with it.

--Matt Newville


_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: forcing curve fit

Yuxiang Wang
Hi Matt,

Thank you for the great contribution! I have a quick question - does
lmfit scale the parameters by its initial values? For example, a
parameter maybe on the order of 1e-13, and during the fit we would
like to scale that number to 1 so it is easier to converge to an
optimum.

-Shawn

On Fri, May 9, 2014 at 8:37 PM, Matt Newville
<[hidden email]> wrote:

> Hi Thoger,
>
>
> On Fri, May 9, 2014 at 4:02 PM, Thøger Emil Rivera-Thorsen
> <[hidden email]> wrote:
>>
>> Matt, are you the aothor of lmfit?
>> I am using it for a project I am working on at the moment and am very
>> happy with it.
>>
>
> I am, or I think I'm the main author.   There have been many contributions,
> especially from Till Stensitzki (who may have written more code than I), but
> several others as well, and it is certainly built on many previous works
> (ie, scipy.optimize).  I think such a high level wrapping of scipy.optimize
> addresses the common needs of fitting experimental data (such as adding
> bounds and "frozen" parameters)  is needed, and believe that may people
> using curve_fit() would find it useful.
>
> But I also feel somewhat detached from this. It's one of several
> side-projects somewhat related to my main research and responsibilities.
> One might view it as essentially a "scikit", and if so I might be able to
> kid myself that this was giving something of value back to the scipy
> ecosystem.  I know that's not true, but I will support lmfit to the best of
> my abilities for the foreseeable future.  Then again, I feel no ownership of
> it, and if someone is interested in contributing or taking over, I'd be
> happy to help and encourage as much as I can.
>
> Anyway, I'm very glad to hear you're happy with it.
>
> --Matt Newville
>
>
> _______________________________________________
> SciPy-User mailing list
> [hidden email]
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



--
Yuxiang "Shawn" Wang
Gerling Research Lab
University of Virginia
[hidden email]
+1 (434) 284-0836
https://sites.google.com/a/virginia.edu/yw5aj/
_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: forcing curve fit

Matt Newville


On May 10, 2014 11:37 AM, "Yuxiang Wang" <[hidden email]> wrote:
>
> Hi Matt,
>
> Thank you for the great contribution! I have a quick question - does
> lmfit scale the parameters by its initial values? For example, a
> parameter maybe on the order of 1e-13, and during the fit we would
> like to scale that number to 1 so it is easier to converge to an
> optimum.
>
> -Shawn

My understanding and experience  is that leastsq() does this internally well enough to usually not have to worry about it.   But if you know the scales differ by very many orders of magnitude,  it probably wouldn't hurt to rescale values.

>
> On Fri, May 9, 2014 at 8:37 PM, Matt Newville
> <[hidden email]> wrote:
> > Hi Thoger,
> >
> >
> > On Fri, May 9, 2014 at 4:02 PM, Thøger Emil Rivera-Thorsen
> > <[hidden email]> wrote:
> >>
> >> Matt, are you the aothor of lmfit?
> >> I am using it for a project I am working on at the moment and am very
> >> happy with it.
> >>
> >
> > I am, or I think I'm the main author.   There have been many contributions,
> > especially from Till Stensitzki (who may have written more code than I), but
> > several others as well, and it is certainly built on many previous works
> > (ie, scipy.optimize).  I think such a high level wrapping of scipy.optimize
> > addresses the common needs of fitting experimental data (such as adding
> > bounds and "frozen" parameters)  is needed, and believe that may people
> > using curve_fit() would find it useful.
> >
> > But I also feel somewhat detached from this. It's one of several
> > side-projects somewhat related to my main research and responsibilities.
> > One might view it as essentially a "scikit", and if so I might be able to
> > kid myself that this was giving something of value back to the scipy
> > ecosystem.  I know that's not true, but I will support lmfit to the best of
> > my abilities for the foreseeable future.  Then again, I feel no ownership of
> > it, and if someone is interested in contributing or taking over, I'd be
> > happy to help and encourage as much as I can.
> >
> > Anyway, I'm very glad to hear you're happy with it.
> >
> > --Matt Newville
> >
> >
> > _______________________________________________
> > SciPy-User mailing list
> > [hidden email]
> > http://mail.scipy.org/mailman/listinfo/scipy-user
> >
>
>
>
> --
> Yuxiang "Shawn" Wang
> Gerling Research Lab
> University of Virginia
> [hidden email]
> +1 (434) 284-0836
> https://sites.google.com/a/virginia.edu/yw5aj/
> _______________________________________________
> SciPy-User mailing list
> [hidden email]
> http://mail.scipy.org/mailman/listinfo/scipy-user
>


_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: forcing curve fit

ralfgommers
In reply to this post by Matt Newville



On Sat, May 10, 2014 at 2:37 AM, Matt Newville <[hidden email]> wrote:
Hi Thoger,


On Fri, May 9, 2014 at 4:02 PM, Thøger Emil Rivera-Thorsen <[hidden email]> wrote:
Matt, are you the aothor of lmfit?
I am using it for a project I am working on at the moment and am very
happy with it.

 
I am, or I think I'm the main author.   There have been many contributions, especially from Till Stensitzki (who may have written more code than I), but several others as well, and it is certainly built on many previous works (ie, scipy.optimize).  I think such a high level wrapping of scipy.optimize addresses the common needs of fitting experimental data (such as adding bounds and "frozen" parameters)  is needed, and believe that may people using curve_fit() would find it useful.  

But I also feel somewhat detached from this. It's one of several side-projects somewhat related to my main research and responsibilities.   One might view it as essentially a "scikit", and if so I might be able to kid myself that this was giving something of value back to the scipy ecosystem.  I know that's not true,

Not sure if you meant that or not, but I'm going to have to disagree anyway. Packages like lmfit, which provide regularly requested functionality and are documented and maintained well, are *very* valuable. The scientific Python ecosystem is so strong mainly because there are packages like that for almost everything one needs. A few big packages like numpy/scipy/pandas/scikit-learn could never contain all that functionality (for lots of reasons, release timing, maintainer load, etc.), we need a lot of small specialized ones.

So thank you for lmfit!

Cheers,
Ralf


but I will support lmfit to the best of my abilities for the foreseeable future.  Then again, I feel no ownership of it, and if someone is interested in contributing or taking over, I'd be happy to help and encourage as much as I can.
 
Anyway, I'm very glad to hear you're happy with it.

--Matt Newville


_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: forcing curve fit

josef.pktd



On Sun, May 11, 2014 at 4:03 AM, Ralf Gommers <[hidden email]> wrote:



On Sat, May 10, 2014 at 2:37 AM, Matt Newville <[hidden email]> wrote:
Hi Thoger,


On Fri, May 9, 2014 at 4:02 PM, Thøger Emil Rivera-Thorsen <[hidden email]> wrote:
Matt, are you the aothor of lmfit?
I am using it for a project I am working on at the moment and am very
happy with it.

 
I am, or I think I'm the main author.   There have been many contributions, especially from Till Stensitzki (who may have written more code than I), but several others as well, and it is certainly built on many previous works (ie, scipy.optimize).  I think such a high level wrapping of scipy.optimize addresses the common needs of fitting experimental data (such as adding bounds and "frozen" parameters)  is needed, and believe that may people using curve_fit() would find it useful.  

But I also feel somewhat detached from this. It's one of several side-projects somewhat related to my main research and responsibilities.   One might view it as essentially a "scikit", and if so I might be able to kid myself that this was giving something of value back to the scipy ecosystem.  I know that's not true,

Not sure if you meant that or not, but I'm going to have to disagree anyway. Packages like lmfit, which provide regularly requested functionality and are documented and maintained well, are *very* valuable. The scientific Python ecosystem is so strong mainly because there are packages like that for almost everything one needs. A few big packages like numpy/scipy/pandas/scikit-learn could never contain all that functionality (for lots of reasons, release timing, maintainer load, etc.), we need a lot of small specialized ones.

So thank you for lmfit!

I fully agree with Ralf.
And I'm glad to point to lmfit when someone asks why statsmodels doesn't have non-linear least squares.

And even when statsmodels gets nonlinear least squares, it won't have the same parameter oriented interface.

Josef

 

Cheers,
Ralf


but I will support lmfit to the best of my abilities for the foreseeable future.  Then again, I feel no ownership of it, and if someone is interested in contributing or taking over, I'd be happy to help and encourage as much as I can.
 
Anyway, I'm very glad to hear you're happy with it.

--Matt Newville


_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: forcing curve fit

Matt Newville
Hi Yuxiang, Ralf, Josef, 

Thanks for the kinds words and sorry for the rather botched expression.    I was trying to express my view of the value of the work that I added to lmfit compared to the work that it builds on (MINPACK, scipy.optimize, the whole numpy/scipy stack).   I don't really identify lmfit as a main part of my work, but I do think it's a valuable approach to fitting data. I'm happy to be able to maintain this relatively small contribution for the foreseeable future.  If someone was interested, I would be happy to pass it on.

--Matt

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: forcing curve fit

Gabriele Brambilla
In reply to this post by Matt Newville
Hi, 
I tried to install it but I receive this error:

C:\Users\Gabriele\Documents\università\TESI\code>easy_install -U lmfit
Searching for lmfit
Best match: lmfit 0.7.4
d5=121cc508575b6c9e84f50d89fe6c40d0
Processing lmfit-0.7.4.tar.gz
Writing c:\users\gabriele\appdata\local\temp\easy_install-vzljat\lmfit-0.7.4\set
up.cfg
Running lmfit-0.7.4\setup.py -q bdist_egg --dist-dir c:\users\gabriele\appdata\l
ocal\temp\easy_install-vzljat\lmfit-0.7.4\egg-dist-tmp-5uakdk
error: SandboxViolation: os.open('C:\\Users\\Gabriele\\.matplotlib\\tmp3euipt',
34242, 384) {}

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.

I am using Anaconda on Windows 7, 64bit.

thanks

Gabriele


2014-05-09 15:21 GMT-04:00 Matt Newville <[hidden email]>:
Gabriele,


On Fri, May 9, 2014 at 9:33 AM, Gabriele Brambilla <[hidden email]> wrote:
Hi,

is it possible to force curve_fit to search the values for the best fit parameters in a certain interval of values?

Because I have a fit routine that returns to me a lot of good curves but sometimes returns to me a curve with an amplitude that is 100, 1000 times smaller!

thanks

Gabriele

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user



You might find the lmfit library (http://lmfit.github.io/lmfit-py) useful.   This allows one to write least squares problems in terms of Parameter objects which can have bounds set on their values, be fixed, or have values written as mathematical expressions of other Parameter values.  The lmfit library also allows you to switch between minimization algorithms easily, and also explore confidence intervals in detail.

--Matt




--
--Matt Newville <newville at cars.uchicago.edu> <a href="tel:630-252-0431" value="+16302520431" target="_blank">630-252-0431

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: forcing curve fit

josef.pktd



On Mon, May 12, 2014 at 8:56 AM, Gabriele Brambilla <[hidden email]> wrote:
Hi, 
I tried to install it but I receive this error:

C:\Users\Gabriele\Documents\università\TESI\code>easy_install -U lmfit
Searching for lmfit
Best match: lmfit 0.7.4
d5=121cc508575b6c9e84f50d89fe6c40d0
Processing lmfit-0.7.4.tar.gz
Writing c:\users\gabriele\appdata\local\temp\easy_install-vzljat\lmfit-0.7.4\set
up.cfg
Running lmfit-0.7.4\setup.py -q bdist_egg --dist-dir c:\users\gabriele\appdata\l
ocal\temp\easy_install-vzljat\lmfit-0.7.4\egg-dist-tmp-5uakdk
error: SandboxViolation: os.open('C:\\Users\\Gabriele\\.matplotlib\\tmp3euipt',
34242, 384) {}

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.

I am using Anaconda on Windows 7, 64bit.

statsmodels has this in the beginning in the setup.py

# temporarily redirect config directory to prevent matplotlib importing
# testing that for writeable directory which results in sandbox error in
# certain easy_install versions
os.environ["MPLCONFIGDIR"] = "."


I don't remember what was triggering an import of matplotlib.



Josef
 

thanks

Gabriele


2014-05-09 15:21 GMT-04:00 Matt Newville <[hidden email]>:

Gabriele,


On Fri, May 9, 2014 at 9:33 AM, Gabriele Brambilla <[hidden email]> wrote:
Hi,

is it possible to force curve_fit to search the values for the best fit parameters in a certain interval of values?

Because I have a fit routine that returns to me a lot of good curves but sometimes returns to me a curve with an amplitude that is 100, 1000 times smaller!

thanks

Gabriele

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user



You might find the lmfit library (http://lmfit.github.io/lmfit-py) useful.   This allows one to write least squares problems in terms of Parameter objects which can have bounds set on their values, be fixed, or have values written as mathematical expressions of other Parameter values.  The lmfit library also allows you to switch between minimization algorithms easily, and also explore confidence intervals in detail.

--Matt




--
--Matt Newville <newville at cars.uchicago.edu> <a href="tel:630-252-0431" value="+16302520431" target="_blank">630-252-0431

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: forcing curve fit

Thøger Emil Rivera-Thorsen
In reply to this post by ralfgommers
What Ralph said.
lmfit has definitely halped me get some results quickly due to some nice features and, not least, its great transparency and excellent documentatioj, freeing my energy for other matters.
I do indeed think that is very valuable for the community and I have often recommended it.

On 2014-05-11 10:03, Ralf Gommers wrote:



On Sat, May 10, 2014 at 2:37 AM, Matt Newville <[hidden email]> wrote:
Hi Thoger,


On Fri, May 9, 2014 at 4:02 PM, Thøger Emil Rivera-Thorsen <[hidden email]> wrote:
Matt, are you the aothor of lmfit?
I am using it for a project I am working on at the moment and am very
happy with it.

 
I am, or I think I'm the main author.   There have been many contributions, especially from Till Stensitzki (who may have written more code than I), but several others as well, and it is certainly built on many previous works (ie, scipy.optimize).  I think such a high level wrapping of scipy.optimize addresses the common needs of fitting experimental data (such as adding bounds and "frozen" parameters)  is needed, and believe that may people using curve_fit() would find it useful.  

But I also feel somewhat detached from this. It's one of several side-projects somewhat related to my main research and responsibilities.   One might view it as essentially a "scikit", and if so I might be able to kid myself that this was giving something of value back to the scipy ecosystem.  I know that's not true,

Not sure if you meant that or not, but I'm going to have to disagree anyway. Packages like lmfit, which provide regularly requested functionality and are documented and maintained well, are *very* valuable. The scientific Python ecosystem is so strong mainly because there are packages like that for almost everything one needs. A few big packages like numpy/scipy/pandas/scikit-learn could never contain all that functionality (for lots of reasons, release timing, maintainer load, etc.), we need a lot of small specialized ones.

So thank you for lmfit!

Cheers,
Ralf


but I will support lmfit to the best of my abilities for the foreseeable future.  Then again, I feel no ownership of it, and if someone is interested in contributing or taking over, I'd be happy to help and encourage as much as I can.
 
Anyway, I'm very glad to hear you're happy with it.

--Matt Newville


_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user




_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user


-- 
--------------------------
Thøger Emil Rivera-Thorsen
Ph.D. student
Stockholm University, 
Department of Astronomy
--------------------------

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: forcing curve fit

Gabriele Brambilla
In reply to this post by josef.pktd
But so what I have to do to install it?

thanks

Gabriele


2014-05-12 9:18 GMT-04:00 <[hidden email]>:



On Mon, May 12, 2014 at 8:56 AM, Gabriele Brambilla <[hidden email]> wrote:
Hi, 
I tried to install it but I receive this error:

C:\Users\Gabriele\Documents\università\TESI\code>easy_install -U lmfit
Searching for lmfit
Best match: lmfit 0.7.4
d5=121cc508575b6c9e84f50d89fe6c40d0
Processing lmfit-0.7.4.tar.gz
Writing c:\users\gabriele\appdata\local\temp\easy_install-vzljat\lmfit-0.7.4\set
up.cfg
Running lmfit-0.7.4\setup.py -q bdist_egg --dist-dir c:\users\gabriele\appdata\l
ocal\temp\easy_install-vzljat\lmfit-0.7.4\egg-dist-tmp-5uakdk
error: SandboxViolation: os.open('C:\\Users\\Gabriele\\.matplotlib\\tmp3euipt',
34242, 384) {}

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.

I am using Anaconda on Windows 7, 64bit.

statsmodels has this in the beginning in the setup.py

# temporarily redirect config directory to prevent matplotlib importing
# testing that for writeable directory which results in sandbox error in
# certain easy_install versions
os.environ["MPLCONFIGDIR"] = "."


I don't remember what was triggering an import of matplotlib.



Josef
 

thanks

Gabriele


2014-05-09 15:21 GMT-04:00 Matt Newville <[hidden email]>:

Gabriele,


On Fri, May 9, 2014 at 9:33 AM, Gabriele Brambilla <[hidden email]> wrote:
Hi,

is it possible to force curve_fit to search the values for the best fit parameters in a certain interval of values?

Because I have a fit routine that returns to me a lot of good curves but sometimes returns to me a curve with an amplitude that is 100, 1000 times smaller!

thanks

Gabriele

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user



You might find the lmfit library (http://lmfit.github.io/lmfit-py) useful.   This allows one to write least squares problems in terms of Parameter objects which can have bounds set on their values, be fixed, or have values written as mathematical expressions of other Parameter values.  The lmfit library also allows you to switch between minimization algorithms easily, and also explore confidence intervals in detail.

--Matt




--
--Matt Newville <newville at cars.uchicago.edu> <a href="tel:630-252-0431" value="+16302520431" target="_blank">630-252-0431

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user