0

I would like to fit a 2D elliptical Gaussian to a set of x,y data coordinates, from which I would like to know know the major and minor axis lengths corresponding to the fwhm level (i.e. sigma*2.355, or the 50% confidence interval?). The fit should also account for the tilt.

Example data:

from numpy import random

x0=random.rand(100)
y0=random.rand(100)/3

ang=15*np.pi/180
x=x0*np.cos(ang) - y0*np.sin(ang)
y=x0*np.sin(ang) + y0*np.cos(ang)

I think this can be done with eigenvalues and eigenvectors, but I don't know how to actually implement this, and how to plot the ellipse with tilt at the 50% level.

freja
  • 47
  • 1
  • 6

0 Answers0