I am running a curve fit in python that encountered the error, RuntimeError: Optimal parameters not found: Number of calls to function has reached maxfev = 1000. Here is my code:
I01 = 6e10 #I00
a1 = 1.0 #afit0
b1 = 20.0
k1 = 1e10 #kfit0
x = ang_all
guess = np.array([I01, a1, b1, k1])
bfit1 = np.zeros((2160,2560))
for ypixel in range(0,2160):
for xpixel in range(0,2560):
popt, pcov = curve_fit(func, x, rd0_all[:,ypixel,xpixel], p0=guess)
perr1 = np.sqrt(np.diag(pcov))
Ifit1 = popt[0]
afit1 = popt[1]
bfit1[ypixel,xpixel] = popt[2]
kfit1 = popt[3]
I am currently trying to run the fit for every pixel in an image. I ran it previously for only one and the fit works, but when I try with the for loops it encountered the error. I did attempt to paste only the section shown into conda instead of running the whole script again after I modified it, so maybe that has something to do with it.
FPDI (or Adobe) is sending wrong data to the printer, so the PDF prints out as A4 size
I have a dataframe and would like to assign a rank to each row in a groupFor example,
My question is what's the most conventional way of making the following line of code: