Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Identify peaks in spectra

  1. Aug 18, 2009 #1
    hello,
    i've Spectra(set of data points) and i need to identify the peaks of the spectra.
    are there any algorithms for that ?
     
  2. jcsd
  3. Aug 18, 2009 #2
    Sure, just go through your array collecting points where a[i-1] < a > a[i+1]. Of course, that might give you "peaks" that are just random fluctuations in your data. You could try to prevent that by replacing each a with a weighted average of nearby elements beforehand, smoothing the function.
     
  4. Aug 18, 2009 #3
    it's a very simple algorithm which will give incorrect results...
    i've tried more complex algorithms, like looking for slopes from left sides of peak and right sides,
    but with no success...
     
  5. Aug 18, 2009 #4

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Well, what are the "correct results" you're looking for?

    - Warren
     
  6. Aug 18, 2009 #5

    MATLABdude

    User Avatar
    Science Advisor

    That's true; now you just need to determine the location of the relevant peaks (whether it be the spectral width of the peak, or using a simple thresholding algorithm--if it's above value X then it's a peak--or running the data through a low-pass filter to smooth out the noise prior to finding the peaks).

    Or, if you know a priori where the peaks ought to be, you can use these peak locations to create an appropriate comb filter which filters out only the values at those wavelengths (and of a certain spectral width, once again). But again, you'd need to know exactly what you're looking for, and either compensate for spectral shifting or make the comb sufficiently wide that you don't end up cutting off the peak.
     
    Last edited: Aug 18, 2009
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook