.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/fields/plot_confinement_by_radius.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_gallery_fields_plot_confinement_by_radius.py: Confinement by radius ===================== Measure how the sampled electric-field energy accumulates away from the fiber axis. .. GENERATED FROM PYTHON SOURCE LINES 8-30 .. image-sg:: /gallery/fields/images/sphx_glr_plot_confinement_by_radius_001.png :alt: plot confinement by radius :srcset: /gallery/fields/images/sphx_glr_plot_confinement_by_radius_001.png :class: sphx-glr-single-img .. code-block:: Python from PyFiberModes.units import ureg import matplotlib.pyplot as plt import numpy as np from PyFiberModes import HE11 from PyFiberModes.fiber import load_fiber fiber = load_fiber("SMF28", wavelength=1550e-9 * ureg.meter) field = fiber.get_mode_field(HE11, limit=15e-6 * ureg.meter, n_point=151) radii = np.linspace(0.5e-6, 14e-6, 80) * ureg.meter confinement = [field.get_confinement_factor(radius) for radius in radii] figure, axis = plt.subplots() axis.plot(radii.to("micrometer").magnitude, confinement) axis.set( xlabel="Integration radius [µm]", ylabel="Electric-energy fraction", ylim=(0, 1.02), ) axis.grid(alpha=0.25) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.237 seconds) .. _sphx_glr_download_gallery_fields_plot_confinement_by_radius.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_confinement_by_radius.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_confinement_by_radius.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_confinement_by_radius.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_