.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gen_examples/utils/plot_instrument_function_models.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gen_examples_utils_plot_instrument_function_models.py: All available instrument function models. ========================================= To include an instrument function in a :py:class:`jaxrts.Setup`, we require it to be Callable that takes only one argument, the shift in frequency space. The function has to be normalized to unify from -infinity to +infinity. .. GENERATED FROM PYTHON SOURCE LINES 9-52 .. image-sg:: /gen_examples/utils/images/sphx_glr_plot_instrument_function_models_001.svg :alt: plot instrument function models :srcset: /gen_examples/utils/images/sphx_glr_plot_instrument_function_models_001.svg :class: sphx-glr-single-img .. code-block:: Python import jax.numpy as jnp import matplotlib.pyplot as plt import jaxrts import jaxrts.instrument_function as ifs ureg = jaxrts.units.ureg plt.style.use("science") fig, ax = plt.subplots(figsize=(7, 4)) E = jnp.linspace(-100, 100, 500) * ureg.electron_volts w = E / ureg.hbar width = 20 * ureg.electron_volt / ureg.hbar plt.plot( E.m_as(ureg.electron_volt), ifs.instrument_gaussian(w, width).m_as(ureg.hbar / ureg.electron_volt), label="Gaussian Model", ) plt.plot( E.m_as(ureg.electron_volt), ifs.instrument_supergaussian(w, width, 2).m_as( ureg.hbar / ureg.electron_volt ), label="Super-Gaussian Model (p=2)", ) plt.plot( E.m_as(ureg.electron_volt), ifs.instrument_lorentzian(w, width).m_as(ureg.hbar / ureg.electron_volt), label="Lorentzian Model", ) plt.xlabel("E [eV]") plt.ylabel("Intensity [hbar / eV]") plt.legend(loc="upper left") plt.tight_layout() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 5.486 seconds) .. _sphx_glr_download_gen_examples_utils_plot_instrument_function_models.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_instrument_function_models.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_instrument_function_models.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_