PyOptik 1.3.1.post0__tar.gz → 1.4.1.post0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/.gitignore +2 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PKG-INFO +1 -5
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/__init__.py +2 -1
- pyoptik-1.3.1.post0/PyOptik/download.py → pyoptik-1.4.1.post0/PyOptik/__main__.py +1 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/_version.py +2 -2
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/base_class.py +2 -0
- pyoptik-1.4.1.post0/PyOptik/material.py +129 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/sellmeier_class.py +4 -4
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/tabulated_class.py +2 -2
- pyoptik-1.4.1.post0/PyOptik/utils.py +171 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik.egg-info/PKG-INFO +1 -5
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik.egg-info/SOURCES.txt +60 -2
- pyoptik-1.4.1.post0/docs/examples/create_sellmeier_file.py +32 -0
- pyoptik-1.4.1.post0/docs/examples/create_tabulated_file.py +39 -0
- pyoptik-1.4.1.post0/docs/examples/download_yml_file.py +22 -0
- pyoptik-1.4.1.post0/docs/source/code.rst +60 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/conf.py +1 -0
- pyoptik-1.4.1.post0/docs/source/gallery/create_sellmeier_file.ipynb +43 -0
- pyoptik-1.4.1.post0/docs/source/gallery/create_sellmeier_file.py +32 -0
- pyoptik-1.4.1.post0/docs/source/gallery/create_sellmeier_file.py.md5 +1 -0
- pyoptik-1.4.1.post0/docs/source/gallery/create_sellmeier_file.rst +107 -0
- pyoptik-1.4.1.post0/docs/source/gallery/create_sellmeier_file_codeobj.pickle +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/create_tabulated_file.ipynb +43 -0
- pyoptik-1.4.1.post0/docs/source/gallery/create_tabulated_file.py +39 -0
- pyoptik-1.4.1.post0/docs/source/gallery/create_tabulated_file.py.md5 +1 -0
- pyoptik-1.4.1.post0/docs/source/gallery/create_tabulated_file.rst +114 -0
- pyoptik-1.4.1.post0/docs/source/gallery/create_tabulated_file_codeobj.pickle +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/download_yml_file.ipynb +43 -0
- pyoptik-1.4.1.post0/docs/source/gallery/download_yml_file.py +22 -0
- pyoptik-1.4.1.post0/docs/source/gallery/download_yml_file.py.md5 +1 -0
- pyoptik-1.4.1.post0/docs/source/gallery/download_yml_file.rst +96 -0
- pyoptik-1.4.1.post0/docs/source/gallery/download_yml_file_codeobj.pickle +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/images/sphx_glr_create_sellmeier_file_001.png +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/images/sphx_glr_create_tabulated_file_001.png +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/images/sphx_glr_download_yml_file_001.png +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/images/sphx_glr_plot_bk7_001.png +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/images/sphx_glr_plot_sf5_001.png +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/images/sphx_glr_plot_silica_001.png +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/images/sphx_glr_plot_silver_001.png +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/images/sphx_glr_plot_water_001.png +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/images/thumb/sphx_glr_create_sellmeier_file_thumb.png +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/images/thumb/sphx_glr_create_tabulated_file_thumb.png +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/images/thumb/sphx_glr_download_yml_file_thumb.png +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/images/thumb/sphx_glr_plot_bk7_thumb.png +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/images/thumb/sphx_glr_plot_sf5_thumb.png +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/images/thumb/sphx_glr_plot_silica_thumb.png +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/images/thumb/sphx_glr_plot_silver_thumb.png +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/images/thumb/sphx_glr_plot_water_thumb.png +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/index.rst +175 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_bk7.ipynb +43 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_bk7.py +21 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_bk7.py.md5 +1 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_bk7.rst +83 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_bk7_codeobj.pickle +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_sf5.ipynb +43 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_sf5.py +21 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_sf5.py.md5 +1 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_sf5.rst +84 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_sf5_codeobj.pickle +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_silica.ipynb +43 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_silica.py +21 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_silica.py.md5 +1 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_silica.rst +84 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_silica_codeobj.pickle +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_silver.ipynb +43 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_silver.py +22 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_silver.py.md5 +1 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_silver.rst +85 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_silver_codeobj.pickle +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_water.ipynb +43 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_water.py +22 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_water.py.md5 +1 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_water.rst +85 -0
- pyoptik-1.4.1.post0/docs/source/gallery/plot_water_codeobj.pickle +0 -0
- pyoptik-1.4.1.post0/docs/source/gallery/sg_execution_times.rst +27 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/index.rst +0 -1
- pyoptik-1.4.1.post0/docs/source/references.rst +4 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/pyproject.toml +0 -4
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/tests/test_usual_material.py +2 -2
- pyoptik-1.4.1.post0/tests/test_utils.py +75 -0
- pyoptik-1.3.1.post0/PyOptik/data/test.yml +0 -14
- pyoptik-1.3.1.post0/PyOptik/material.py +0 -88
- pyoptik-1.3.1.post0/PyOptik/utils.py +0 -81
- pyoptik-1.3.1.post0/docs/source/code.rst +0 -16
- pyoptik-1.3.1.post0/docs/source/gallery/index.rst +0 -103
- pyoptik-1.3.1.post0/docs/source/gallery/sg_execution_times.rst +0 -19
- pyoptik-1.3.1.post0/docs/source/references.rst +0 -4
- pyoptik-1.3.1.post0/tests/test_utils.py +0 -28
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/.github/dependabot.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/.github/workflows/coverage.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/.github/workflows/deploy_workflow.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/.readthedocs.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/LICENSE +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/__init__.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/BAK1.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/BK7.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/SF5.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/ZBLAN.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/__init__.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/argon.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/crown.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/default.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/flint.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/fluorine_doped_silica_1%.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/fluorine_doped_silica_2%.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/fused_silica.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/germanium.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/lithium_niobate.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/polystyren.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/silica.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/silicon.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/soda_lime_glass.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/sellmeier/water.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/tabulated/__init__.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/tabulated/aluminium.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/tabulated/calcium.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/tabulated/copper.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/tabulated/default.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/tabulated/gold.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/tabulated/iron.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/tabulated/nickel.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/tabulated/silver.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/tabulated/sodium.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/data/tabulated/zinc.yml +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik/directories.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik.egg-info/dependency_links.txt +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik.egg-info/requires.txt +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/PyOptik.egg-info/top_level.txt +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/README.rst +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/Makefile +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/deprecated/experiment_material.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/examples/README.rst +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/examples/plot_bk7.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/examples/plot_sf5.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/examples/plot_silica.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/examples/plot_silver.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/examples/plot_water.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/images/example_bk7.png +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/images/logo.png +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/make.bat +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/_static/default.css +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/add_material.ipynb +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/add_material.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/add_material.rst +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/add_material_codeobj.pickle +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/get_values.ipynb +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/get_values.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/get_values.rst +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/get_values_codeobj.pickle +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/images/sphx_glr_plot_sellmeier_0_001.png +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/images/sphx_glr_plot_sellmeier_1_001.png +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/images/thumb/sphx_glr_add_material_thumb.png +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/images/thumb/sphx_glr_get_values_thumb.png +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/images/thumb/sphx_glr_plot_sellmeier_0_thumb.png +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/images/thumb/sphx_glr_plot_sellmeier_1_thumb.png +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/plot_sellmeier_0.ipynb +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/plot_sellmeier_0.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/plot_sellmeier_0.py.md5 +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/plot_sellmeier_0.rst +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/plot_sellmeier_0_codeobj.pickle +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/plot_sellmeier_1.ipynb +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/plot_sellmeier_1.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/plot_sellmeier_1.py.md5 +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/plot_sellmeier_1.rst +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/docs/source/gallery/plot_sellmeier_1_codeobj.pickle +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/setup.cfg +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/tests/__init__.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/tests/test_sellmeier.py +0 -0
- {pyoptik-1.3.1.post0 → pyoptik-1.4.1.post0}/tests/test_tabulated.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyOptik
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.1.post0
|
|
4
4
|
Summary: A package for refractive index values.
|
|
5
5
|
Author-email: Martin Poinsinet de Sivry-Houle <martin.poinsinet.de.sivry@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -28,10 +28,6 @@ License: MIT License
|
|
|
28
28
|
Keywords: refracive index,optics
|
|
29
29
|
Classifier: Programming Language :: Python
|
|
30
30
|
Classifier: Programming Language :: Python :: 3
|
|
31
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
32
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
33
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
34
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
35
31
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
36
32
|
Classifier: Development Status :: 4 - Beta
|
|
37
33
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
@@ -12,5 +12,5 @@ __version__: str
|
|
|
12
12
|
__version_tuple__: VERSION_TUPLE
|
|
13
13
|
version_tuple: VERSION_TUPLE
|
|
14
14
|
|
|
15
|
-
__version__ = version = '1.
|
|
16
|
-
__version_tuple__ = version_tuple = (1,
|
|
15
|
+
__version__ = version = '1.4.1.post0'
|
|
16
|
+
__version_tuple__ = version_tuple = (1, 4, 1)
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
from typing import Union
|
|
5
|
+
from PyOptik.sellmeier_class import SellmeierMaterial
|
|
6
|
+
from PyOptik.tabulated_class import TabulatedMaterial
|
|
7
|
+
from PyOptik import data
|
|
8
|
+
|
|
9
|
+
class staticproperty(property):
|
|
10
|
+
"""
|
|
11
|
+
A descriptor that mimics the behavior of a @property but for class-level access.
|
|
12
|
+
|
|
13
|
+
This allows a method to be accessed like a static property without the need to instantiate the class.
|
|
14
|
+
"""
|
|
15
|
+
def __get__(self, owner_self, owner_cls):
|
|
16
|
+
return self.fget()
|
|
17
|
+
|
|
18
|
+
class UsualMaterial:
|
|
19
|
+
"""
|
|
20
|
+
A class representing common materials available in the PyOptik library.
|
|
21
|
+
|
|
22
|
+
This class provides easy access to a predefined list of materials, either through static properties or
|
|
23
|
+
a dynamic getter method. Materials are categorized into Sellmeier and Tabulated materials.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
all_materials = [
|
|
27
|
+
'silver',
|
|
28
|
+
'gold',
|
|
29
|
+
'aluminium',
|
|
30
|
+
'copper',
|
|
31
|
+
'zinc',
|
|
32
|
+
'iron',
|
|
33
|
+
'argon',
|
|
34
|
+
'water',
|
|
35
|
+
'silicon',
|
|
36
|
+
'BK7',
|
|
37
|
+
'fused_silica',
|
|
38
|
+
'germanium',
|
|
39
|
+
'polystyren'
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
@staticmethod
|
|
43
|
+
def get(material_name: str) -> Union[SellmeierMaterial, TabulatedMaterial]:
|
|
44
|
+
"""
|
|
45
|
+
Retrieve a material by name.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
material_name (str): The name of the material to retrieve.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
Union[SellmeierMaterial, TabulatedMaterial]: An instance of the material if found.
|
|
52
|
+
|
|
53
|
+
Raises:
|
|
54
|
+
FileNotFoundError: If the material is not found in either the Sellmeier or Tabulated lists.
|
|
55
|
+
"""
|
|
56
|
+
if material_name in data.sellmeier.material_list:
|
|
57
|
+
return SellmeierMaterial(material_name)
|
|
58
|
+
|
|
59
|
+
if material_name in data.tabulated.material_list:
|
|
60
|
+
return TabulatedMaterial(material_name)
|
|
61
|
+
|
|
62
|
+
raise FileNotFoundError(f'Material: [{material_name}] could not be found.')
|
|
63
|
+
|
|
64
|
+
# Static properties for each material
|
|
65
|
+
|
|
66
|
+
@staticproperty
|
|
67
|
+
def silver() -> TabulatedMaterial:
|
|
68
|
+
"""Get the TabulatedMaterial instance for silver."""
|
|
69
|
+
return TabulatedMaterial('silver')
|
|
70
|
+
|
|
71
|
+
@staticproperty
|
|
72
|
+
def gold() -> TabulatedMaterial:
|
|
73
|
+
"""Get the TabulatedMaterial instance for gold."""
|
|
74
|
+
return TabulatedMaterial('gold')
|
|
75
|
+
|
|
76
|
+
@staticproperty
|
|
77
|
+
def aluminium() -> TabulatedMaterial:
|
|
78
|
+
"""Get the TabulatedMaterial instance for aluminium."""
|
|
79
|
+
return TabulatedMaterial('aluminium')
|
|
80
|
+
|
|
81
|
+
@staticproperty
|
|
82
|
+
def copper() -> TabulatedMaterial:
|
|
83
|
+
"""Get the TabulatedMaterial instance for copper."""
|
|
84
|
+
return TabulatedMaterial('copper')
|
|
85
|
+
|
|
86
|
+
@staticproperty
|
|
87
|
+
def zinc() -> TabulatedMaterial:
|
|
88
|
+
"""Get the TabulatedMaterial instance for zinc."""
|
|
89
|
+
return TabulatedMaterial('zinc')
|
|
90
|
+
|
|
91
|
+
@staticproperty
|
|
92
|
+
def iron() -> TabulatedMaterial:
|
|
93
|
+
"""Get the TabulatedMaterial instance for iron."""
|
|
94
|
+
return TabulatedMaterial('iron')
|
|
95
|
+
|
|
96
|
+
@staticproperty
|
|
97
|
+
def polystyren() -> SellmeierMaterial:
|
|
98
|
+
"""Get the SellmeierMaterial instance for polystyren."""
|
|
99
|
+
return SellmeierMaterial('polystyren')
|
|
100
|
+
|
|
101
|
+
@staticproperty
|
|
102
|
+
def argon() -> SellmeierMaterial:
|
|
103
|
+
"""Get the SellmeierMaterial instance for argon."""
|
|
104
|
+
return SellmeierMaterial('argon')
|
|
105
|
+
|
|
106
|
+
@staticproperty
|
|
107
|
+
def water() -> SellmeierMaterial:
|
|
108
|
+
"""Get the SellmeierMaterial instance for water."""
|
|
109
|
+
return SellmeierMaterial('water')
|
|
110
|
+
|
|
111
|
+
@staticproperty
|
|
112
|
+
def silicon() -> SellmeierMaterial:
|
|
113
|
+
"""Get the SellmeierMaterial instance for silicon."""
|
|
114
|
+
return SellmeierMaterial('silicon')
|
|
115
|
+
|
|
116
|
+
@staticproperty
|
|
117
|
+
def BK7() -> SellmeierMaterial:
|
|
118
|
+
"""Get the SellmeierMaterial instance for BK7."""
|
|
119
|
+
return SellmeierMaterial('BK7')
|
|
120
|
+
|
|
121
|
+
@staticproperty
|
|
122
|
+
def fused_silica() -> SellmeierMaterial:
|
|
123
|
+
"""Get the SellmeierMaterial instance for fused_silica."""
|
|
124
|
+
return SellmeierMaterial('fused_silica')
|
|
125
|
+
|
|
126
|
+
@staticproperty
|
|
127
|
+
def germanium() -> SellmeierMaterial:
|
|
128
|
+
"""Get the SellmeierMaterial instance for germanium."""
|
|
129
|
+
return SellmeierMaterial('germanium')
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
from dataclasses import dataclass, field
|
|
5
5
|
import matplotlib.pyplot as plt
|
|
6
6
|
import numpy
|
|
7
|
-
from typing import Tuple, Optional, Union,
|
|
7
|
+
from typing import Tuple, Optional, Union, List
|
|
8
8
|
import yaml
|
|
9
9
|
from PyOptik.directories import sellmeier_data_path
|
|
10
10
|
import itertools
|
|
@@ -30,9 +30,9 @@ class SellmeierMaterial(Material):
|
|
|
30
30
|
"""
|
|
31
31
|
Loads the Sellmeier coefficients, wavelength range, formula type, and reference from the specified YAML file.
|
|
32
32
|
"""
|
|
33
|
-
file_path = sellmeier_data_path / f'{self.filename}
|
|
33
|
+
file_path = sellmeier_data_path / f'{self.filename}'
|
|
34
34
|
|
|
35
|
-
with open(file_path, 'r') as file:
|
|
35
|
+
with open(file_path.with_suffix('.yml'), 'r') as file:
|
|
36
36
|
parsed_yaml = yaml.safe_load(file)
|
|
37
37
|
|
|
38
38
|
# Extract the formula type
|
|
@@ -129,7 +129,7 @@ class SellmeierMaterial(Material):
|
|
|
129
129
|
return n
|
|
130
130
|
|
|
131
131
|
|
|
132
|
-
def plot(self, wavelength: Optional[List[float]] = None) ->
|
|
132
|
+
def plot(self, wavelength: Optional[List[float]] = None) -> None:
|
|
133
133
|
"""
|
|
134
134
|
Plots the refractive index as a function of wavelength over a specified range.
|
|
135
135
|
|
|
@@ -30,9 +30,9 @@ class TabulatedMaterial(Material):
|
|
|
30
30
|
"""
|
|
31
31
|
Loads the tabulated refractive index and absorption values from the specified YAML file.
|
|
32
32
|
"""
|
|
33
|
-
file_path = tabulated_data_path / f'{self.filename}
|
|
33
|
+
file_path = tabulated_data_path / f'{self.filename}'
|
|
34
34
|
|
|
35
|
-
with open(file_path, 'r') as file:
|
|
35
|
+
with open(file_path.with_suffix('.yml'), 'r') as file:
|
|
36
36
|
parsed_yaml = yaml.safe_load(file)
|
|
37
37
|
|
|
38
38
|
# Extract data points
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
|
|
2
|
+
import yaml
|
|
3
|
+
from typing import Optional, List, Tuple
|
|
4
|
+
import requests
|
|
5
|
+
from PyOptik.directories import sellmeier_data_path, tabulated_data_path
|
|
6
|
+
from PyOptik.data.sellmeier.default import default_material as sellmeier_default
|
|
7
|
+
from PyOptik.data.tabulated.default import default_material as tabulated_default
|
|
8
|
+
|
|
9
|
+
def download_yml_file(url: str, filename: str, location: str) -> None:
|
|
10
|
+
"""
|
|
11
|
+
Downloads a .yml file from a specified URL and saves it locally.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
url (str): The URL of the .yml file to download.
|
|
15
|
+
save_path (str): The local path where the .yml file should be saved.
|
|
16
|
+
|
|
17
|
+
Raises:
|
|
18
|
+
HTTPError: If the download fails due to an HTTP error.
|
|
19
|
+
"""
|
|
20
|
+
file_path = location / f"{filename}.yml"
|
|
21
|
+
try:
|
|
22
|
+
# Send a GET request to the URL
|
|
23
|
+
response = requests.get(url)
|
|
24
|
+
response.raise_for_status() # Raise an error for bad status codes
|
|
25
|
+
|
|
26
|
+
# Save the content of the response as a file
|
|
27
|
+
file_path.parent.mkdir(parents=True, exist_ok=True) # Create directories if they don't exist
|
|
28
|
+
|
|
29
|
+
with open(file_path, 'wb') as file:
|
|
30
|
+
file.write(response.content)
|
|
31
|
+
|
|
32
|
+
print(f"File downloaded and saved to {file_path}")
|
|
33
|
+
|
|
34
|
+
except requests.exceptions.HTTPError as http_err:
|
|
35
|
+
print(f"HTTP error occurred: {http_err}")
|
|
36
|
+
except Exception as err:
|
|
37
|
+
print(f"An error occurred: {err}")
|
|
38
|
+
|
|
39
|
+
def build_default_library() -> None:
|
|
40
|
+
"""
|
|
41
|
+
Downloads and saves the default materials from the specified URLs.
|
|
42
|
+
"""
|
|
43
|
+
from PyOptik.utils import download_yml_file
|
|
44
|
+
|
|
45
|
+
for name, url in sellmeier_default.items():
|
|
46
|
+
download_yml_file(url=url, filename=name, location=sellmeier_data_path)
|
|
47
|
+
|
|
48
|
+
for name, url in tabulated_default.items():
|
|
49
|
+
download_yml_file(url=url, filename=name, location=tabulated_data_path)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def remove_element(filename: str, location: str = 'any') -> None:
|
|
53
|
+
"""
|
|
54
|
+
Remove a file associated with a given element name from the specified location.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
filename (str): The name of the file to remove, without the '.yml' suffix.
|
|
58
|
+
location (str): The location to search for the file, either 'sellmeier', 'tabulated', or 'any' (default is 'any').
|
|
59
|
+
|
|
60
|
+
Raises:
|
|
61
|
+
FileNotFoundError: If the specified file does not exist.
|
|
62
|
+
ValueError: If an invalid location is provided.
|
|
63
|
+
"""
|
|
64
|
+
location = location.lower()
|
|
65
|
+
|
|
66
|
+
if location not in ['any', 'sellmeier', 'tabulated']:
|
|
67
|
+
raise ValueError("Invalid location. Please choose 'sellmeier', 'tabulated', or 'any'.")
|
|
68
|
+
|
|
69
|
+
if location in ['any', 'sellmeier']:
|
|
70
|
+
sellmeier_file = sellmeier_data_path / f"{filename}.yml"
|
|
71
|
+
if sellmeier_file.exists():
|
|
72
|
+
sellmeier_file.unlink()
|
|
73
|
+
|
|
74
|
+
if location in ['any', 'tabulated']:
|
|
75
|
+
tabulated_file = tabulated_data_path / f"{filename}.yml"
|
|
76
|
+
if tabulated_file.exists():
|
|
77
|
+
tabulated_file.unlink()
|
|
78
|
+
|
|
79
|
+
def create_sellmeier_file(
|
|
80
|
+
filename: str,
|
|
81
|
+
formula_type: int,
|
|
82
|
+
coefficients: List[float],
|
|
83
|
+
wavelength_range: Optional[Tuple[float, float]] = None,
|
|
84
|
+
reference: Optional[str] = None,
|
|
85
|
+
comments: Optional[str] = None,
|
|
86
|
+
specs: Optional[dict] = None) -> None:
|
|
87
|
+
"""
|
|
88
|
+
Creates a YAML file with custom Sellmeier coefficients in the correct format.
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
filename (str): The name of the file to create (without the extension).
|
|
92
|
+
formula_type (int): The type of Sellmeier formula.
|
|
93
|
+
coefficients (list[float]): A list of coefficients for the Sellmeier equation.
|
|
94
|
+
wavelength_range (Tuple[float, float]): The range of wavelengths, in micrometers.
|
|
95
|
+
reference (str): A reference for the material data.
|
|
96
|
+
comments (Optional[str]): Additional comments about the material.
|
|
97
|
+
specs (Optional[dict]): Additional specifications, such as temperature and whether the wavelength is in a vacuum.
|
|
98
|
+
"""
|
|
99
|
+
reference = 'None' if reference is None else reference
|
|
100
|
+
wavelength_range = [None, None] if wavelength_range is None else wavelength_range
|
|
101
|
+
# Create the data dictionary for YAML
|
|
102
|
+
data = {
|
|
103
|
+
'REFERENCES': reference,
|
|
104
|
+
'DATA': [
|
|
105
|
+
{
|
|
106
|
+
'type': f'formula {formula_type}',
|
|
107
|
+
'wavelength_range': f"{wavelength_range[0]} {wavelength_range[1]}",
|
|
108
|
+
'coefficients': " ".join(map(str, coefficients)),
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
# Add comments if provided
|
|
114
|
+
if comments:
|
|
115
|
+
data['COMMENTS'] = comments
|
|
116
|
+
|
|
117
|
+
# Add specs if provided
|
|
118
|
+
if specs:
|
|
119
|
+
data['SPECS'] = specs
|
|
120
|
+
|
|
121
|
+
# Define the file path
|
|
122
|
+
file_path = sellmeier_data_path / f"{filename}.yml"
|
|
123
|
+
|
|
124
|
+
# Write the data to a YAML file
|
|
125
|
+
with open(file_path, 'w') as file:
|
|
126
|
+
yaml.dump(data, file, default_flow_style=False)
|
|
127
|
+
|
|
128
|
+
print(f"Sellmeier data saved to {file_path}")
|
|
129
|
+
|
|
130
|
+
def create_tabulated_file(
|
|
131
|
+
filename: str,
|
|
132
|
+
data: List[Tuple[float, float, float]],
|
|
133
|
+
reference: Optional[str] = None,
|
|
134
|
+
comments: Optional[str] = None) -> None:
|
|
135
|
+
"""
|
|
136
|
+
Creates a YAML file with tabulated nk data in the correct format.
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
filename (str): The name of the file to create (without the extension).
|
|
140
|
+
data (List[Tuple[float, float, float]]): The tabulated nk data.
|
|
141
|
+
reference (Optional[str]): A reference for the material data.
|
|
142
|
+
comments (Optional[str]): Additional comments about the material.
|
|
143
|
+
"""
|
|
144
|
+
reference = 'None' if reference is None else reference
|
|
145
|
+
|
|
146
|
+
# Convert the data list to a formatted string
|
|
147
|
+
data_str = "\n".join(" ".join(map(str, row)) for row in data)
|
|
148
|
+
|
|
149
|
+
# Create the data dictionary for YAML
|
|
150
|
+
yaml_data = {
|
|
151
|
+
'REFERENCES': reference,
|
|
152
|
+
'DATA': [
|
|
153
|
+
{
|
|
154
|
+
'type': 'tabulated nk',
|
|
155
|
+
'data': data_str,
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
# Add comments if provided
|
|
161
|
+
if comments:
|
|
162
|
+
yaml_data['COMMENTS'] = comments
|
|
163
|
+
|
|
164
|
+
# Define the file path
|
|
165
|
+
file_path = tabulated_data_path / f"{filename}.yml"
|
|
166
|
+
|
|
167
|
+
# Write the data to a YAML file
|
|
168
|
+
with open(file_path, 'w') as file:
|
|
169
|
+
yaml.dump(yaml_data, file, default_flow_style=False)
|
|
170
|
+
|
|
171
|
+
print(f"Tabulated nk data saved to {file_path}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyOptik
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.1.post0
|
|
4
4
|
Summary: A package for refractive index values.
|
|
5
5
|
Author-email: Martin Poinsinet de Sivry-Houle <martin.poinsinet.de.sivry@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -28,10 +28,6 @@ License: MIT License
|
|
|
28
28
|
Keywords: refracive index,optics
|
|
29
29
|
Classifier: Programming Language :: Python
|
|
30
30
|
Classifier: Programming Language :: Python :: 3
|
|
31
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
32
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
33
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
34
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
35
31
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
36
32
|
Classifier: Development Status :: 4 - Beta
|
|
37
33
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
@@ -7,10 +7,10 @@ pyproject.toml
|
|
|
7
7
|
.github/workflows/coverage.yml
|
|
8
8
|
.github/workflows/deploy_workflow.yml
|
|
9
9
|
PyOptik/__init__.py
|
|
10
|
+
PyOptik/__main__.py
|
|
10
11
|
PyOptik/_version.py
|
|
11
12
|
PyOptik/base_class.py
|
|
12
13
|
PyOptik/directories.py
|
|
13
|
-
PyOptik/download.py
|
|
14
14
|
PyOptik/material.py
|
|
15
15
|
PyOptik/sellmeier_class.py
|
|
16
16
|
PyOptik/tabulated_class.py
|
|
@@ -21,7 +21,6 @@ PyOptik.egg-info/dependency_links.txt
|
|
|
21
21
|
PyOptik.egg-info/requires.txt
|
|
22
22
|
PyOptik.egg-info/top_level.txt
|
|
23
23
|
PyOptik/data/__init__.py
|
|
24
|
-
PyOptik/data/test.yml
|
|
25
24
|
PyOptik/data/sellmeier/BAK1.yml
|
|
26
25
|
PyOptik/data/sellmeier/BK7.yml
|
|
27
26
|
PyOptik/data/sellmeier/SF5.yml
|
|
@@ -56,6 +55,9 @@ docs/Makefile
|
|
|
56
55
|
docs/make.bat
|
|
57
56
|
docs/deprecated/experiment_material.py
|
|
58
57
|
docs/examples/README.rst
|
|
58
|
+
docs/examples/create_sellmeier_file.py
|
|
59
|
+
docs/examples/create_tabulated_file.py
|
|
60
|
+
docs/examples/download_yml_file.py
|
|
59
61
|
docs/examples/plot_bk7.py
|
|
60
62
|
docs/examples/plot_sf5.py
|
|
61
63
|
docs/examples/plot_silica.py
|
|
@@ -72,11 +74,31 @@ docs/source/gallery/add_material.ipynb
|
|
|
72
74
|
docs/source/gallery/add_material.py
|
|
73
75
|
docs/source/gallery/add_material.rst
|
|
74
76
|
docs/source/gallery/add_material_codeobj.pickle
|
|
77
|
+
docs/source/gallery/create_sellmeier_file.ipynb
|
|
78
|
+
docs/source/gallery/create_sellmeier_file.py
|
|
79
|
+
docs/source/gallery/create_sellmeier_file.py.md5
|
|
80
|
+
docs/source/gallery/create_sellmeier_file.rst
|
|
81
|
+
docs/source/gallery/create_sellmeier_file_codeobj.pickle
|
|
82
|
+
docs/source/gallery/create_tabulated_file.ipynb
|
|
83
|
+
docs/source/gallery/create_tabulated_file.py
|
|
84
|
+
docs/source/gallery/create_tabulated_file.py.md5
|
|
85
|
+
docs/source/gallery/create_tabulated_file.rst
|
|
86
|
+
docs/source/gallery/create_tabulated_file_codeobj.pickle
|
|
87
|
+
docs/source/gallery/download_yml_file.ipynb
|
|
88
|
+
docs/source/gallery/download_yml_file.py
|
|
89
|
+
docs/source/gallery/download_yml_file.py.md5
|
|
90
|
+
docs/source/gallery/download_yml_file.rst
|
|
91
|
+
docs/source/gallery/download_yml_file_codeobj.pickle
|
|
75
92
|
docs/source/gallery/get_values.ipynb
|
|
76
93
|
docs/source/gallery/get_values.py
|
|
77
94
|
docs/source/gallery/get_values.rst
|
|
78
95
|
docs/source/gallery/get_values_codeobj.pickle
|
|
79
96
|
docs/source/gallery/index.rst
|
|
97
|
+
docs/source/gallery/plot_bk7.ipynb
|
|
98
|
+
docs/source/gallery/plot_bk7.py
|
|
99
|
+
docs/source/gallery/plot_bk7.py.md5
|
|
100
|
+
docs/source/gallery/plot_bk7.rst
|
|
101
|
+
docs/source/gallery/plot_bk7_codeobj.pickle
|
|
80
102
|
docs/source/gallery/plot_sellmeier_0.ipynb
|
|
81
103
|
docs/source/gallery/plot_sellmeier_0.py
|
|
82
104
|
docs/source/gallery/plot_sellmeier_0.py.md5
|
|
@@ -87,13 +109,49 @@ docs/source/gallery/plot_sellmeier_1.py
|
|
|
87
109
|
docs/source/gallery/plot_sellmeier_1.py.md5
|
|
88
110
|
docs/source/gallery/plot_sellmeier_1.rst
|
|
89
111
|
docs/source/gallery/plot_sellmeier_1_codeobj.pickle
|
|
112
|
+
docs/source/gallery/plot_sf5.ipynb
|
|
113
|
+
docs/source/gallery/plot_sf5.py
|
|
114
|
+
docs/source/gallery/plot_sf5.py.md5
|
|
115
|
+
docs/source/gallery/plot_sf5.rst
|
|
116
|
+
docs/source/gallery/plot_sf5_codeobj.pickle
|
|
117
|
+
docs/source/gallery/plot_silica.ipynb
|
|
118
|
+
docs/source/gallery/plot_silica.py
|
|
119
|
+
docs/source/gallery/plot_silica.py.md5
|
|
120
|
+
docs/source/gallery/plot_silica.rst
|
|
121
|
+
docs/source/gallery/plot_silica_codeobj.pickle
|
|
122
|
+
docs/source/gallery/plot_silver.ipynb
|
|
123
|
+
docs/source/gallery/plot_silver.py
|
|
124
|
+
docs/source/gallery/plot_silver.py.md5
|
|
125
|
+
docs/source/gallery/plot_silver.rst
|
|
126
|
+
docs/source/gallery/plot_silver_codeobj.pickle
|
|
127
|
+
docs/source/gallery/plot_water.ipynb
|
|
128
|
+
docs/source/gallery/plot_water.py
|
|
129
|
+
docs/source/gallery/plot_water.py.md5
|
|
130
|
+
docs/source/gallery/plot_water.rst
|
|
131
|
+
docs/source/gallery/plot_water_codeobj.pickle
|
|
90
132
|
docs/source/gallery/sg_execution_times.rst
|
|
133
|
+
docs/source/gallery/images/sphx_glr_create_sellmeier_file_001.png
|
|
134
|
+
docs/source/gallery/images/sphx_glr_create_tabulated_file_001.png
|
|
135
|
+
docs/source/gallery/images/sphx_glr_download_yml_file_001.png
|
|
136
|
+
docs/source/gallery/images/sphx_glr_plot_bk7_001.png
|
|
91
137
|
docs/source/gallery/images/sphx_glr_plot_sellmeier_0_001.png
|
|
92
138
|
docs/source/gallery/images/sphx_glr_plot_sellmeier_1_001.png
|
|
139
|
+
docs/source/gallery/images/sphx_glr_plot_sf5_001.png
|
|
140
|
+
docs/source/gallery/images/sphx_glr_plot_silica_001.png
|
|
141
|
+
docs/source/gallery/images/sphx_glr_plot_silver_001.png
|
|
142
|
+
docs/source/gallery/images/sphx_glr_plot_water_001.png
|
|
93
143
|
docs/source/gallery/images/thumb/sphx_glr_add_material_thumb.png
|
|
144
|
+
docs/source/gallery/images/thumb/sphx_glr_create_sellmeier_file_thumb.png
|
|
145
|
+
docs/source/gallery/images/thumb/sphx_glr_create_tabulated_file_thumb.png
|
|
146
|
+
docs/source/gallery/images/thumb/sphx_glr_download_yml_file_thumb.png
|
|
94
147
|
docs/source/gallery/images/thumb/sphx_glr_get_values_thumb.png
|
|
148
|
+
docs/source/gallery/images/thumb/sphx_glr_plot_bk7_thumb.png
|
|
95
149
|
docs/source/gallery/images/thumb/sphx_glr_plot_sellmeier_0_thumb.png
|
|
96
150
|
docs/source/gallery/images/thumb/sphx_glr_plot_sellmeier_1_thumb.png
|
|
151
|
+
docs/source/gallery/images/thumb/sphx_glr_plot_sf5_thumb.png
|
|
152
|
+
docs/source/gallery/images/thumb/sphx_glr_plot_silica_thumb.png
|
|
153
|
+
docs/source/gallery/images/thumb/sphx_glr_plot_silver_thumb.png
|
|
154
|
+
docs/source/gallery/images/thumb/sphx_glr_plot_water_thumb.png
|
|
97
155
|
tests/__init__.py
|
|
98
156
|
tests/test_sellmeier.py
|
|
99
157
|
tests/test_tabulated.py
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Example: Create a Custom Sellmeier YAML File
|
|
3
|
+
============================================
|
|
4
|
+
|
|
5
|
+
This example demonstrates how to create a custom Sellmeier YAML file using the
|
|
6
|
+
`create_sellmeier_file` function from the `PyOptik.utils` module.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from PyOptik.utils import create_sellmeier_file
|
|
10
|
+
from PyOptik.directories import sellmeier_data_path
|
|
11
|
+
from PyOptik import SellmeierMaterial
|
|
12
|
+
|
|
13
|
+
# Define the file properties
|
|
14
|
+
filename = 'example_sellmeier'
|
|
15
|
+
coefficients = [1.0, 0.5, 0.2, 0.1, 0.05]
|
|
16
|
+
formula_type = 1
|
|
17
|
+
|
|
18
|
+
# Call the function to create the file
|
|
19
|
+
create_sellmeier_file(
|
|
20
|
+
filename=filename,
|
|
21
|
+
coefficients=coefficients,
|
|
22
|
+
formula_type=formula_type,
|
|
23
|
+
wavelength_range=(0.2, 2.0),
|
|
24
|
+
reference="Sample Reference",
|
|
25
|
+
comments="This is a sample Sellmeier file created for demonstration purposes. "
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
print(f"Sellmeier YAML file {filename}.yml has been created in {sellmeier_data_path}")
|
|
29
|
+
|
|
30
|
+
m = SellmeierMaterial(filename)
|
|
31
|
+
|
|
32
|
+
m.plot()
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Example: Create a Custom Tabulated Data YAML File
|
|
3
|
+
=================================================
|
|
4
|
+
|
|
5
|
+
This example demonstrates how to create a custom YAML file containing tabulated
|
|
6
|
+
`nk` data using the `create_tabulated_file` function from the `PyOptik.utils` module.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from PyOptik.utils import create_tabulated_file
|
|
10
|
+
from PyOptik.directories import tabulated_data_path
|
|
11
|
+
from PyOptik import TabulatedMaterial
|
|
12
|
+
|
|
13
|
+
# Define the tabulated data (wavelength in micrometers, n, k)
|
|
14
|
+
tabulated_data = [
|
|
15
|
+
(0.1879, 0.94, 1.337),
|
|
16
|
+
(0.1916, 0.95, 1.388),
|
|
17
|
+
(0.1953, 0.97, 1.440),
|
|
18
|
+
(0.1993, 0.98, 1.493),
|
|
19
|
+
(0.2033, 0.99, 1.550),
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
# Define the file properties
|
|
23
|
+
filename = 'example_tabulated'
|
|
24
|
+
reference = "Example Reference for Tabulated Data"
|
|
25
|
+
comments = "This file contains sample tabulated data for demonstration purposes. "
|
|
26
|
+
|
|
27
|
+
# Call the function to create the file
|
|
28
|
+
create_tabulated_file(
|
|
29
|
+
filename=filename,
|
|
30
|
+
data=tabulated_data,
|
|
31
|
+
reference=reference,
|
|
32
|
+
comments=comments
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
print(f"Tabulated YAML file {filename}.yml has been created in {tabulated_data_path}")
|
|
36
|
+
|
|
37
|
+
m = TabulatedMaterial(filename)
|
|
38
|
+
|
|
39
|
+
m.plot()
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Example: Download a YAML file
|
|
3
|
+
=============================
|
|
4
|
+
|
|
5
|
+
This example demonstrates how to download a YAML file from a URL using the
|
|
6
|
+
`download_yml_file` function from the `PyOptik.utils` module.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from PyOptik.utils import download_yml_file
|
|
10
|
+
from PyOptik.directories import sellmeier_data_path
|
|
11
|
+
from PyOptik import SellmeierMaterial
|
|
12
|
+
|
|
13
|
+
# Define the URL of the YAML file and the destination
|
|
14
|
+
url = 'https://refractiveindex.info/database/data-nk/main/H2O/Daimon-19.0C.yml'
|
|
15
|
+
filename = 'example_download'
|
|
16
|
+
|
|
17
|
+
# Call the function to download the file
|
|
18
|
+
download_yml_file(filename=filename, url=url, location=sellmeier_data_path)
|
|
19
|
+
|
|
20
|
+
m = SellmeierMaterial('example_download')
|
|
21
|
+
|
|
22
|
+
m.plot()
|