How do I use the Minimizer object to minimize the # of function calls. I get this message from the logs:
Too many function calls (max set to %i)! Use: minimize(func, params, ..., maxfev=NNN)or set leastsq_kws[\'maxfev\'] to increase this maximum.'
from numpy import sqrt, pi, exp, loadtxt
from lmfit import Model
from lmfit import Minimizer
import matplotlib.pyplot as plt
data = loadtxt('data/model1d_gauss.dat')
x = data[:, 0]
y = data[:, 1]
def gaussian(x, amp, cen, wid):
"1-d gaussian: gaussian(x, amp, cen, wid)"
return (amp/(sqrt(2*pi)*wid)) * exp(-(x-cen)**2 /(2*wid**2))
gmodel = Model(gaussian)
result = gmodel.fit(y, x=x, amp=5, cen=1, wid=1,method= 'least_squares')
print(result.fit_report())
r = result.fit_report()
plt.plot(x, y, 'bo')
plt.plot(x, result.init_fit, 'k--')
plt.plot(x, result.best_fit, 'r-')
plt.show()
I want to make the fitting faster by minimizing the function calls (lots of the data is noisy crap anyway)