.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gen_examples/bound_free/plot_edge_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_bound_free_plot_edge_models.py: Comparison of different edge models =================================== This example showcases different edge-models that can be used in the bound free scattering features. .. GENERATED FROM PYTHON SOURCE LINES 8-73 .. image-sg:: /gen_examples/bound_free/images/sphx_glr_plot_edge_models_001.svg :alt: CH plasma at T=2eV, Z=[3.5 1. ] :srcset: /gen_examples/bound_free/images/sphx_glr_plot_edge_models_001.svg :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt # jax provides a submodule which can be (mostly) used as a drop-in replacement # for numpy. We use jnp to avoid confusion. from jax import numpy as jnp import jaxrts ureg = jaxrts.ureg ions = [jaxrts.Element("C"), jaxrts.Element("H")] rho = ureg("1g/cc") number_fraction = jnp.array([1 / 2, 1 / 2]) Z_free = jnp.array([3.5, 1.0]) # ---------------------------------------------------------- measured_energy = jnp.linspace(5.5, 8.6, 4096) * ureg.kiloelectron_volt mass_fraction = jaxrts.helpers.mass_from_number_fraction(number_fraction, ions) state = jaxrts.PlasmaState( ions=ions, Z_free=Z_free, mass_density=rho * number_fraction, T_e=2 * ureg.electron_volt / ureg.k_B, ) setup = jaxrts.Setup( scattering_angle=ureg("160deg"), energy=ureg("8700 eV"), measured_energy=ureg("8700 eV") + jnp.linspace(-550, 40, 500) * ureg.electron_volt, instrument=jaxrts.instrument_function.Gaussian(fwhm=ureg("5.0eV")), ) for edge in [ jaxrts.models.NoEdge, jaxrts.models.NonNegative, jaxrts.models.Heaviside, jaxrts.models.Fermi, ]: state["bf edge"] = edge() state["bound-free scattering"] = jaxrts.models.SchumacherImpulse() See_tot = state["bound-free scattering"].evaluate_raw(state, setup) plt.plot( setup.measured_energy.m_as(ureg.electron_volt), See_tot.m_as(ureg.second), label=edge.__name__, ) plt.xlabel("Probed Energy [eV]") plt.ylabel("$S_{ee}^{bf}$ [s]") plasma_str = "".join([i.symbol for i in state.ions]) plt.title( f"{plasma_str} plasma " + f"at T={(state.T_e * ureg.k_B).m_as(ureg.electron_volt):.0f}eV, " + f"Z={state.Z_free}" ) plt.legend() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 25.295 seconds) .. _sphx_glr_download_gen_examples_bound_free_plot_edge_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_edge_models.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_edge_models.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_edge_models.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_