Scipy curve_fit does not estimate offset values and throws initial guess as the final estimate for every fit.
Hello everyone, I am currently working on a curve_fitting problem that needs to estimate 4 parameters namely time to peak (tmax), maximum amplitude (ymax), shape (b) and offset. I am using Scipy's curve_fit library that is giving reliable results for the first three parameters but not for offset. My objective function looks like this: def objective2(t,tmax, ymax, b, offset): offInt = math.ceil(offset) offArr = np.zeros(offInt) offArr = np.append(offArr,ymax*((t[:(len(t)-offInt)]/tmax)*np.exp((b*tmax)))* 2.713*np.exp((tmax-t[:(len(t)-offInt)])*b)) return offArr I am fitting a 4 parameter gamma function in this objective function. If my initial guess for these parameters is p0 = np.array([100, 5, 0.005, 10]), all my estimated fits have an offset of 10 which is not right. Can someone help me with this or is there some issue with scipy curve_fit that can be corrected?
participants (3)
-
amk2358@columbia.edu
-
Pamphile Roy
-
Stefan van der Walt