PyOptik 1.1.1.post0__tar.gz → 1.1.3.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.1.1.post0 → pyoptik-1.1.3.post0}/.coverage +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PKG-INFO +83 -35
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/__init__.py +2 -1
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/_version.py +2 -2
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/material.py +27 -25
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik.egg-info/PKG-INFO +83 -35
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik.egg-info/SOURCES.txt +3 -1
- pyoptik-1.1.3.post0/README.rst +108 -0
- pyoptik-1.1.3.post0/developments/testing.py +12 -0
- pyoptik-1.1.3.post0/tests/test_extra.py +12 -0
- pyoptik-1.1.3.post0/tests/test_usual_material.py +17 -0
- pyoptik-1.1.1.post0/README.rst +0 -60
- pyoptik-1.1.1.post0/developments/testing.py +0 -123
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/.github/dependabot.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/.github/workflows/coverage.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/.github/workflows/deploy_workflow.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/.gitignore +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/.readthedocs.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/LICENSE +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/base_class.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/__init__.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/BAK1.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/BK7.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/SF5.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/ZBLAN.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/__init__.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/argon.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/crown.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/default.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/flint.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/fluorine_doped_silica_1%.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/fluorine_doped_silica_2%.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/fused_silica.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/germanium.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/lithium_niobate.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/polystyren.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/silica.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/silicon.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/soda_lime_glass.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/test.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/water.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/__init__.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/aluminium.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/calcium.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/copper.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/default.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/gold.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/iron.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/nickel.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/silver.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/sodium.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/test.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/zinc.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/test.yml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/directories.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/download.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/sellmeier_class.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/tabulated_class.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/utils.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik.egg-info/dependency_links.txt +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik.egg-info/requires.txt +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik.egg-info/top_level.txt +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/Makefile +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/deprecated/experiment_material.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/examples/README.rst +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/examples/measurements_tio2.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/examples/measurements_water.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/examples/sellmeier_bk7.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/examples/sellmeier_sf5.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/examples/sellmeier_silica.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/images/logo.png +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/make.bat +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/_static/default.css +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/code.rst +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/conf.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/add_material.ipynb +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/add_material.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/add_material.rst +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/add_material_codeobj.pickle +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/get_values.ipynb +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/get_values.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/get_values.rst +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/get_values_codeobj.pickle +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/images/sphx_glr_plot_sellmeier_0_001.png +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/images/sphx_glr_plot_sellmeier_1_001.png +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/images/thumb/sphx_glr_add_material_thumb.png +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/images/thumb/sphx_glr_get_values_thumb.png +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/images/thumb/sphx_glr_plot_sellmeier_0_thumb.png +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/images/thumb/sphx_glr_plot_sellmeier_1_thumb.png +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/index.rst +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_0.ipynb +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_0.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_0.py.md5 +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_0.rst +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_0_codeobj.pickle +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_1.ipynb +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_1.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_1.py.md5 +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_1.rst +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_1_codeobj.pickle +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/sg_execution_times.rst +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/index.rst +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/references.rst +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/pyproject.toml +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/setup.cfg +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/tests/__init__.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/tests/test_sellmeier.py +0 -0
- {pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/tests/test_tabulated.py +0 -0
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyOptik
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.3.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
|
|
@@ -58,63 +58,111 @@ Requires-Dist: sphinx-gallery==0.15.0; extra == "documentation"
|
|
|
58
58
|
Requires-Dist: sphinx-rtd-theme==2.0.0; extra == "documentation"
|
|
59
59
|
Requires-Dist: pydata-sphinx-theme==0.14.1; extra == "documentation"
|
|
60
60
|
|
|
61
|
-
|
|
|
61
|
+
.. |python| image:: https://img.shields.io/pypi/pyversions/pyoptik.svg
|
|
62
|
+
:target: https://www.python.org/
|
|
63
|
+
|
|
64
|
+
.. |Logo| image:: https://github.com/MartinPdeS/PyOptik/raw/master/docs/images/logo.png
|
|
65
|
+
|
|
66
|
+
.. |docs| image:: https://readthedocs.org/projects/pyoptik/badge/?version=latest
|
|
67
|
+
:target: https://pyoptik.readthedocs.io/en/latest/
|
|
68
|
+
|
|
69
|
+
.. |PyPi| image:: https://badge.fury.io/py/pyoptik.svg
|
|
70
|
+
:target: https://badge.fury.io/py/pyoptik
|
|
71
|
+
|
|
72
|
+
.. |PyPi_download| image:: https://img.shields.io/pypi/dm/pyoptik.svg
|
|
73
|
+
:target: https://pypistats.org/packages/pyoptik
|
|
62
74
|
|
|
63
|
-
|python
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|PyPi|
|
|
67
|
-
|PyPi_download|
|
|
75
|
+
.. |coverage| image:: https://raw.githubusercontent.com/MartinPdeS/PyOptik/python-coverage-comment-action-data/badge.svg
|
|
76
|
+
:alt: Unittest coverage
|
|
77
|
+
:target: https://htmlpreview.github.io/?https://github.com/MartinPdeS/PyOptik/blob/python-coverage-comment-action-data/htmlcov/index.html
|
|
68
78
|
|
|
69
79
|
PyOptik
|
|
70
80
|
=======
|
|
71
81
|
|
|
82
|
+
PyOptik is a powerful Python tool designed to import refractive indexes and extinction coefficients for various materials across different wavelengths. The data provided by PyOptik can be used in numerous applications, including simulating light interactions with particles. All data is sourced from the reputable RefractiveIndex.INFO database.
|
|
72
83
|
|
|
84
|
+
|Logo|
|
|
73
85
|
|
|
74
|
-
|
|
75
|
-
coefficients for different materials at different wavelengths. This data can then
|
|
76
|
-
be used for different applications like simulating light interaction's with
|
|
77
|
-
particules. All the data comes from RefractiveIndex.INFO.
|
|
86
|
+
|python| |docs| |PyPi| |PyPi_download| |coverage|
|
|
78
87
|
|
|
79
|
-
|
|
88
|
+
Features
|
|
89
|
+
********
|
|
90
|
+
- **Comprehensive Database Access**: Seamlessly import refractive index and extinction coefficient data for a wide range of materials.
|
|
91
|
+
- **Simulation Ready**: Ideal for light-matter interaction simulations, particularly in optics and photonics.
|
|
92
|
+
- **Simple API**: Easy-to-use API that integrates well with other Python libraries.
|
|
93
|
+
- **Open Source**: Fully open-source.
|
|
94
|
+
|
|
95
|
+
Installation
|
|
96
|
+
************
|
|
97
|
+
|
|
98
|
+
To install PyOptik, simply use pip:
|
|
99
|
+
|
|
100
|
+
.. code:: bash
|
|
101
|
+
|
|
102
|
+
pip install pyoptik
|
|
103
|
+
|
|
104
|
+
Usage
|
|
105
|
+
*****
|
|
106
|
+
|
|
107
|
+
After installing PyOptik, you can easily access material properties:
|
|
108
|
+
|
|
109
|
+
.. code:: python
|
|
110
|
+
|
|
111
|
+
from PyOptik import UsualMaterial
|
|
112
|
+
|
|
113
|
+
# Access the refractive index of BK7 glass
|
|
114
|
+
bk7 = UsualMaterial.BK7
|
|
115
|
+
n = bk7.compute_refractive_index(0.55e-6)
|
|
116
|
+
print(f"Refractive index at 0.55 µm: {n}")
|
|
117
|
+
|
|
118
|
+
# Accessing and plotting material properties
|
|
119
|
+
bk7.plot(wavelength_range=[0.3e-6, 2.5e-6])
|
|
120
|
+
|
|
121
|
+
Example
|
|
80
122
|
*******
|
|
81
123
|
|
|
82
|
-
|
|
124
|
+
Here’s a quick example demonstrating how to use PyOptik to retrieve and plot the refractive index of a material:
|
|
83
125
|
|
|
84
126
|
.. code:: python
|
|
85
127
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
>>> pip install -r requirements/requirements.txt
|
|
89
|
-
>>> pytest
|
|
128
|
+
import numpy as np
|
|
129
|
+
from PyOptik import UsualMaterial
|
|
90
130
|
|
|
91
|
-
|
|
131
|
+
# Define wavelength range
|
|
132
|
+
wavelengths = np.linspace(0.3e-6, 2.5e-6, 100)
|
|
92
133
|
|
|
134
|
+
# Retrieve refractive index for BK7 glass
|
|
135
|
+
bk7 = UsualMaterial.BK7
|
|
136
|
+
n_values = bk7.compute_refractive_index(wavelengths)
|
|
93
137
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
As of 2024, the project is still under development. If you want to collaborate, it would be a pleasure! I encourage you to contact me.
|
|
138
|
+
# Plot the results
|
|
139
|
+
bk7.plot(wavelength_range=wavelengths)
|
|
97
140
|
|
|
98
|
-
|
|
141
|
+
Testing
|
|
142
|
+
*******
|
|
99
143
|
|
|
100
|
-
|
|
144
|
+
To test locally after cloning the GitHub repository, install the dependencies and run the tests:
|
|
101
145
|
|
|
146
|
+
.. code:: bash
|
|
102
147
|
|
|
103
|
-
|
|
104
|
-
|
|
148
|
+
git clone https://github.com/MartinPdeS/PyOptik.git
|
|
149
|
+
cd PyOptik
|
|
150
|
+
pip install .
|
|
151
|
+
pytest
|
|
105
152
|
|
|
106
|
-
|
|
153
|
+
Contributing
|
|
154
|
+
************
|
|
107
155
|
|
|
108
|
-
|
|
109
|
-
:target: https://pyoptik.readthedocs.io/en/latest/
|
|
156
|
+
PyOptik is open to contributions. Whether you're fixing bugs, adding new features, or improving documentation, your help is welcome! Please feel free to fork the repository and submit pull requests.
|
|
110
157
|
|
|
111
|
-
|
|
112
|
-
|
|
158
|
+
Contact Information
|
|
159
|
+
*******************
|
|
160
|
+
|
|
161
|
+
As of 2024, PyOptik is still under development. If you would like to collaborate, it would be a pleasure to hear from you. Contact me at:
|
|
162
|
+
|
|
163
|
+
**Author**: `Martin Poinsinet de Sivry-Houle <https://github.com/MartinPdS>`_
|
|
164
|
+
|
|
165
|
+
**Email**: `martin.poinsinet.de.sivry@gmail.com <mailto:martin.poinsinet.de.sivry@gmail.com?subject=PyOptik>`_
|
|
113
166
|
|
|
114
|
-
.. |PyPi_download| image:: https://img.shields.io/pypi/dm/pyoptik.svg
|
|
115
|
-
:target: https://pypistats.org/packages/pyoptik
|
|
116
167
|
|
|
117
|
-
.. |coverage| image:: https://raw.githubusercontent.com/MartinPdeS/PyOptik/python-coverage-comment-action-data/badge.svg
|
|
118
|
-
:alt: Unittest coverage
|
|
119
|
-
:target: https://htmlpreview.github.io/?https://github.com/MartinPdeS/PyOptik/blob/python-coverage-comment-action-data/htmlcov/index.html
|
|
120
168
|
|
|
@@ -12,5 +12,5 @@ __version__: str
|
|
|
12
12
|
__version_tuple__: VERSION_TUPLE
|
|
13
13
|
version_tuple: VERSION_TUPLE
|
|
14
14
|
|
|
15
|
-
__version__ = version = '1.1.
|
|
16
|
-
__version_tuple__ = version_tuple = (1, 1,
|
|
15
|
+
__version__ = version = '1.1.3.post0'
|
|
16
|
+
__version_tuple__ = version_tuple = (1, 1, 3)
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
from PyOptik.sellmeier_class import SellmeierMaterial
|
|
2
2
|
from PyOptik.tabulated_class import TabulatedMaterial
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
class staticproperty(property):
|
|
5
|
+
def __get__(self, owner_self, owner_cls):
|
|
6
|
+
return self.fget()
|
|
5
7
|
|
|
6
8
|
class UsualMaterial:
|
|
7
9
|
all = [
|
|
@@ -19,50 +21,50 @@ class UsualMaterial:
|
|
|
19
21
|
'germanium',
|
|
20
22
|
]
|
|
21
23
|
|
|
22
|
-
@
|
|
23
|
-
def silver(
|
|
24
|
+
@staticproperty
|
|
25
|
+
def silver():
|
|
24
26
|
return TabulatedMaterial('silver')
|
|
25
27
|
|
|
26
|
-
@
|
|
27
|
-
def gold(
|
|
28
|
+
@staticproperty
|
|
29
|
+
def gold():
|
|
28
30
|
return TabulatedMaterial('gold')
|
|
29
31
|
|
|
30
|
-
@
|
|
31
|
-
def aluminium(
|
|
32
|
+
@staticproperty
|
|
33
|
+
def aluminium():
|
|
32
34
|
return TabulatedMaterial('aluminium')
|
|
33
35
|
|
|
34
|
-
@
|
|
35
|
-
def copper(
|
|
36
|
+
@staticproperty
|
|
37
|
+
def copper():
|
|
36
38
|
return TabulatedMaterial('copper')
|
|
37
39
|
|
|
38
|
-
@
|
|
39
|
-
def zinc(
|
|
40
|
+
@staticproperty
|
|
41
|
+
def zinc():
|
|
40
42
|
return TabulatedMaterial('zinc')
|
|
41
43
|
|
|
42
|
-
@
|
|
43
|
-
def iron(
|
|
44
|
+
@staticproperty
|
|
45
|
+
def iron():
|
|
44
46
|
return TabulatedMaterial('iron')
|
|
45
47
|
|
|
46
|
-
@
|
|
47
|
-
def argon(
|
|
48
|
+
@staticproperty
|
|
49
|
+
def argon():
|
|
48
50
|
return SellmeierMaterial('argon')
|
|
49
51
|
|
|
50
|
-
@
|
|
51
|
-
def water(
|
|
52
|
+
@staticproperty
|
|
53
|
+
def water():
|
|
52
54
|
return SellmeierMaterial('water')
|
|
53
55
|
|
|
54
|
-
@
|
|
55
|
-
def silicon(
|
|
56
|
+
@staticproperty
|
|
57
|
+
def silicon():
|
|
56
58
|
return SellmeierMaterial('silicon')
|
|
57
59
|
|
|
58
|
-
@
|
|
59
|
-
def BK7(
|
|
60
|
+
@staticproperty
|
|
61
|
+
def BK7():
|
|
60
62
|
return SellmeierMaterial('BK7')
|
|
61
63
|
|
|
62
|
-
@
|
|
63
|
-
def fused_silica(
|
|
64
|
+
@staticproperty
|
|
65
|
+
def fused_silica():
|
|
64
66
|
return SellmeierMaterial('fused_silica')
|
|
65
67
|
|
|
66
|
-
@
|
|
67
|
-
def germanium(
|
|
68
|
+
@staticproperty
|
|
69
|
+
def germanium():
|
|
68
70
|
return SellmeierMaterial('germanium')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyOptik
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.3.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
|
|
@@ -58,63 +58,111 @@ Requires-Dist: sphinx-gallery==0.15.0; extra == "documentation"
|
|
|
58
58
|
Requires-Dist: sphinx-rtd-theme==2.0.0; extra == "documentation"
|
|
59
59
|
Requires-Dist: pydata-sphinx-theme==0.14.1; extra == "documentation"
|
|
60
60
|
|
|
61
|
-
|
|
|
61
|
+
.. |python| image:: https://img.shields.io/pypi/pyversions/pyoptik.svg
|
|
62
|
+
:target: https://www.python.org/
|
|
63
|
+
|
|
64
|
+
.. |Logo| image:: https://github.com/MartinPdeS/PyOptik/raw/master/docs/images/logo.png
|
|
65
|
+
|
|
66
|
+
.. |docs| image:: https://readthedocs.org/projects/pyoptik/badge/?version=latest
|
|
67
|
+
:target: https://pyoptik.readthedocs.io/en/latest/
|
|
68
|
+
|
|
69
|
+
.. |PyPi| image:: https://badge.fury.io/py/pyoptik.svg
|
|
70
|
+
:target: https://badge.fury.io/py/pyoptik
|
|
71
|
+
|
|
72
|
+
.. |PyPi_download| image:: https://img.shields.io/pypi/dm/pyoptik.svg
|
|
73
|
+
:target: https://pypistats.org/packages/pyoptik
|
|
62
74
|
|
|
63
|
-
|python
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|PyPi|
|
|
67
|
-
|PyPi_download|
|
|
75
|
+
.. |coverage| image:: https://raw.githubusercontent.com/MartinPdeS/PyOptik/python-coverage-comment-action-data/badge.svg
|
|
76
|
+
:alt: Unittest coverage
|
|
77
|
+
:target: https://htmlpreview.github.io/?https://github.com/MartinPdeS/PyOptik/blob/python-coverage-comment-action-data/htmlcov/index.html
|
|
68
78
|
|
|
69
79
|
PyOptik
|
|
70
80
|
=======
|
|
71
81
|
|
|
82
|
+
PyOptik is a powerful Python tool designed to import refractive indexes and extinction coefficients for various materials across different wavelengths. The data provided by PyOptik can be used in numerous applications, including simulating light interactions with particles. All data is sourced from the reputable RefractiveIndex.INFO database.
|
|
72
83
|
|
|
84
|
+
|Logo|
|
|
73
85
|
|
|
74
|
-
|
|
75
|
-
coefficients for different materials at different wavelengths. This data can then
|
|
76
|
-
be used for different applications like simulating light interaction's with
|
|
77
|
-
particules. All the data comes from RefractiveIndex.INFO.
|
|
86
|
+
|python| |docs| |PyPi| |PyPi_download| |coverage|
|
|
78
87
|
|
|
79
|
-
|
|
88
|
+
Features
|
|
89
|
+
********
|
|
90
|
+
- **Comprehensive Database Access**: Seamlessly import refractive index and extinction coefficient data for a wide range of materials.
|
|
91
|
+
- **Simulation Ready**: Ideal for light-matter interaction simulations, particularly in optics and photonics.
|
|
92
|
+
- **Simple API**: Easy-to-use API that integrates well with other Python libraries.
|
|
93
|
+
- **Open Source**: Fully open-source.
|
|
94
|
+
|
|
95
|
+
Installation
|
|
96
|
+
************
|
|
97
|
+
|
|
98
|
+
To install PyOptik, simply use pip:
|
|
99
|
+
|
|
100
|
+
.. code:: bash
|
|
101
|
+
|
|
102
|
+
pip install pyoptik
|
|
103
|
+
|
|
104
|
+
Usage
|
|
105
|
+
*****
|
|
106
|
+
|
|
107
|
+
After installing PyOptik, you can easily access material properties:
|
|
108
|
+
|
|
109
|
+
.. code:: python
|
|
110
|
+
|
|
111
|
+
from PyOptik import UsualMaterial
|
|
112
|
+
|
|
113
|
+
# Access the refractive index of BK7 glass
|
|
114
|
+
bk7 = UsualMaterial.BK7
|
|
115
|
+
n = bk7.compute_refractive_index(0.55e-6)
|
|
116
|
+
print(f"Refractive index at 0.55 µm: {n}")
|
|
117
|
+
|
|
118
|
+
# Accessing and plotting material properties
|
|
119
|
+
bk7.plot(wavelength_range=[0.3e-6, 2.5e-6])
|
|
120
|
+
|
|
121
|
+
Example
|
|
80
122
|
*******
|
|
81
123
|
|
|
82
|
-
|
|
124
|
+
Here’s a quick example demonstrating how to use PyOptik to retrieve and plot the refractive index of a material:
|
|
83
125
|
|
|
84
126
|
.. code:: python
|
|
85
127
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
>>> pip install -r requirements/requirements.txt
|
|
89
|
-
>>> pytest
|
|
128
|
+
import numpy as np
|
|
129
|
+
from PyOptik import UsualMaterial
|
|
90
130
|
|
|
91
|
-
|
|
131
|
+
# Define wavelength range
|
|
132
|
+
wavelengths = np.linspace(0.3e-6, 2.5e-6, 100)
|
|
92
133
|
|
|
134
|
+
# Retrieve refractive index for BK7 glass
|
|
135
|
+
bk7 = UsualMaterial.BK7
|
|
136
|
+
n_values = bk7.compute_refractive_index(wavelengths)
|
|
93
137
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
As of 2024, the project is still under development. If you want to collaborate, it would be a pleasure! I encourage you to contact me.
|
|
138
|
+
# Plot the results
|
|
139
|
+
bk7.plot(wavelength_range=wavelengths)
|
|
97
140
|
|
|
98
|
-
|
|
141
|
+
Testing
|
|
142
|
+
*******
|
|
99
143
|
|
|
100
|
-
|
|
144
|
+
To test locally after cloning the GitHub repository, install the dependencies and run the tests:
|
|
101
145
|
|
|
146
|
+
.. code:: bash
|
|
102
147
|
|
|
103
|
-
|
|
104
|
-
|
|
148
|
+
git clone https://github.com/MartinPdeS/PyOptik.git
|
|
149
|
+
cd PyOptik
|
|
150
|
+
pip install .
|
|
151
|
+
pytest
|
|
105
152
|
|
|
106
|
-
|
|
153
|
+
Contributing
|
|
154
|
+
************
|
|
107
155
|
|
|
108
|
-
|
|
109
|
-
:target: https://pyoptik.readthedocs.io/en/latest/
|
|
156
|
+
PyOptik is open to contributions. Whether you're fixing bugs, adding new features, or improving documentation, your help is welcome! Please feel free to fork the repository and submit pull requests.
|
|
110
157
|
|
|
111
|
-
|
|
112
|
-
|
|
158
|
+
Contact Information
|
|
159
|
+
*******************
|
|
160
|
+
|
|
161
|
+
As of 2024, PyOptik is still under development. If you would like to collaborate, it would be a pleasure to hear from you. Contact me at:
|
|
162
|
+
|
|
163
|
+
**Author**: `Martin Poinsinet de Sivry-Houle <https://github.com/MartinPdS>`_
|
|
164
|
+
|
|
165
|
+
**Email**: `martin.poinsinet.de.sivry@gmail.com <mailto:martin.poinsinet.de.sivry@gmail.com?subject=PyOptik>`_
|
|
113
166
|
|
|
114
|
-
.. |PyPi_download| image:: https://img.shields.io/pypi/dm/pyoptik.svg
|
|
115
|
-
:target: https://pypistats.org/packages/pyoptik
|
|
116
167
|
|
|
117
|
-
.. |coverage| image:: https://raw.githubusercontent.com/MartinPdeS/PyOptik/python-coverage-comment-action-data/badge.svg
|
|
118
|
-
:alt: Unittest coverage
|
|
119
|
-
:target: https://htmlpreview.github.io/?https://github.com/MartinPdeS/PyOptik/blob/python-coverage-comment-action-data/htmlcov/index.html
|
|
120
168
|
|
|
@@ -98,5 +98,7 @@ docs/source/gallery/images/thumb/sphx_glr_get_values_thumb.png
|
|
|
98
98
|
docs/source/gallery/images/thumb/sphx_glr_plot_sellmeier_0_thumb.png
|
|
99
99
|
docs/source/gallery/images/thumb/sphx_glr_plot_sellmeier_1_thumb.png
|
|
100
100
|
tests/__init__.py
|
|
101
|
+
tests/test_extra.py
|
|
101
102
|
tests/test_sellmeier.py
|
|
102
|
-
tests/test_tabulated.py
|
|
103
|
+
tests/test_tabulated.py
|
|
104
|
+
tests/test_usual_material.py
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
.. |python| image:: https://img.shields.io/pypi/pyversions/pyoptik.svg
|
|
2
|
+
:target: https://www.python.org/
|
|
3
|
+
|
|
4
|
+
.. |Logo| image:: https://github.com/MartinPdeS/PyOptik/raw/master/docs/images/logo.png
|
|
5
|
+
|
|
6
|
+
.. |docs| image:: https://readthedocs.org/projects/pyoptik/badge/?version=latest
|
|
7
|
+
:target: https://pyoptik.readthedocs.io/en/latest/
|
|
8
|
+
|
|
9
|
+
.. |PyPi| image:: https://badge.fury.io/py/pyoptik.svg
|
|
10
|
+
:target: https://badge.fury.io/py/pyoptik
|
|
11
|
+
|
|
12
|
+
.. |PyPi_download| image:: https://img.shields.io/pypi/dm/pyoptik.svg
|
|
13
|
+
:target: https://pypistats.org/packages/pyoptik
|
|
14
|
+
|
|
15
|
+
.. |coverage| image:: https://raw.githubusercontent.com/MartinPdeS/PyOptik/python-coverage-comment-action-data/badge.svg
|
|
16
|
+
:alt: Unittest coverage
|
|
17
|
+
:target: https://htmlpreview.github.io/?https://github.com/MartinPdeS/PyOptik/blob/python-coverage-comment-action-data/htmlcov/index.html
|
|
18
|
+
|
|
19
|
+
PyOptik
|
|
20
|
+
=======
|
|
21
|
+
|
|
22
|
+
PyOptik is a powerful Python tool designed to import refractive indexes and extinction coefficients for various materials across different wavelengths. The data provided by PyOptik can be used in numerous applications, including simulating light interactions with particles. All data is sourced from the reputable RefractiveIndex.INFO database.
|
|
23
|
+
|
|
24
|
+
|Logo|
|
|
25
|
+
|
|
26
|
+
|python| |docs| |PyPi| |PyPi_download| |coverage|
|
|
27
|
+
|
|
28
|
+
Features
|
|
29
|
+
********
|
|
30
|
+
- **Comprehensive Database Access**: Seamlessly import refractive index and extinction coefficient data for a wide range of materials.
|
|
31
|
+
- **Simulation Ready**: Ideal for light-matter interaction simulations, particularly in optics and photonics.
|
|
32
|
+
- **Simple API**: Easy-to-use API that integrates well with other Python libraries.
|
|
33
|
+
- **Open Source**: Fully open-source.
|
|
34
|
+
|
|
35
|
+
Installation
|
|
36
|
+
************
|
|
37
|
+
|
|
38
|
+
To install PyOptik, simply use pip:
|
|
39
|
+
|
|
40
|
+
.. code:: bash
|
|
41
|
+
|
|
42
|
+
pip install pyoptik
|
|
43
|
+
|
|
44
|
+
Usage
|
|
45
|
+
*****
|
|
46
|
+
|
|
47
|
+
After installing PyOptik, you can easily access material properties:
|
|
48
|
+
|
|
49
|
+
.. code:: python
|
|
50
|
+
|
|
51
|
+
from PyOptik import UsualMaterial
|
|
52
|
+
|
|
53
|
+
# Access the refractive index of BK7 glass
|
|
54
|
+
bk7 = UsualMaterial.BK7
|
|
55
|
+
n = bk7.compute_refractive_index(0.55e-6)
|
|
56
|
+
print(f"Refractive index at 0.55 µm: {n}")
|
|
57
|
+
|
|
58
|
+
# Accessing and plotting material properties
|
|
59
|
+
bk7.plot(wavelength_range=[0.3e-6, 2.5e-6])
|
|
60
|
+
|
|
61
|
+
Example
|
|
62
|
+
*******
|
|
63
|
+
|
|
64
|
+
Here’s a quick example demonstrating how to use PyOptik to retrieve and plot the refractive index of a material:
|
|
65
|
+
|
|
66
|
+
.. code:: python
|
|
67
|
+
|
|
68
|
+
import numpy as np
|
|
69
|
+
from PyOptik import UsualMaterial
|
|
70
|
+
|
|
71
|
+
# Define wavelength range
|
|
72
|
+
wavelengths = np.linspace(0.3e-6, 2.5e-6, 100)
|
|
73
|
+
|
|
74
|
+
# Retrieve refractive index for BK7 glass
|
|
75
|
+
bk7 = UsualMaterial.BK7
|
|
76
|
+
n_values = bk7.compute_refractive_index(wavelengths)
|
|
77
|
+
|
|
78
|
+
# Plot the results
|
|
79
|
+
bk7.plot(wavelength_range=wavelengths)
|
|
80
|
+
|
|
81
|
+
Testing
|
|
82
|
+
*******
|
|
83
|
+
|
|
84
|
+
To test locally after cloning the GitHub repository, install the dependencies and run the tests:
|
|
85
|
+
|
|
86
|
+
.. code:: bash
|
|
87
|
+
|
|
88
|
+
git clone https://github.com/MartinPdeS/PyOptik.git
|
|
89
|
+
cd PyOptik
|
|
90
|
+
pip install .
|
|
91
|
+
pytest
|
|
92
|
+
|
|
93
|
+
Contributing
|
|
94
|
+
************
|
|
95
|
+
|
|
96
|
+
PyOptik is open to contributions. Whether you're fixing bugs, adding new features, or improving documentation, your help is welcome! Please feel free to fork the repository and submit pull requests.
|
|
97
|
+
|
|
98
|
+
Contact Information
|
|
99
|
+
*******************
|
|
100
|
+
|
|
101
|
+
As of 2024, PyOptik is still under development. If you would like to collaborate, it would be a pleasure to hear from you. Contact me at:
|
|
102
|
+
|
|
103
|
+
**Author**: `Martin Poinsinet de Sivry-Houle <https://github.com/MartinPdS>`_
|
|
104
|
+
|
|
105
|
+
**Email**: `martin.poinsinet.de.sivry@gmail.com <mailto:martin.poinsinet.de.sivry@gmail.com?subject=PyOptik>`_
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from PyOptik import UsualMaterial
|
|
3
|
+
|
|
4
|
+
# Define wavelength range
|
|
5
|
+
wavelengths = np.linspace(0.3e-6, 2.5e-6, 100)
|
|
6
|
+
|
|
7
|
+
# Retrieve refractive index for BK7 glass
|
|
8
|
+
bk7 = UsualMaterial.BK7
|
|
9
|
+
n_values = bk7.compute_refractive_index(wavelengths)
|
|
10
|
+
|
|
11
|
+
# Plot the results
|
|
12
|
+
bk7.plot(wavelength_range=wavelengths)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
from unittest.mock import patch
|
|
6
|
+
from PyOptik.utils import build_default_library
|
|
7
|
+
|
|
8
|
+
def test_build_default_library():
|
|
9
|
+
build_default_library()
|
|
10
|
+
|
|
11
|
+
if __name__ == "__main__":
|
|
12
|
+
pytest.main([__file__])
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from PyOptik import UsualMaterial
|
|
3
|
+
from PyOptik.material import SellmeierMaterial, TabulatedMaterial
|
|
4
|
+
|
|
5
|
+
@pytest.mark.parametrize('material_name', UsualMaterial.all, ids=lambda name: f'Test {name}')
|
|
6
|
+
def test_usual_material(material_name):
|
|
7
|
+
"""
|
|
8
|
+
Test each usual material defined in UsualMaterial to ensure that it can be instantiated without errors.
|
|
9
|
+
"""
|
|
10
|
+
material_instance = getattr(UsualMaterial, material_name)
|
|
11
|
+
|
|
12
|
+
print(material_instance.__class__)
|
|
13
|
+
|
|
14
|
+
assert isinstance(material_instance, (SellmeierMaterial, TabulatedMaterial)), f"{material_name} instantiation failed."
|
|
15
|
+
|
|
16
|
+
if __name__ == "__main__":
|
|
17
|
+
pytest.main([__file__])
|
pyoptik-1.1.1.post0/README.rst
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
|Logo|
|
|
2
|
-
|
|
3
|
-
|python|
|
|
4
|
-
|docs|
|
|
5
|
-
|coverage|
|
|
6
|
-
|PyPi|
|
|
7
|
-
|PyPi_download|
|
|
8
|
-
|
|
9
|
-
PyOptik
|
|
10
|
-
=======
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
PyOptik is a tool that can be used to import refractive indexes and extinction
|
|
15
|
-
coefficients for different materials at different wavelengths. This data can then
|
|
16
|
-
be used for different applications like simulating light interaction's with
|
|
17
|
-
particules. All the data comes from RefractiveIndex.INFO.
|
|
18
|
-
|
|
19
|
-
Testing
|
|
20
|
-
*******
|
|
21
|
-
|
|
22
|
-
To test localy (with cloning the GitHub repository) you'll need to install the dependencies and run the coverage command as
|
|
23
|
-
|
|
24
|
-
.. code:: python
|
|
25
|
-
|
|
26
|
-
>>> git clone https://github.com/MartinPdeS/PyOptik.git
|
|
27
|
-
>>> cd PyOptik
|
|
28
|
-
>>> pip install -r requirements/requirements.txt
|
|
29
|
-
>>> pytest
|
|
30
|
-
|
|
31
|
-
----
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Contact Information
|
|
35
|
-
************************
|
|
36
|
-
As of 2024, the project is still under development. If you want to collaborate, it would be a pleasure! I encourage you to contact me.
|
|
37
|
-
|
|
38
|
-
PyOptik was written by `Martin Poinsinet de Sivry-Houle <https://github.com/MartinPdS>`_ .
|
|
39
|
-
|
|
40
|
-
Email:`martin.poinsinet-de-sivry@polymtl.ca <mailto:martin.poinsinet-de-sivry@polymtl.ca?subject=PyOptik>`_ .
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
.. |python| image:: https://img.shields.io/pypi/pyversions/pyoptik.svg
|
|
44
|
-
:target: https://www.python.org/
|
|
45
|
-
|
|
46
|
-
.. |Logo| image:: https://github.com/MartinPdeS/PyOptik/raw/master/docs/images/logo.png
|
|
47
|
-
|
|
48
|
-
.. |docs| image:: https://readthedocs.org/projects/pyoptik/badge/?version=latest
|
|
49
|
-
:target: https://pyoptik.readthedocs.io/en/latest/
|
|
50
|
-
|
|
51
|
-
.. |PyPi| image:: https://badge.fury.io/py/pyoptik.svg
|
|
52
|
-
:target: https://badge.fury.io/py/pyoptik
|
|
53
|
-
|
|
54
|
-
.. |PyPi_download| image:: https://img.shields.io/pypi/dm/pyoptik.svg
|
|
55
|
-
:target: https://pypistats.org/packages/pyoptik
|
|
56
|
-
|
|
57
|
-
.. |coverage| image:: https://raw.githubusercontent.com/MartinPdeS/PyOptik/python-coverage-comment-action-data/badge.svg
|
|
58
|
-
:alt: Unittest coverage
|
|
59
|
-
:target: https://htmlpreview.github.io/?https://github.com/MartinPdeS/PyOptik/blob/python-coverage-comment-action-data/htmlcov/index.html
|
|
60
|
-
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import numpy
|
|
2
|
-
from dataclasses import dataclass, field
|
|
3
|
-
from typing import Optional, Tuple, Union
|
|
4
|
-
import yaml
|
|
5
|
-
from scipy.interpolate import interp1d
|
|
6
|
-
import warnings
|
|
7
|
-
from PyOptik.directories import tabulated_data_path
|
|
8
|
-
|
|
9
|
-
@dataclass
|
|
10
|
-
class TabulatedMaterial:
|
|
11
|
-
filename: str
|
|
12
|
-
wavelength: numpy.ndarray = field(init=False)
|
|
13
|
-
n_values: numpy.ndarray = field(init=False)
|
|
14
|
-
k_values: numpy.ndarray = field(init=False)
|
|
15
|
-
reference: Optional[str] = field(init=False)
|
|
16
|
-
|
|
17
|
-
def __post_init__(self) -> None:
|
|
18
|
-
"""
|
|
19
|
-
Post-initialization method to load the tabulated data from the YAML file.
|
|
20
|
-
"""
|
|
21
|
-
self.load_tabulated_data()
|
|
22
|
-
|
|
23
|
-
def load_tabulated_data(self) -> None:
|
|
24
|
-
"""
|
|
25
|
-
Loads the tabulated refractive index and absorption values from the specified YAML file.
|
|
26
|
-
"""
|
|
27
|
-
file_path = tabulated_data_path / f'{self.filename}.yml'
|
|
28
|
-
|
|
29
|
-
with open(file_path, 'r') as file:
|
|
30
|
-
parsed_yaml = yaml.safe_load(file)
|
|
31
|
-
|
|
32
|
-
# Extract data points
|
|
33
|
-
data_points = parsed_yaml['DATA'][0]['data'].strip().split('\n')
|
|
34
|
-
data = numpy.array([[float(value) for value in point.split()] for point in data_points])
|
|
35
|
-
|
|
36
|
-
self.wavelength = data[:, 0]
|
|
37
|
-
self.n_values = data[:, 1]
|
|
38
|
-
self.k_values = data[:, 2]
|
|
39
|
-
|
|
40
|
-
# Extract reference
|
|
41
|
-
self.reference = parsed_yaml.get('REFERENCES', None)
|
|
42
|
-
|
|
43
|
-
def interpolate_nk(self, wavelength: Union[float, numpy.ndarray]) -> Tuple[numpy.ndarray, numpy.ndarray]:
|
|
44
|
-
"""
|
|
45
|
-
Interpolates the refractive index (n) and absorption (k) values for the given wavelength(s).
|
|
46
|
-
|
|
47
|
-
Args:
|
|
48
|
-
wavelength (Union[float, numpy.ndarray]): Wavelength(s) in micrometers for which to interpolate n and k.
|
|
49
|
-
|
|
50
|
-
Returns:
|
|
51
|
-
Tuple[numpy.ndarray, numpy.ndarray]: Interpolated refractive index (n) and absorption (k) values.
|
|
52
|
-
|
|
53
|
-
Raises:
|
|
54
|
-
ValueError: If the wavelength is outside the tabulated range.
|
|
55
|
-
"""
|
|
56
|
-
if isinstance(wavelength, float):
|
|
57
|
-
wavelength = numpy.array([wavelength])
|
|
58
|
-
|
|
59
|
-
if numpy.any(wavelength < self.wavelength.min()) or numpy.any(wavelength > self.wavelength.max()):
|
|
60
|
-
warnings.warn(f"Wavelength is outside the tabulated range of {self.wavelength.min()} µm to {self.wavelength.max()} µm. [{self.filename}]")
|
|
61
|
-
|
|
62
|
-
n_interp = interp1d(self.wavelength, self.n_values, kind='cubic', fill_value='extrapolate')
|
|
63
|
-
k_interp = interp1d(self.wavelength, self.k_values, kind='cubic', fill_value='extrapolate')
|
|
64
|
-
|
|
65
|
-
return n_interp(wavelength), k_interp(wavelength)
|
|
66
|
-
|
|
67
|
-
def plot_nk(self) -> None:
|
|
68
|
-
"""
|
|
69
|
-
Plots the tabulated refractive index (n) and absorption (k) as a function of wavelength.
|
|
70
|
-
"""
|
|
71
|
-
import matplotlib.pyplot as plt
|
|
72
|
-
|
|
73
|
-
fig, ax1 = plt.subplots()
|
|
74
|
-
|
|
75
|
-
ax1.set_xlabel('Wavelength [µm]')
|
|
76
|
-
ax1.set_ylabel('Refractive Index (n)', color='tab:blue')
|
|
77
|
-
ax1.plot(self.wavelength, self.n_values, 'o-', color='tab:blue', label='n')
|
|
78
|
-
ax1.tick_params(axis='y', labelcolor='tab:blue')
|
|
79
|
-
|
|
80
|
-
ax2 = ax1.twinx() # instantiate a second axes that shares the same x-axis
|
|
81
|
-
ax2.set_ylabel('Absorption (k)', color='tab:red') # we already handled the x-label with ax1
|
|
82
|
-
ax2.plot(self.wavelength, self.k_values, 'o-', color='tab:red', label='k')
|
|
83
|
-
ax2.tick_params(axis='y', labelcolor='tab:red')
|
|
84
|
-
|
|
85
|
-
fig.tight_layout() # to prevent the right y-label from being slightly clipped
|
|
86
|
-
plt.show()
|
|
87
|
-
|
|
88
|
-
def print(self) -> str:
|
|
89
|
-
"""
|
|
90
|
-
Provides a formal string representation of the TabulatedMaterial object, including key attributes.
|
|
91
|
-
|
|
92
|
-
Returns:
|
|
93
|
-
str: Formal representation of the TabulatedMaterial object.
|
|
94
|
-
"""
|
|
95
|
-
return (
|
|
96
|
-
f"\nTabulatedMaterial: '{self.filename}',\n"
|
|
97
|
-
f"wavelength_range: [{self.wavelength.min()} µm, {self.wavelength.max()} µm],\n"
|
|
98
|
-
f"reference: '{self.reference}')"
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
def __str__(self) -> str:
|
|
102
|
-
"""
|
|
103
|
-
Provides an informal string representation of the TabulatedMaterial object.
|
|
104
|
-
|
|
105
|
-
Returns:
|
|
106
|
-
str: Informal representation of the TabulatedMaterial object.
|
|
107
|
-
"""
|
|
108
|
-
return f"TabulatedMaterial: {self.filename}"
|
|
109
|
-
|
|
110
|
-
def __repr__(self) -> str:
|
|
111
|
-
"""
|
|
112
|
-
Provides a formal string representation of the TabulatedMaterial object, including key attributes.
|
|
113
|
-
|
|
114
|
-
Returns:
|
|
115
|
-
str: Formal representation of the TabulatedMaterial object.
|
|
116
|
-
"""
|
|
117
|
-
return self.__str__()
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
m = TabulatedMaterial('silver')
|
|
121
|
-
|
|
122
|
-
m.plot_nk()
|
|
123
|
-
print(m)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/fluorine_doped_silica_1%.yml
RENAMED
|
File without changes
|
{pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/fluorine_doped_silica_2%.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_0_codeobj.pickle
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyoptik-1.1.1.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_1_codeobj.pickle
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|