<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000'>thanks for the information and the link<div><br></div><div>Paul<br><br><hr id="zwchr"><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>De: </b>"Dang Ngoc Chan, Christophe" <Christophe.Dang@sidel.com><br><b>À: </b>"Users mailing list for Scilab" <users@lists.scilab.org><br><b>Envoyé: </b>Jeudi 6 Octobre 2016 10:26:50<br><b>Objet: </b>[Scilab-users] Peaks and valleys [was: Forum dedicated to Scilab developments -> practical concern]<br><br>Hello,<br><br>> De : paul.carrico@free.fr<br>> Envoyé : mercredi 5 octobre 2016 21:56<br>><br>> In attachment is typically a project I'm working on :<br>> determination of peaks and valley on a noisy signal;<br>> Trying to  avoid reinventing the wheel,<br>> I had a look on information's and algorithms on internet ....<br>> not so easy topics I was thinking at the first time.<br><br>I used to work in the X-ray diffraction and fluorescence field,<br>where the detection of peaks is a main concern.<br>All this depends on the signal-to-noise ratio, but we used the following algorithms,<br>Applied one after the other:<br><br>— cutting the signal that is below the background noise:<br>in the X-ray field, the noise follows a Poisson statistics,<br>so if you know the background level (determined "manually"),<br>you can eliminate bands where the signal is below bkg + 3*sigma<br><br>— Savitzky-Golay algorithm for smoothing and determining the first and second derivative:<br>the peak summit is a local minimum of the 2nd derivative,<br>and the inflection points (i.e. its zeroes) can be used to estimate the peak width and also possibly its location<br>(chord middle)<br>https://commons.wikimedia.org/wiki/File:Savitzky-golay_pic_gaussien_bruite.svg<br><br>— eliminating the parasites:<br>in this field, the peaks have a minimum width,<br>so you can remove any detected peak if the first derivative is unexpectedly high.<br><br>We also used "de-summation",<br>i.e. from a set of peak position<br>(determined automatically or manually),<br>we generate a curve as a sum of "perfect peaks"<br>(Gaussian, Lorentzian, pseudo-Voigt, Pearson-VII etc.)<br>and we adjust the peaks parameters (position, width, shape)<br>to minimise the quadratic difference with the signal<br>(i.e. non-linear regression).<br><br>I don't know if this is useful in your field,<br>but the Savitzky-Golay algorithm is something widely used<br>and easy to implement (especially if the points are uniformly spaced in x)<br>and if the peak position and width have a physical meaning,<br>de-summation can be powerful.<br><br>--<br>Christophe Dang Ngoc Chan<br>Mechanical calculation engineer<br>This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.<br>_______________________________________________<br>users mailing list<br>users@lists.scilab.org<br>http://lists.scilab.org/mailman/listinfo/users<br></div><br></div></div></body></html>