Plot the Refractive Index and Absorption of Silicon#

This example uses PyOptik to visualise both the real and imaginary parts of the refractive index of silicon over a typical infrared wavelength range.

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)
/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(
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()
Silicon Refractive Index and Absorption

Total running time of the script: (0 minutes 0.351 seconds)

Gallery generated by Sphinx-Gallery