cheminfo / nmrium

React component to display and process nuclear magnetic resonance (NMR) spectra.
https://docs.nmrium.org
MIT License
55 stars 26 forks source link

set kind of shape to lorentzian by default for peaks #1747

Closed jobo322 closed 2 years ago

jobo322 commented 2 years ago

@lpatiny @jliermann, I think the shape looks better as gaussian than lorentzian by default just after auto-peakpicking.

image

It is really improved after the optimization step

image

so I propose to keep gaussian as default for peaks out of the box from auto-peak-picking

jliermann commented 2 years ago

Thanks for the comment and the examples! However, I would disagree. If you look at the sum spectrum, the optimized Lorentzian is better.

Gaussian: grafik

Lorentzian: grafik

And that is actually expected from FT theory which gives Lorentz-distributed lines (J. Keeler, Understanding NMR Spectroscopy, 2nd edition, p. 84): grafik

lpatiny commented 2 years ago

@jobo322 I'm wondering if GSD is done with Lorentzian. The difference with and without optimization is too big. There must be a bug somewhere.

jobo322 commented 2 years ago

GSD gets the width from the inflection points of the shape (experimental data), but the relation between width and FWHM depends of the kind of shape. Based on the wolfram pages of lorentzian and gaussian I found that:

for Lorentzian shape, the relation between width and FWHM is:

width = FWHM/sqrt(3)

for Gaussian shape, the relation between width and FWHM is:

width = FWHM/sqrt(2 * Ln(2))

So, for a gaussian the difference between width and FWHM is an 17.7 %. But for a Lorentzian shape the difference is around 73 %. That is why, the gaussian shape looks better than lorentzian for peaks without optimization.

Let me know if I am wrong.

jobo322 commented 2 years ago

I did test the shape with the simulated spectra. It is drawn with a gaussian shape but the idea is the same.

jobo322 commented 2 years ago

@jliermann @lpatiny I propose to use pseudoVoigt shape as default for peaks,

image

jliermann commented 2 years ago

@jliermann @lpatiny I propose to use pseudoVoigt shape as default for peaks,

Sorry for not answering earlier! I appreciate that the Lorentzian shape causes optimisation issues but I still feel that the theoretically correct shape should be the default as this will have an educational impact. Other shapes should only be used by people how choose so intentionally.