Problem 1: Peak Finding

Requirements

You may use any standard NumPy or SciPy packages or experiment with your own algorithms for this problem.

Raman spectroscopy is a technique that uses inelastic scattering of light to identify unknown chemical substances. Spectral “peaks” indicate vibrational and rotational modes and are of special importance because they act like a chemical fingerprint. Raman spectroscopy measures photon intensity vs. Raman shift. The Raman shift relates the frequencies of the exciting laser and the scattered photons and is often reported as a wavenumber – the frequency difference in wavelengths per cm (i.e., cm\(^{-1}\)).

Generate a molecular fingerprint using the spectroscopic data in raman.rod. The file contains intensity vs. wavenumber data for an unknown chemical sample. A Raman Open Database (ROD) file includes content in addition to the raw intensity data:

# content
more content
_raman_spectrum.intensity
wavenumber1 intensity1
wavenumber2 intensity2
...
wavenumbern intensityn

Use string matching to ignore all lines before _raman_spectrum.intensity. Load valid (wavenumber, intensity) pairs until the first invalid intensity line (or upon reaching the end of file).

Use the method below to estimate the wavenumbers of all spectral peaks.

First detect peaks in the raw spectral data. Use the peak locations to focus on regions of interest within the spectrum. For instance: if you detect peaks at \(x_1\) cm\(^{-1}\) and \(x_2\) cm\(^{-1}\) use regions of interest: \([x_1 - n_1, x_1 + n_1]\) and \([x_2 - n_2, x_2 + n_2]\). Experiment to find “good” widths \(n_1\), \(n_2\), etc. Then use a spline to interpolate intensity within each region of interest. Calculate zero-crossings of the derivative to estimate wavenumbers with maximum intensity.

  1. Print the wavenumber estimates for the eight largest spectral peak to STDOUT sorted by magnitude (largest first).

  2. Create a figure that shows the Raman data (intensity vs. wavenumber) and mark each of the maximum intensity values.

  3. Produce a “zoomed-in” figure for the “regions of interest” corresponding to the four largest peaks. Plot the raw spectral data and overlay your interpolating function. Use a marker to show the wavenumber with maximal intensity.