Hi, would someone be so kind to tell me how to fix some parameters when using curve_fit ?
I googled it and found that I may use scipy.odr or mpfit, but they seem rather complicated. I also searched the maillist, someone said it can be done by by writing a nested function or a class. but how to do it? _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
On Fri, Jun 10, 2011 at 8:01 AM, Spark Liang <[hidden email]> wrote:
> Hi, would someone be so kind to tell me how to fix some parameters when > using curve_fit ? > I googled it and found that I may use scipy.odr or mpfit, but they seem > rather complicated. > I also searched the maillist, someone said it can be done by by writing a > nested function or a class. but how to do it? a full version is at http://docs.python.org/library/functools.html in the example for functools.partial I usually prefer to use a class, where you set the fixed parameters in the __init__ and access it with self.a(ttributename) inside the function. Josef > > _______________________________________________ > 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 |
In reply to this post by Spark Liang
Hi.
In matlab I was doing it using global variables, but is has to be better way with nested functions. The idea is to rewrite your fitted function in the way that only not fixed parameters are fed to optimization routine, but fixed variables are still available to it. Hope it helps a bit. Best. Petro. On Fri, Jun 10, 2011 at 2:01 PM, Spark Liang <[hidden email]> wrote: > Hi, would someone be so kind to tell me how to fix some parameters when > using curve_fit ? > I googled it and found that I may use scipy.odr or mpfit, but they seem > rather complicated. > I also searched the maillist, someone said it can be done by by writing a > nested function or a class. but how to do it? > > _______________________________________________ > 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 |
thanks, Petro.
I remember that matlab has such options in optimize toolsbox On Fri, Jun 10, 2011 at 8:53 PM, Piter_ <[hidden email]> wrote: Hi. _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
In reply to this post by josef.pktd
thanks, Josef.
I have done it by using mpfit, though it's not very easy. On Fri, Jun 10, 2011 at 8:35 PM, <[hidden email]> wrote:
_______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
Free forum by Nabble | Edit this page |