I have a two dimensional data set, of some fixed dimensions (xLen and yLen), which contains a sine curve.
I've already determined the frequency of the sine curve, and I've generated my own sine data with the frequency using
SineData = math.sin((2*math.pi*freqX)/xLen + (2*math.pi*freqY)/yLen)
where freqX and freqY and the oscillation frequencies in the X and Y directions for the curve.
But now I'd like to do a linear least squares fit (or something similar), so that I can fit the right amplitude. As far as I know, a linear least squares is the right way to go, but if there's another way that's fine as well.
The leastsq function is SciPy doesn't do a multidimensional fit. Is there a python implementation for a 2/multidimensional least square fitting algorithm
Edit: I found the 2 dimensional frequency of the sine wave from a 2D FFT. The data contains a 2D sine + noise, so I only picked the largest peak of the 2D FFT and took an inverse of that. Now I have a sine curve, but with an amplitude that's off. Is there a way to do a 2 dimensional least squares (or similar), and fit the amplitude?