This a notebook demo of the usage of the jcamp reader using matplotlib.
In [3]:
%matplotlib inline
import matplotlib.pyplot as plt
from numpy import alen, arange
from jcamp import JCAMP_calc_xsec, JCAMP_reader
filename = '../data/infrared_spectra/methane.jdx'
jcamp_dict = JCAMP_reader(filename)
plt.plot(jcamp_dict['x'], jcamp_dict['y'])
plt.title(filename)
plt.xlabel(jcamp_dict['xunits'])
plt.ylabel(jcamp_dict['yunits'])
JCAMP_calc_xsec(jcamp_dict, skip_nonquant=False, debug=True)
plt.figure()
plt.plot(jcamp_dict['wavelengths'], jcamp_dict['xsec'])
plt.title(filename)
plt.xlabel('um')
plt.ylabel('Cross-section (m^2)')
filename = '../data/uvvis_spectra/toluene.jdx'
plt.figure()
jcamp_dict = JCAMP_reader(filename)
plt.plot(jcamp_dict['x'], jcamp_dict['y'], 'r-')
plt.title(filename)
plt.xlabel(jcamp_dict['xunits'])
plt.ylabel(jcamp_dict['yunits'])
filename = '../data/mass_spectra/ethanol_ms.jdx'
jcamp_dict = JCAMP_reader(filename)
plt.figure()
for n in arange(alen(jcamp_dict['x'])):
plt.plot((jcamp_dict['x'][n],jcamp_dict['x'][n]), (0.0, jcamp_dict['y'][n]), 'm-', linewidth=2.0)
plt.title(filename)
plt.xlabel(jcamp_dict['xunits'])
plt.ylabel(jcamp_dict['yunits'])
filename = '../data/raman_spectra/tannic_acid.jdx'
jcamp_dict = JCAMP_reader(filename)
plt.figure()
plt.plot(jcamp_dict['x'], jcamp_dict['y'], 'k-')
plt.title(filename)
plt.xlabel(jcamp_dict['xunits'])
plt.ylabel(jcamp_dict['yunits'])
Out[3]: