0

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(B3>B4,B3>B5),"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(C3>0,C4<0),"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.

Stagg C.
  • 101
  • 1
    that you're doing this in excel makes my brain hurt – MichaelChirico Apr 20 '15 at 23:29
  • Hah, this is what happens when you're an organic synthesist trying to break into a new field! Maybe I am too comfortable with Excel. Are there any freeware (or possibly site-licensed by a university) programs that work well for this? – Stagg C. Apr 20 '15 at 23:32
  • R comes immediately to mind and should have powerful spectral density analysis packages readily available. I imagine python and Julia would be equally well-suited. Both are absolutely zero-cost (well, zero monetary cost--can't promise you won't spend a few days learning the coding basics). – MichaelChirico Apr 20 '15 at 23:37
  • I actually learned basic Python and vPython a while back so I could avoid doing Physics homework in my undergrad, but I'm not sure how I would code to do a maximum. Do you know any helpful teaching resources for Python?

    I suppose I'm friendly to Excel because I like working in the library, but the computers here don't have any other data analysis programs. I could get something on my desktop at home... but then I'd have distractions (i.e. girlfriend and cat). One day I'll have an office!

    – Stagg C. Apr 20 '15 at 23:40
  • Of course Stack Overflow will be able to answer most of your questions! I personally learned the basics from Quant Econ; being an economist, I can't judge how specialist the material is, but I think the introductory material is very general-audience. – MichaelChirico Apr 20 '15 at 23:43
  • Haha, I'm actually really new to this, but I'll give that a try when I get to learning to code. I was hostile to the StackExchange thing in my undergrad because SO MANY of my peers were just copying homework questions to the Math and Chem sections and using them to cheat, and it felt really unfair to me (especially when a hard math homework would keep me doing proofs and solutions for 10-15 hours a week). – Stagg C. Apr 20 '15 at 23:45
  • You need to define what a peak is - how much greater than adjacent points on either side does a peak need to be to be classified as a peak? Think of it as a signal processing problem - what constitutes a detection? – P T Apr 21 '15 at 01:27

0 Answers0