I\'m trying to fit a Gaussian for my data (which is already a rough gaussian). I\'ve already taken the advice of those here and tried curve_fit and leasts
curve_fit
leasts
After losing hours trying to find my error, the problem is your formula:
sigma = sum(y*(x-mean)**2)/n
This previous formula is wrong, the correct formula is the square root of this!;
sqrt(sum(y*(x-mean)**2)/n)
Hope this helps