Fitting of spectral lines: Gaussian versus Lorentzian versus Voigt
Yaroslav Aulin ????
Technical Sales & Applications Development ? @ Lightnovo ApS ???? | Raman spectroscopy & microscopy ??
Introduction
During data analysis in spectroscopy it is extremely important to use a proper model. In this article we compare different models of fitting of a Raman line profile: Gaussian, Lorentzian and Voigt on an example of a 1085cm-1 line of calcite.
Experimental
The spectrum of a reference calcite sample was measured with Lightnovo ApS miniRaman 785nm Power spectrometer. The following settings were used: power 125mW, exposure time 250ms, 10 repetitions. Middle distance probe (15mm) was used for the measurements.
Curve fitting
We performed the fitting of the 1085cm-1 calcite line with Gaussian, Lorentzian, and Voigt functions. The fit was performed in Python using curve_fit function from scipy.optimize package.
Gaussian fit
Gaussian function is defined according to the following equation:
A0 + A * np.exp(-(x - x0) ** 2 / (2 * sigma ** 2))
The results of the Gaussian fit were as follows:
A0 = 6.98112860e-01
A = 3.22987258e+00
x0 = 1.08749499e+03
sigma = 3.43820373e+00
FWHM of the line can be calculated using the following formula:
f_Gaussian = 2*np.sqrt(2*np.log(2))*sigma
The result obtained is:
f_Gaussian = 8.09635106783667
Lorentzian fit
Lorentzian function is defined according to the following equation:
A0 + A * gamma**2 / ( gamma**2 + ( x - x0 )**2)
The results of the Lorentzian fit were as follows:
A0 = 5.59810395e-01
A = 3.64307860e+00
x0 = 1.08757145e+03
gamma = 3.50122498e+00
FWHM of the line can be calculated using the following formula:
f_Lorentzian = 2*gamma
The result obtained is:
f_Lorentzian = 7.00244995329159
Voigt fit
Voigt profile is a convolution of a Gaussian and a Lorentzian. It can be defined in the domain of special functions:
A0 + A * np.real(wofz((x - x0 + 1j*gamma)/sigma/np.sqrt(2))) / sigma /np.sqrt(2*np.pi)
where sigma is the parameter of a Gaussian, gamma is the parameter of a Lorentzian, and wofz is a Faddeeva function. Faddeeva function implementation from scipy.special pacakage was used.
The results of the Voigt fit were as follows:
A0 = 6.01007330e-01
A = 3.63298344e+01
x0 = 1.08754782e+03
sigma = 1.72334849e+00
gamma = 2.55363910e+00
Gaussian linewidth is defined as follows:
f_Gaussian = 2*np.sqrt(2*np.log(2))*sigma
The result obtained is as follows:
f_Gaussian = 4.058175560194967
Lorentzian linewidth is defined as follows:
领英推荐
f_Lorentzian = 2*gamma
The result obtained is as follows:
f_Lorentzian = 5.107278207662339
FWHM of the line can be calculated using the following formula:
f_Voigt = 0.5346 * fL + np.sqrt( 0.2166 * fL**2 + fG**2)
The result obtained is:
f_Voigt = 7.433397414906343
Comparison of fits
For the comparison, Gaussian, Lorentzian and Voigt fit were plotted together.
As we can clearly see by eye from the figures, Lorentzian provides a better fit than Gaussian, while Voigt profile provides the best fit.
Error analysis
Residues of fit
The residues of the fits are plotted below.
Reduced chi-squared
In order to compare the fits quantitatively, we perform error analysis in terms of reduced chi-squared. Chi-squared, the parameter of the goodness of a fit, is defined as follows:
chi2 = np.sum(error["Error, %"]**2)/error["Error, %"].size
The following results were obtained for Gaussian, Lorentzian and Voigt fit respectively:
chi2_gaussian = 0.009955851734696885
chi2_lorentzian = 0.004882272418488386
chi2_voigt = 0.0031965457618039566
Spectral resolution of a Raman spectrometer
ASTM defines calcite as a reference sample to determine the resolution of a Raman spectrometer. According to the ASTM E2529 – 06(2014) standard the resolution can be determined from the full width at half maximum of calcite 1085cm-1 line using the formula:
s_resolution = ( FWHM_calcite_1085 - 0.684 ) / 1.0209
Using the result for the FWHM of the Voigt fit we obtain the following:
s_resolution = 6.61122285719105
Conclusions
The Python code used for this article is freely available on github as a Jupyter notebook via the following link: https://github.com/yaulin/spectral_line_fitting/blob/main/peak_fitting_calcite.ipynb (MIT License)
References
Choosing the right model for data analysis in #spectroscopy is crucial. The nuances in line profiles can significantly impact the accuracy of results.