.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/basic/plot_comparison_solvers.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_comparison_solvers.py: Comparing two and three layers ============================== .. GENERATED FROM PYTHON SOURCE LINES 8-10 Imports ~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 10-55 .. code-block:: Python import numpy from PyFiberModes.fiber import load_fiber from PyFiberModes import LP01 import matplotlib.pyplot as plt fiber_2L = load_fiber( fiber_name='SMF28', wavelength=1550e-9, add_air_layer=False ) fiber_3L = load_fiber( fiber_name='SMF28', wavelength=1550e-9, add_air_layer=True ) data_2L = [] data_3L = [] itr_list = numpy.linspace(1.0, 0.3, 50) for j, itr in enumerate(itr_list): _fiber_2L = fiber_2L.scale(factor=itr) _fiber_3L = fiber_3L.scale(factor=itr) neff_2L = _fiber_2L.get_effective_index(mode=LP01) neff_3L = _fiber_3L.get_effective_index(mode=LP01) data_2L.append(neff_2L) data_3L.append(neff_3L) figure, ax = plt.subplots(1, 1, figsize=(10, 6)) ax.set_xlabel('Inverse taper ratio [ITR]') ax.set_ylabel('LP01 effective index') ax.plot(itr_list, data_2L, label='2 layer', linewidth=3) ax.plot(itr_list, data_3L, label='3 layer', marker='o', markersize=5) plt.show() # - .. image-sg:: /gallery/basic/images/sphx_glr_plot_comparison_solvers_001.png :alt: plot comparison solvers :srcset: /gallery/basic/images/sphx_glr_plot_comparison_solvers_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 16.721 seconds) .. _sphx_glr_download_gallery_basic_plot_comparison_solvers.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_comparison_solvers.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_comparison_solvers.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_