In python I have a function which has many parameters. I want to fit this function to a data set, but using only one parameter, the rest of the parameters I want to supply o
I effectively use Anton Beloglazov's solution, though I like to avoid using lambda functions for readability so I do the following:
def func(x,a,b):
return a*x*x + b
def helper(x,a):
return func(x,a,b)
for b in xrange(10):
popt,pcov = curve_fit(helper, x1, x2)
This ends up being reminiscent of Rick Berg's answer, but I like having one function dedicated to the "physics" of the problem and a helper function to get the code to work.