I have collated the data and have it in CSV.format. I wish to fit a Gaussian into my data using Python. Can someone help me with the starting steps? I have gone through the lmfit. documentation from Python. I'm not very sure how to go about it.
Asked
Active
Viewed 413 times
2 Answers
1
Fitting a Gaussian is as simple as calculating the mean and the standard deviation of your data:
import numpy as np
data = <load data here>
mu = np.mean(data)
sigma = np.std(data, ddof=1)
Here, mu
and sigma
are the two parameters of the Gaussian.

ForceBru
- 43,482
- 10
- 63
- 98
-
Thank you very much for your response!. I wish to view my data points and the bell curve as well? Could you help me with this regard? – Angela Mary Jul 02 '21 at 16:58
-
@AngelaMary, you can use [Matplotlib](https://matplotlib.org) to visualize data in Python – ForceBru Jul 02 '21 at 17:00
1
you say you read the lmfit
documentation. It pretty much explains how to accomplish this with the lmfit
package; what is not clear about the description here or this example?
You should be able to adapt these to your specific situation. If you have trouble doing that you'll have to provide a "minimal, working example" of your code and/or explain what is not working.

Renee
- 199
- 3