Note
Go to the end to download the full example code.
Plot the Refractive Index of Optical Material: BK7#
This module demonstrates the usage of the PyOptik library to calculate and plot the refractive index of the optical material BK7 glass over a specified range of wavelengths.

/home/runner/work/PyOptik/PyOptik/PyOptik/material/sellmeier_class.py:184: UserWarning: Wavelength range goes from 5.0 micrometer to 5.0 micrometer which is outside the allowable range of 309.99999999999994 nanometer to 2.5 micrometer µm. [Material: P-BK7]
self._check_wavelength(wavelength, out_of_range)
from PyOptik import MaterialCatalog
from TypedUnit import ureg
# Initialize the material with the Sellmeier model
catalog = MaterialCatalog.from_snapshot()
material = catalog.get("specs/SCHOTT-optical/P-BK7").load()
# Calculate refractive index at specific wavelengths
RI = material.compute_refractive_index(wavelength=[5_000] * ureg.nanometer)
# Display calculated refractive indices at sample wavelengths
material.plot()
Total running time of the script: (0 minutes 3.766 seconds)