python - RuntimeError: Optimal parameters not found: Number of calls to function has reached maxfev = 800 -


i have image pick randow row in , try fit gaussian curve in row. using scipy.optimize curve_fit method fitting gaussian.

picking of randow rows according array vector [10, 20, 40, 60, 100], meaning in first try pick 10 randow rows (hence, 10 gaussian fits) in image, then, more rows selected , on.

most of time, code working, however, error (especially, when number of rows large: around 60 or more), says optimal parameters not found.

i have found similar posts in stackoverflow still can not able solve problem. seems problem appears quite curve_fit method.

laser beam, chance? ;-)

anyway, problem rows selected "hard" fit gaussian curve scipy's curve_fit function. first suggestion debug (using e.g. python's logging module) see if error pops on specific rows.

my second suggestion change initial guess curve_fit. rows curve-fitting possible, should able extract few parameters. on other rows, mean of gaussian @ approximately same position , aplitude not vary either. initial guess curve fitting.

if want analyze issue, i'd both: try find rows curve fitting fails after 800 iterations. see if curve fitting works changing initial guess.


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -