[SciPy-User] scipy.odr question

Pauli Virtanen pav@iki...
Wed Jul 4 14:38:39 CDT 2012

04.07.2012 18:32, mogliii kirjoitti:
> I tried to fit a lorentzian to some code. Below is my working example.
> Strangely for the odr-fitting the result are far off, even though the
> starting values are very reasonable. I also attached a plot of it.
> What is going wrong with odr fit?
> mydata = odr.RealData(x, y, sx = x, sy = y)

What you are effectively saying here is that your data has 100%
uncertainty both in x and y coordinates. This is a very different
assumption that what goes into a least-squares fit (no error in
x-coordinate), so it's no wonder the results differ.

The ODR fit is most likely the correct solution to the problem you are
posing, but the problem you tell it to solve is not probably what you
have in mind.

Pauli Virtanen

More information about the SciPy-User mailing list