Skip to content

Instantly share code, notes, and snippets.

@j-faria
Created December 12, 2018 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j-faria/d57f1041ba146cabd1d75fcbab258576 to your computer and use it in GitHub Desktop.
Save j-faria/d57f1041ba146cabd1d75fcbab258576 to your computer and use it in GitHub Desktop.
Fit all the Gaussians
from scipy import optimize
gauss = lambda x,p: p[0]*exp(-(x-p[1])**2/(2*p[2]**2)) + p[3]
gaussfit = lambda x,y,p0: optimize.leastsq(lambda p, x, y: gauss(x, p) - y, p0, args=(x, y))[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment