I'm working often with spectral data of various gases, and the bulk of the data analysis is assigning the peaks with maximum signal (y-axis) to frequency (x-axis). Often we have several thousand data points, and it can be quite difficult to manually find peaks. I've tried getting around this in Excel with clever IF/AND statements, but the major obstacle is signal noise: I simply cannot devise a clever Excel statement to help me pick peaks.
For example, using an =IF(AND(greater signal than adjacent points),"max","") statement gives tons of extraneous hits where the noise causes a slight fluctuation in the data. Similarly, creating a column of slopes and doing an =IF(slope goes from + to -),"max","") statement also gives bad data.
The most elegant solution I have is to pick an arbitrary value # that most of my peaks are above and use an =IF(AND(slope goes from + to -,B>#),"max","") statement. That seems to work for stronger peaks (maybe 70% of the peaks on a good day), but I still have to go in and manually look at the weaker peaks (and often when doing these spectra many energetic transitions that need labeling are statistically unlikely-->low signal). I'm wondering if anyone here has a better solution able to detect local maxima not resulting from noise with a better success rate.
if(and(...))
, adding as one of the constraints that the absolute signal value be greater than some threshold. If that doesn't work, it may be time to move beyond Excel. The python/scipy codescipy.signal.find_peaks_cwt()
would probably be a one-liner for you. $\endgroup$ – Curt F. Apr 21 '15 at 0:38