The Levenberg–Marquardt algorithm is applied here to fit elliptical datasets with an interpolated method between Gauss–Newton and gradient descent. It is a robust method and works well even for very noisy datasets. It was developed for normalizing magnetometer datasets but is general for fitting any elliptical data.
Take a look at the general desciption of Levenberg–Marquardt or of the original publication implemented in Fortran MINPACK-1 1/2, MINPACK-1 2/2 or USER GUIDE FOR MINPACK-1
The Fortran code of MINPACK has been integrated into scipy.optimize.curve_fit which we will make use of here.
The dotted line is the LM fit of the noisy elliptical dataset, with a far outlier added bottom left.