.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/extra/custom_graded_index_fiber.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_extra_custom_graded_index_fiber.py: Loading and plotting a graded-index fiber structure =================================================== .. GENERATED FROM PYTHON SOURCE LINES 5-47 .. image-sg:: /gallery/extra/images/sphx_glr_custom_graded_index_fiber_001.png :alt: Refractive Index Distribution in the Fiber :srcset: /gallery/extra/images/sphx_glr_custom_graded_index_fiber_001.png :class: sphx-glr-single-img .. code-block:: Python from FiberFusing.fiber import GenericFiber from FiberFusing.coordinate_system import CoordinateSystem from FiberFusing import GradedIndex fiber = GenericFiber() fiber.create_and_add_new_structure( name='cladding', refractive_index=1.4450, radius=62.5 * 1e-6 ) graded_index = GradedIndex( inside=1.4480, outside=1.4450 ) fiber.create_and_add_new_structure( name='core', refractive_index=graded_index, radius=4.5 * 1e-6 ) coordinate_system = CoordinateSystem( nx=100, ny=100, x_min=-20e-6, x_max=20e-6, y_min=-20e-6, y_max=20e-6, ) mesh = fiber.get_raster_mesh(coordinate_system=coordinate_system) import matplotlib.pyplot as plt plt.imshow(mesh, origin='lower', cmap='viridis') plt.colorbar(label='Refractive Index') plt.title('Refractive Index Distribution in the Fiber') plt.xlabel('X Position (m)') plt.ylabel('Y Position (m)') plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.345 seconds) .. _sphx_glr_download_gallery_extra_custom_graded_index_fiber.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: custom_graded_index_fiber.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: custom_graded_index_fiber.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: custom_graded_index_fiber.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_