### Install Local Package Source: https://github.com/nzhagen/jcamp/blob/master/CONTRIBUTING.md Install the project locally using pip to test. ```bash pip install . ``` -------------------------------- ### Install jcamp Package Source: https://github.com/nzhagen/jcamp/blob/master/README.md Install or upgrade the jcamp package using pip. This command ensures you have the latest version available from PyPI. ```shell pip install --upgrade jcamp ``` -------------------------------- ### Create Source Distribution Source: https://github.com/nzhagen/jcamp/blob/master/CONTRIBUTING.md Generate a source distribution archive for packaging. ```bash python3 setup.py sdist ``` -------------------------------- ### Upload to PyPI Source: https://github.com/nzhagen/jcamp/blob/master/CONTRIBUTING.md Upload the distribution files to the Python Package Index. ```bash twine upload dist/* ``` -------------------------------- ### Create Release Commit Source: https://github.com/nzhagen/jcamp/blob/master/CONTRIBUTING.md Commit changes to version files before creating a release. ```bash git commit -m "Release v0.1.2" jcamp.py setup.py ``` -------------------------------- ### Push Commit and Tag Source: https://github.com/nzhagen/jcamp/blob/master/CONTRIBUTING.md Push the commit and its associated tag to the remote repository. ```bash git push --follow-tags ``` -------------------------------- ### Perform Web Query with JCAMP Source: https://github.com/nzhagen/jcamp/blob/master/README.md Fetch JCAMP data from a URL using the requests package and parse it with jcamp_read. The content is decoded from bytes to UTF-8 strings. ```python response = requests.get(something) content = response.content.splitlines() content = [line.decode("utf-8") for line in content] data_dict = jcamp_read(content) ``` -------------------------------- ### Plot UV-Vis Spectrum Source: https://github.com/nzhagen/jcamp/blob/master/doc/demo.ipynb Reads a UV-Vis spectrum file and plots the data in red. Requires the jcamp and matplotlib libraries. ```python 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']) ``` -------------------------------- ### Write JCAMP-DX File Source: https://github.com/nzhagen/jcamp/blob/master/README.md Write data to a JCAMP-DX file using jcamp_writefile. The input dictionary must contain 'x' and 'y' keys for the primary data. ```python jcamp_writefile(data_dict, filename) ``` -------------------------------- ### Tag Release Commit Source: https://github.com/nzhagen/jcamp/blob/master/CONTRIBUTING.md Attach a tag to the release commit for version control. ```bash git tag v0.1.2 ``` -------------------------------- ### Plot Mass Spectrum Source: https://github.com/nzhagen/jcamp/blob/master/doc/demo.ipynb Reads a mass spectrum file and plots the intensity of each mass-to-charge ratio using distinct vertical lines. Requires the jcamp and numpy libraries. ```python 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']) ``` -------------------------------- ### Plot Infrared Spectrum Source: https://github.com/nzhagen/jcamp/blob/master/doc/demo.ipynb Reads an infrared spectrum file and plots its absorbance/transmittance data. Requires the jcamp and matplotlib libraries. ```python %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']) ``` -------------------------------- ### Plot Raman Spectrum Source: https://github.com/nzhagen/jcamp/blob/master/doc/demo.ipynb Reads a Raman spectrum file and plots the data in black. Requires the jcamp and matplotlib libraries. ```python 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']) ``` -------------------------------- ### Calculate Cross-Section from JCAMP Data Source: https://github.com/nzhagen/jcamp/blob/master/README.md Convert JCAMP data to wavelength (microns) and cross-section (m^2) using jcamp_calc_xsec. This function modifies the input dictionary in-place. ```python jcamp_calc_xsec(jcamp_dict, wavemin=8.0, wavemax=12.0, skip_nonquant=True) ``` -------------------------------- ### Calculate and Plot Infrared Cross-Section Source: https://github.com/nzhagen/jcamp/blob/master/doc/demo.ipynb Calculates the cross-section for an infrared spectrum and plots it. This function is useful for quantitative analysis of infrared data. Requires the jcamp library. ```python 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)') ``` -------------------------------- ### Read JCAMP File Data Source: https://github.com/nzhagen/jcamp/blob/master/README.md Use the jcamp_reader function to parse a JCAMP-DX file. It returns a dictionary containing header fields and data arrays 'x' and 'y'. ```python data_dict = jcamp_reader(filename) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.