.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/tabulated/plot_silicon_nk.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_tabulated_plot_silicon_nk.py: Plot the Refractive Index and Absorption of Silicon =================================================== This example uses :mod:`PyOptik` to visualise both the real and imaginary parts of the refractive index of silicon over a typical infrared wavelength range. .. GENERATED FROM PYTHON SOURCE LINES 11-22 .. code-block:: Python import numpy import matplotlib.pyplot as plt from MPSPlots.styles import mps from PyOptik import MaterialBank from PyOptik.units import micrometer material = MaterialBank.silicon wavelengths = numpy.linspace(0.3, 1.1, 300) * micrometer index = material.compute_refractive_index(wavelengths) .. rst-class:: sphx-glr-script-out .. code-block:: none /opt/hostedtoolcache/Python/3.11.13/x64/lib/python3.11/site-packages/PyOptik/material/base_class.py:60: UserWarning: Wavelength range goes from 299.99999999999994 nm to 1.1 µm which is outside the allowable range of 206.6 nm to 826.5999999999999 nm µm. [Material: silicon] warnings.warn( .. GENERATED FROM PYTHON SOURCE LINES 23-40 .. code-block:: Python with plt.style.context(mps): fig, ax1 = plt.subplots() ax1.set( title="Silicon Refractive Index and Absorption", xlabel="Wavelength [µm]", ylabel="n", ) ax1.plot(wavelengths.to(micrometer).magnitude, index.real, label="n", color="tab:blue") ax1.legend(loc="upper left") ax2 = ax1.twinx() ax2.set(ylabel="k") ax2.plot(wavelengths.to(micrometer).magnitude, index.imag, color="tab:red", label="k") ax2.legend(loc="upper right") plt.show() .. image-sg:: /gallery/tabulated/images/sphx_glr_plot_silicon_nk_001.png :alt: Silicon Refractive Index and Absorption :srcset: /gallery/tabulated/images/sphx_glr_plot_silicon_nk_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.351 seconds) .. _sphx_glr_download_gallery_tabulated_plot_silicon_nk.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_silicon_nk.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_silicon_nk.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_