PyOptik 1.1.2.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.
Files changed (108) hide show
  1. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/.coverage +0 -0
  2. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PKG-INFO +83 -35
  3. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/__init__.py +2 -1
  4. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/_version.py +2 -2
  5. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik.egg-info/PKG-INFO +83 -35
  6. pyoptik-1.1.3.post0/README.rst +108 -0
  7. pyoptik-1.1.3.post0/developments/testing.py +12 -0
  8. pyoptik-1.1.2.post0/README.rst +0 -60
  9. pyoptik-1.1.2.post0/developments/testing.py +0 -123
  10. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/.github/dependabot.yml +0 -0
  11. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/.github/workflows/coverage.yml +0 -0
  12. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/.github/workflows/deploy_workflow.yml +0 -0
  13. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/.gitignore +0 -0
  14. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/.readthedocs.yml +0 -0
  15. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/LICENSE +0 -0
  16. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/base_class.py +0 -0
  17. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/__init__.py +0 -0
  18. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/BAK1.yml +0 -0
  19. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/BK7.yml +0 -0
  20. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/SF5.yml +0 -0
  21. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/ZBLAN.yml +0 -0
  22. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/__init__.py +0 -0
  23. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/argon.yml +0 -0
  24. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/crown.yml +0 -0
  25. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/default.py +0 -0
  26. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/flint.yml +0 -0
  27. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/fluorine_doped_silica_1%.yml +0 -0
  28. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/fluorine_doped_silica_2%.yml +0 -0
  29. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/fused_silica.yml +0 -0
  30. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/germanium.yml +0 -0
  31. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/lithium_niobate.yml +0 -0
  32. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/polystyren.yml +0 -0
  33. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/silica.yml +0 -0
  34. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/silicon.yml +0 -0
  35. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/soda_lime_glass.yml +0 -0
  36. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/test.yml +0 -0
  37. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/sellmeier/water.yml +0 -0
  38. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/__init__.py +0 -0
  39. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/aluminium.yml +0 -0
  40. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/calcium.yml +0 -0
  41. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/copper.yml +0 -0
  42. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/default.py +0 -0
  43. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/gold.yml +0 -0
  44. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/iron.yml +0 -0
  45. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/nickel.yml +0 -0
  46. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/silver.yml +0 -0
  47. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/sodium.yml +0 -0
  48. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/test.yml +0 -0
  49. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/tabulated/zinc.yml +0 -0
  50. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/data/test.yml +0 -0
  51. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/directories.py +0 -0
  52. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/download.py +0 -0
  53. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/material.py +0 -0
  54. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/sellmeier_class.py +0 -0
  55. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/tabulated_class.py +0 -0
  56. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik/utils.py +0 -0
  57. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik.egg-info/SOURCES.txt +0 -0
  58. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik.egg-info/dependency_links.txt +0 -0
  59. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik.egg-info/requires.txt +0 -0
  60. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/PyOptik.egg-info/top_level.txt +0 -0
  61. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/Makefile +0 -0
  62. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/deprecated/experiment_material.py +0 -0
  63. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/examples/README.rst +0 -0
  64. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/examples/measurements_tio2.py +0 -0
  65. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/examples/measurements_water.py +0 -0
  66. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/examples/sellmeier_bk7.py +0 -0
  67. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/examples/sellmeier_sf5.py +0 -0
  68. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/examples/sellmeier_silica.py +0 -0
  69. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/images/logo.png +0 -0
  70. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/make.bat +0 -0
  71. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/_static/default.css +0 -0
  72. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/code.rst +0 -0
  73. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/conf.py +0 -0
  74. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/add_material.ipynb +0 -0
  75. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/add_material.py +0 -0
  76. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/add_material.rst +0 -0
  77. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/add_material_codeobj.pickle +0 -0
  78. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/get_values.ipynb +0 -0
  79. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/get_values.py +0 -0
  80. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/get_values.rst +0 -0
  81. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/get_values_codeobj.pickle +0 -0
  82. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/images/sphx_glr_plot_sellmeier_0_001.png +0 -0
  83. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/images/sphx_glr_plot_sellmeier_1_001.png +0 -0
  84. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/images/thumb/sphx_glr_add_material_thumb.png +0 -0
  85. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/images/thumb/sphx_glr_get_values_thumb.png +0 -0
  86. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/images/thumb/sphx_glr_plot_sellmeier_0_thumb.png +0 -0
  87. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/images/thumb/sphx_glr_plot_sellmeier_1_thumb.png +0 -0
  88. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/index.rst +0 -0
  89. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_0.ipynb +0 -0
  90. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_0.py +0 -0
  91. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_0.py.md5 +0 -0
  92. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_0.rst +0 -0
  93. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_0_codeobj.pickle +0 -0
  94. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_1.ipynb +0 -0
  95. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_1.py +0 -0
  96. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_1.py.md5 +0 -0
  97. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_1.rst +0 -0
  98. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/plot_sellmeier_1_codeobj.pickle +0 -0
  99. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/gallery/sg_execution_times.rst +0 -0
  100. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/index.rst +0 -0
  101. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/docs/source/references.rst +0 -0
  102. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/pyproject.toml +0 -0
  103. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/setup.cfg +0 -0
  104. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/tests/__init__.py +0 -0
  105. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/tests/test_extra.py +0 -0
  106. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/tests/test_sellmeier.py +0 -0
  107. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/tests/test_tabulated.py +0 -0
  108. {pyoptik-1.1.2.post0 → pyoptik-1.1.3.post0}/tests/test_usual_material.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyOptik
3
- Version: 1.1.2.post0
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
- |Logo|
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
- |docs|
65
- |coverage|
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
- PyOptik is a tool that can be used to import refractive indexes and extinction
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
- Testing
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
- To test localy (with cloning the GitHub repository) you'll need to install the dependencies and run the coverage command as
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
- >>> git clone https://github.com/MartinPdeS/PyOptik.git
87
- >>> cd PyOptik
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
- Contact Information
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
- PyOptik was written by `Martin Poinsinet de Sivry-Houle <https://github.com/MartinPdS>`_ .
141
+ Testing
142
+ *******
99
143
 
100
- Email:`martin.poinsinet-de-sivry@polymtl.ca <mailto:martin.poinsinet-de-sivry@polymtl.ca?subject=PyOptik>`_ .
144
+ To test locally after cloning the GitHub repository, install the dependencies and run the tests:
101
145
 
146
+ .. code:: bash
102
147
 
103
- .. |python| image:: https://img.shields.io/pypi/pyversions/pyoptik.svg
104
- :target: https://www.python.org/
148
+ git clone https://github.com/MartinPdeS/PyOptik.git
149
+ cd PyOptik
150
+ pip install .
151
+ pytest
105
152
 
106
- .. |Logo| image:: https://github.com/MartinPdeS/PyOptik/raw/master/docs/images/logo.png
153
+ Contributing
154
+ ************
107
155
 
108
- .. |docs| image:: https://readthedocs.org/projects/pyoptik/badge/?version=latest
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
- .. |PyPi| image:: https://badge.fury.io/py/pyoptik.svg
112
- :target: https://badge.fury.io/py/pyoptik
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
 
@@ -6,4 +6,5 @@ except ImportError:
6
6
 
7
7
 
8
8
  from .utils import build_default_library
9
- from .material import UsualMaterial
9
+ from .material import UsualMaterial
10
+ from .base_class import Material
@@ -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.2.post0'
16
- __version_tuple__ = version_tuple = (1, 1, 2)
15
+ __version__ = version = '1.1.3.post0'
16
+ __version_tuple__ = version_tuple = (1, 1, 3)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyOptik
3
- Version: 1.1.2.post0
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
- |Logo|
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
- |docs|
65
- |coverage|
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
- PyOptik is a tool that can be used to import refractive indexes and extinction
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
- Testing
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
- To test localy (with cloning the GitHub repository) you'll need to install the dependencies and run the coverage command as
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
- >>> git clone https://github.com/MartinPdeS/PyOptik.git
87
- >>> cd PyOptik
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
- Contact Information
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
- PyOptik was written by `Martin Poinsinet de Sivry-Houle <https://github.com/MartinPdS>`_ .
141
+ Testing
142
+ *******
99
143
 
100
- Email:`martin.poinsinet-de-sivry@polymtl.ca <mailto:martin.poinsinet-de-sivry@polymtl.ca?subject=PyOptik>`_ .
144
+ To test locally after cloning the GitHub repository, install the dependencies and run the tests:
101
145
 
146
+ .. code:: bash
102
147
 
103
- .. |python| image:: https://img.shields.io/pypi/pyversions/pyoptik.svg
104
- :target: https://www.python.org/
148
+ git clone https://github.com/MartinPdeS/PyOptik.git
149
+ cd PyOptik
150
+ pip install .
151
+ pytest
105
152
 
106
- .. |Logo| image:: https://github.com/MartinPdeS/PyOptik/raw/master/docs/images/logo.png
153
+ Contributing
154
+ ************
107
155
 
108
- .. |docs| image:: https://readthedocs.org/projects/pyoptik/badge/?version=latest
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
- .. |PyPi| image:: https://badge.fury.io/py/pyoptik.svg
112
- :target: https://badge.fury.io/py/pyoptik
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
 
@@ -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)
@@ -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