The leastsq method in scipy lib fits a curve to some data. And this method implies that in this data Y values depends on some X argument. And calculates the minimal distance bet
scipy.odr implements the Orthogonal Distance Regression. See the instructions for basic use in the docstring and documentation.
scipy.odr