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

/home/runner/work/PyOptik/PyOptik/PyOptik/material/tabulated_class.py:273: UserWarning: Wavelength range goes from 1.31 micrometer to 1.55 micrometer which is outside the allowable range of 40.0 micrometer to 200.0 micrometer µm. [Material: Smith]
self._check_wavelength(wavelength, out_of_range)
/home/runner/work/PyOptik/PyOptik/PyOptik/material/tabulated_class.py:288: MaterialValidationWarning: The material contains gain; passive data requires imag(n) >= 0. Use allow_gain=True for active materials.
validate_refractive_indices(index, policy=validation, allow_negative_index=allow_negative_index, allow_gain=allow_gain)
from TypedUnit import ureg
from PyOptik import MaterialCatalog
# Load the tabulated Smith polyethylene dataset
catalog = MaterialCatalog.from_snapshot()
material = catalog.get("organic/polyethylene/Smith").load()
# Calculate refractive index at specific wavelengths
RI = material.compute_refractive_index(wavelength=[1310, 1550] * ureg.nanometer)
# Display calculated refractive indices at sample wavelengths
material.plot()
Total running time of the script: (0 minutes 0.786 seconds)