.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/utils/create_tabulated_file.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_create_tabulated_file.py: Example: Create a Custom Tabulated Data YAML File ================================================= This example demonstrates how to create a custom YAML file containing tabulated `nk` data using the `create_tabulated_file` function from the `PyOptik.utils` module. .. GENERATED FROM PYTHON SOURCE LINES 10-38 .. image-sg:: /gallery/utils/images/sphx_glr_create_tabulated_file_001.png :alt: Refractive Index and Absorption vs. Wavelength [example_tabulated] :srcset: /gallery/utils/images/sphx_glr_create_tabulated_file_001.png :class: sphx-glr-single-img .. code-block:: Python from PyOptik import MaterialBank # Define the tabulated data (wavelength in micrometers, n, k) tabulated_data = [ (0.1879, 0.94, 1.337), (0.1916, 0.95, 1.388), (0.1953, 0.97, 1.440), (0.1993, 0.98, 1.493), (0.2033, 0.99, 1.550), ] # Define the file properties filename = 'example_tabulated' reference = "Example Reference for Tabulated Data" comments = "This file contains sample tabulated data for demonstration purposes. " # Call the function to create the file MaterialBank.create_tabulated_file( filename=filename, data=tabulated_data, reference=reference, comments=comments ) m = MaterialBank.get(filename) m.plot() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.331 seconds) .. _sphx_glr_download_gallery_utils_create_tabulated_file.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: create_tabulated_file.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: create_tabulated_file.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_