06| Humpty Dumpty IR Spectra

Scenario

You are part of a large team of (idiosyncratic) scientists whose passion is to measure IR spectra of chemical compounds. They have just finished collecting the data for Toluene, 1-Octene and Ethanol. Unfortunately, in their abundant enthusiasm, many factions have used the same instrument to make multiple measurements. You can access a zip file of all the data collected at humpty-dumpty-ir-data.zip.

Tasks

Consolidate the data

Your role in the team is to consolidate all the data. Here are some things you need to be aware of:

  • Each file name starts with a random number.
  • Different files may have different delimiters.
  • Different files for a given compound can contain overlapping data, so you must ensure that each data point is only included once.
  • For a given compound, measured values of transmittance for a given wavenumber are consistent across all files.
  • For some weird reason, the scientists thought it was neat to write the names of the compounds using a mixture of uppercase and lowercase letters!

Note:

  • You can only use basic Python and the packages Numpy, glob, and os. You cannot use any other specialised packages or software.
  • Do not modify the original files.

Time to plot

Once you have consolidated your data, generate a plot similar to the following.

Back to top