07| Parsing JCAMP-JDX files
Introduction
In this problem, we will focus on how to use JCAMP-DX files. JCAMP-DX is a file format for storing and exchanging data from spectroscopic measurements, such as infrared and Raman spectra. JCAMP stands for Joint Committee on Atomic and Molecular Physical Data (jcamp-dx.org), a committee responsible for developing and maintaining standards for the exchange of spectroscopic data.
The JCAMP-DX format is a text-based format that includes both data and metadata. It supports a wide range of spectroscopic techniques and allows storing many different data types, including spectra, chromatograms, and mass spectrometry. The format is widely used in the scientific community and is considered a standard for exchanging spectroscopic data. In particular, NIST uses the JCAMP-DX to share data in the NIST Chemistry WebBook.
JCAMP-DX files typically have a .jdx
file extension. Many software applications, such as Notepad or TextEdit, can open them. However, to be useful, the file needs to be parsed, i.e., its content analysed and any essential data extracted.
Tasks
Get data
Visit the NIST Chemistry WebBook and download the data in JCAMP-DX format for the IR spectra of:
1. Carbon-dioxide
2. Water
3. Methane
Write your own parsing code
Write a Python script to extract the IR spectral data from your downloaded files.
Note:
- Use only basic Python and Numpy. You cannot use any specialised packages or software.
- Do not modify the original file from NIST.
Time to plot
Use your previous code snippet to extract the relevant data and generate a plot similar to the following: