Note
Go to the end to download the full example code
Group Index and Velocity of Fused Silica#
This example demonstrates how to compute and plot the group index and
group velocity of fused silica using PyOptik.
import numpy
import matplotlib.pyplot as plt
from TypedUnit import ureg
from PyOptik import MaterialCatalog
# Retrieve the material
catalog = MaterialCatalog.from_snapshot()
material = catalog.get("main/SiO2/Malitson").load()
# Compute values over a wavelength range
wavelengths = numpy.linspace(0.5, 1.6, 200) * ureg.micrometer
n_g = material.compute_group_index(wavelengths)
v_g = material.compute_group_velocity(wavelengths)
fig, ax1 = plt.subplots()
ax1.set(
xlabel="Wavelength [µm]",
ylabel="Group index",
title="Fused Silica Group Properties",
)
ax1.plot(wavelengths, n_g, label="n_g")
ax1.legend(loc="upper left")
ax2 = ax1.twinx()
ax2.set(ylabel="Group velocity [m/s]")
ax2.plot(
wavelengths,
v_g.to("m/s"),
color="tab:red",
label="v_g",
)
ax2.legend(loc="upper right")
plt.show()

/opt/hostedtoolcache/Python/3.11.16/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)
Total running time of the script: (0 minutes 1.385 seconds)