.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/basic/plot_mode_field_2.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_basic_plot_mode_field_2.py: Mode fields =========== .. GENERATED FROM PYTHON SOURCE LINES 8-10 Imports ~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 10-16 .. code-block:: Python import numpy from PyFiberModes import LP01, LP02, LP03 from PyFiberModes.fiber import load_fiber import matplotlib.pyplot as plt .. GENERATED FROM PYTHON SOURCE LINES 17-20 Generating the fiber structures ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Here we create the different fiber design that we want to explore .. GENERATED FROM PYTHON SOURCE LINES 20-23 .. code-block:: Python fiber = load_fiber(fiber_name='SMF28', wavelength=1550e-9) fiber = fiber.scale(3.5) .. GENERATED FROM PYTHON SOURCE LINES 24-25 Preparing the figure .. GENERATED FROM PYTHON SOURCE LINES 25-50 .. code-block:: Python radius_list = numpy.linspace(0, 2 * fiber.radius, 200) figure, ax = plt.subplots(1, 1) ax.set( title='Field radial distribution', xlabel='Radius', ylabel='Amplitude' ) for mode in [LP01, LP02, LP03]: amplitudes = [] for radius in radius_list: e_field, _ = fiber.get_radial_field(mode=mode, radius=radius) amplitudes.append(e_field.rho) amplitudes = numpy.asarray(amplitudes) amplitudes /= numpy.sign(amplitudes[0]) plt.plot(radius_list, amplitudes, label=str(mode)) plt.show() # - .. image-sg:: /gallery/basic/images/sphx_glr_plot_mode_field_2_001.png :alt: Field radial distribution :srcset: /gallery/basic/images/sphx_glr_plot_mode_field_2_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.922 seconds) .. _sphx_glr_download_gallery_basic_plot_mode_field_2.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_mode_field_2.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_mode_field_2.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_