SciPy's documentation on LeastSq is here. It states that ier
is
An integer flag. If it is equal to 1, 2, 3 or 4, the solution was found. Otherwise, the solution was not found. In either case, the optional output variable ‘mesg’ gives more information.
But how do I retrieve the optional variable mesg
?
x,ier=leastsq(residuals, plsq, args=(x_vals, y_vals))
gives me only two returns while
x,mesg,ier=leastsq(residuals, plsq, args=(x_vals, y_vals))
gives the error message ValueError: need more than 2 values to unpack
on that line.