I have a set of x,y points in which x lies between 0 and 100e-12 while y ranges between 0 and 1e9 and want to use scipy.curve_fit to fit a model. It fails because of the numbers. If I rescale the data so that the numbers are closer to 1 (i.e. x*=1e10
and y*=1e-9
), then it works. So I know where the problem is and could eventually live with this solution. But would prefer to perform the fit in the original scale.
Is it possible?
I have seen an answer where it is suggested to use a diag
argument but with this I get: least_squares() got an unexpected keyword argument 'diag'
. I guess it was from an older version. Is there an analogous for the current version?
Additional info: I am providing curve_fit with very reasonable p0
.