.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/utils/search_materials.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_utils_search_materials.py: Searching the MaterialBank ========================== This example shows how to locate materials using patterns with :func:`~PyOptik.material_bank.MaterialBank.search` and then load a material for analysis. .. GENERATED FROM PYTHON SOURCE LINES 11-24 .. rst-class:: sphx-glr-script-out .. code-block:: none Matches: - fused_silica - silver - silicon Refractive index at 1 µm: 1.450417409406875 | .. code-block:: Python 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)) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.004 seconds) .. _sphx_glr_download_gallery_utils_search_materials.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: search_materials.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: search_materials.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_