I have a curve that represents a certain physical phenomenon. I need to fit this curve in order to extrapolate certain curve parameters that represent my phenomenon. I know that this curve is made up by a multitude of gaussian curves, for example: data = gaussian1 + gaussian2 + gaussian3
I need to obtain all parameters from each gaussian curve (i.e. mean, standard deviation and height) so that I can correctly fit my data points.
I am using curve_fit from scipy.optimize and it works fine, provided I give the function some initial guesses on the gaussian parameters. Is there a way to do this without an initial guess?
For example, let's consider this simple example. I have the following data:
data = [0 0 0.01 0.02 0.05 0.09 0.16 0.27 0.41 0.58 0.76 0.9 1 1.02 0.97 0.89 0.8 0.74 0.74 0.8 0.89 0.97 1.02 1 0.9 0.76 0.58 0.41 0.27 0.16 0.09 0.05 0.02 0.01 0 0]
which clearly represent the sum of two bell curves. I need to fit this curve and obtain the parameters of the bell curves, like mean and standard deviation. The main issue is that I do not know generally how many gaussian curves are present and neither an initial guess for their parameters.
I also tried UnivariateSpline from scipy.interpolate and with s=0 I can correctly fit my whole curve.But I do not know the gaussian curves parameters.