Blue curve is raw data, green curve is the Gaussian fit for only the second maximum and yellow curve is the combination of Gaussian for both maxima. Context: yraw is raw data in a list, xpixel is the x axis (500-1250)
Here is my Gaussian method:
def Gauss(x, amp, mu, sigma):
return amp*np.exp(-((x-mu)/(np.sqrt(2)*sigma))**2)
def bimode(x, amp1, mu1, sigma1, amp2, mu2, sigma2):
return Gauss(x, amp1, mu1, sigma1) + Gauss(x, amp2, mu2, sigma2)
ypg1 = np.asarray(yraw) #make np array from raw data list
parameters, covarience = curve_fit(bimode, xpixel, ypg1, p0 = (78, 805, 15, 8, 950, 15)) #does a curve fit for our gauss function. we give it an initial guess of amplitude, mean value (95,000)
#parameters returns amp, mu, sig, amp, mu, sig
print(parameters)
ygauss = bimode(xpixel, parameters[0], parameters[1], parameters[2], parameters[3], parameters[4], parameters[5])
I am expecting a nice curve fit from double Gaussian to envelope both maxima.

Let's create some dataset:
Now remove the baseline:
And fit:
Both peak can be found: