.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/validation/plot_normalized_effective_index.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_validation_plot_normalized_effective_index.py: Normalized effective index ========================== Verify that the normalized propagation parameter remains between zero and one for a guided fundamental mode. .. GENERATED FROM PYTHON SOURCE LINES 8-33 .. image-sg:: /gallery/validation/images/sphx_glr_plot_normalized_effective_index_001.png :alt: plot normalized effective index :srcset: /gallery/validation/images/sphx_glr_plot_normalized_effective_index_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /opt/hostedtoolcache/Python/3.11.17/x64/lib/python3.11/site-packages/matplotlib/cbook.py:1408: UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray. return np.asanyarray(x, float) | .. code-block:: Python from PyFiberModes.units import ureg import matplotlib.pyplot as plt import numpy as np from PyFiberModes import LP01 from PyFiberModes.fiber import load_fiber wavelengths = np.linspace(1260e-9, 1650e-9, 60) * ureg.meter fiber = load_fiber("SMF28", wavelength=wavelengths[0]) result = fiber.sweep(wavelengths, modes=(LP01,), metrics=("effective_index",)) effective_index = result["effective_index"][:, 0] cladding_index = fiber.last_layer.refractive_index core_index = fiber.maximum_index normalized_index = ( (effective_index**2 - cladding_index**2) / (core_index**2 - cladding_index**2) ) figure, axis = plt.subplots() axis.plot(wavelengths.to("nanometer").magnitude, normalized_index) axis.axhspan(0, 1, alpha=0.12, label="guided interval") axis.set(xlabel="Wavelength [nm]", ylabel="Normalized effective index", ylim=(-0.05, 1.05)) axis.legend() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.102 seconds) .. _sphx_glr_download_gallery_validation_plot_normalized_effective_index.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_normalized_effective_index.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_normalized_effective_index.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_normalized_effective_index.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_