Hi there,I am new to lmfit. I find that when I fit some data, I usually find that when I use the best fit parameter to re-fit the data, I can get smaller chi square. Is this due to the iteration limit of lmfit is too small? But I cannot find a parameter to change the iteration limit...
PS: Since I need to calculate the chi square myself in order to incorporate upperlimits, I use the method "nelder", instead of "leastsq".
Hi Matt,When I add the fit_kws dict in to minimize, I got an error: TypeError: minimize() got an unexpected keyword argument 'fit_kws'Please find the screen shot of the error in the attachment. Do I make anything wrong?

There are still some problems… I find when I write like this:fit_kws = {'maxfev':500}out = minimize(ChiSquare_LMFIT, pars, kws=kws, method='nelder', **fit_kws)It does not report the error of expected argument “fit_kws”. And I find the formalism above work well using “leastsq”, however, it cannot take the keyword “maxfev” for “nelder”… Please see the attachment.
I think the method to incorporate upper limits is widely used in some fields and my code work reasonably good with it anyway. So don’t worry about that :)