Note
Go to the end to download the full example code
Searching the MaterialBank#
This example shows how to locate materials using patterns with
search()
and then load a
material for analysis.
Matches:
- fused_silica
- silver
- silicon
Refractive index at 1 µm:
1.450417409406875
from PyOptik import MaterialBank
from PyOptik.units import micrometer
# Find materials containing the substring 'si'
materials = MaterialBank.search("si")
print("Matches:")
for name in materials:
print("-", name)
# Use the first match
material = MaterialBank.get(materials[0])
print("\nRefractive index at 1 µm:")
print(material.compute_refractive_index(1 * micrometer))
Total running time of the script: (0 minutes 0.004 seconds)