0

i'm new to python and i'm trying to fit the gaussian function into scherrer equation using python and the problem is that i don't know how to do it . similarly with the laurentzian model . can some one explains me how to do it . Thanks

More explanation : for x and y values i want them to be read from a text file and then use them in the process.

  • As a way to success, have a look at numpy, since some work with it https://stackoverflow.com/questions/39973073/using-scherrer-equation-for-calculating-the-grain-size – nicolallias Dec 05 '19 at 12:20

2 Answers2

1

If you want a more specific solution you should probably provide an example.

In general, scipy.curve_fit is a great solution for the most fitting problems. You can find a tutorial about it here. In particular, there is also an example of how to fit a Gaussian function: https://scipy-cookbook.readthedocs.io/items/FittingData.html#Fitting-gaussian-shaped-data.

beckstev
  • 83
  • 8
0

You might want to take a look here: Gaussian fit for Python I have no idea how you get your data, but if you have just the function, try generating values using the function to get something you can actually fit the gauss curve.

  • do you know how to fit the curve for the whole points in the graph not only for one peak? – Mark Shamoun Dec 09 '19 at 18:23
  • The scipy.optimize.curve_fit (https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html) fits all parameters and not just the peak, Gaussians only have the mean and the standard deviation so if the fit is not good enough you prbly need another function. – Kai Winkler Dec 10 '19 at 11:43