PyOptik 1.3.1.post0__tar.gz → 1.4.0.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 (168) hide show
  1. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/.gitignore +2 -0
  2. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PKG-INFO +1 -5
  3. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/__init__.py +3 -1
  4. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/_version.py +2 -2
  5. pyoptik-1.4.0.post0/PyOptik/utils.py +171 -0
  6. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik.egg-info/PKG-INFO +1 -5
  7. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik.egg-info/SOURCES.txt +59 -1
  8. pyoptik-1.4.0.post0/docs/examples/create_sellmeier_file.py +32 -0
  9. pyoptik-1.4.0.post0/docs/examples/create_tabulated_file.py +39 -0
  10. pyoptik-1.4.0.post0/docs/examples/download_yml_file.py +22 -0
  11. pyoptik-1.4.0.post0/docs/source/code.rst +60 -0
  12. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/conf.py +1 -0
  13. pyoptik-1.4.0.post0/docs/source/gallery/create_sellmeier_file.ipynb +43 -0
  14. pyoptik-1.4.0.post0/docs/source/gallery/create_sellmeier_file.py +32 -0
  15. pyoptik-1.4.0.post0/docs/source/gallery/create_sellmeier_file.py.md5 +1 -0
  16. pyoptik-1.4.0.post0/docs/source/gallery/create_sellmeier_file.rst +107 -0
  17. pyoptik-1.4.0.post0/docs/source/gallery/create_sellmeier_file_codeobj.pickle +0 -0
  18. pyoptik-1.4.0.post0/docs/source/gallery/create_tabulated_file.ipynb +43 -0
  19. pyoptik-1.4.0.post0/docs/source/gallery/create_tabulated_file.py +39 -0
  20. pyoptik-1.4.0.post0/docs/source/gallery/create_tabulated_file.py.md5 +1 -0
  21. pyoptik-1.4.0.post0/docs/source/gallery/create_tabulated_file.rst +114 -0
  22. pyoptik-1.4.0.post0/docs/source/gallery/create_tabulated_file_codeobj.pickle +0 -0
  23. pyoptik-1.4.0.post0/docs/source/gallery/download_yml_file.ipynb +43 -0
  24. pyoptik-1.4.0.post0/docs/source/gallery/download_yml_file.py +22 -0
  25. pyoptik-1.4.0.post0/docs/source/gallery/download_yml_file.py.md5 +1 -0
  26. pyoptik-1.4.0.post0/docs/source/gallery/download_yml_file.rst +96 -0
  27. pyoptik-1.4.0.post0/docs/source/gallery/download_yml_file_codeobj.pickle +0 -0
  28. pyoptik-1.4.0.post0/docs/source/gallery/images/sphx_glr_create_sellmeier_file_001.png +0 -0
  29. pyoptik-1.4.0.post0/docs/source/gallery/images/sphx_glr_create_tabulated_file_001.png +0 -0
  30. pyoptik-1.4.0.post0/docs/source/gallery/images/sphx_glr_download_yml_file_001.png +0 -0
  31. pyoptik-1.4.0.post0/docs/source/gallery/images/sphx_glr_plot_bk7_001.png +0 -0
  32. pyoptik-1.4.0.post0/docs/source/gallery/images/sphx_glr_plot_sf5_001.png +0 -0
  33. pyoptik-1.4.0.post0/docs/source/gallery/images/sphx_glr_plot_silica_001.png +0 -0
  34. pyoptik-1.4.0.post0/docs/source/gallery/images/sphx_glr_plot_silver_001.png +0 -0
  35. pyoptik-1.4.0.post0/docs/source/gallery/images/sphx_glr_plot_water_001.png +0 -0
  36. pyoptik-1.4.0.post0/docs/source/gallery/images/thumb/sphx_glr_create_sellmeier_file_thumb.png +0 -0
  37. pyoptik-1.4.0.post0/docs/source/gallery/images/thumb/sphx_glr_create_tabulated_file_thumb.png +0 -0
  38. pyoptik-1.4.0.post0/docs/source/gallery/images/thumb/sphx_glr_download_yml_file_thumb.png +0 -0
  39. pyoptik-1.4.0.post0/docs/source/gallery/images/thumb/sphx_glr_plot_bk7_thumb.png +0 -0
  40. pyoptik-1.4.0.post0/docs/source/gallery/images/thumb/sphx_glr_plot_sf5_thumb.png +0 -0
  41. pyoptik-1.4.0.post0/docs/source/gallery/images/thumb/sphx_glr_plot_silica_thumb.png +0 -0
  42. pyoptik-1.4.0.post0/docs/source/gallery/images/thumb/sphx_glr_plot_silver_thumb.png +0 -0
  43. pyoptik-1.4.0.post0/docs/source/gallery/images/thumb/sphx_glr_plot_water_thumb.png +0 -0
  44. pyoptik-1.4.0.post0/docs/source/gallery/index.rst +175 -0
  45. pyoptik-1.4.0.post0/docs/source/gallery/plot_bk7.ipynb +43 -0
  46. pyoptik-1.4.0.post0/docs/source/gallery/plot_bk7.py +21 -0
  47. pyoptik-1.4.0.post0/docs/source/gallery/plot_bk7.py.md5 +1 -0
  48. pyoptik-1.4.0.post0/docs/source/gallery/plot_bk7.rst +83 -0
  49. pyoptik-1.4.0.post0/docs/source/gallery/plot_bk7_codeobj.pickle +0 -0
  50. pyoptik-1.4.0.post0/docs/source/gallery/plot_sf5.ipynb +43 -0
  51. pyoptik-1.4.0.post0/docs/source/gallery/plot_sf5.py +21 -0
  52. pyoptik-1.4.0.post0/docs/source/gallery/plot_sf5.py.md5 +1 -0
  53. pyoptik-1.4.0.post0/docs/source/gallery/plot_sf5.rst +84 -0
  54. pyoptik-1.4.0.post0/docs/source/gallery/plot_sf5_codeobj.pickle +0 -0
  55. pyoptik-1.4.0.post0/docs/source/gallery/plot_silica.ipynb +43 -0
  56. pyoptik-1.4.0.post0/docs/source/gallery/plot_silica.py +21 -0
  57. pyoptik-1.4.0.post0/docs/source/gallery/plot_silica.py.md5 +1 -0
  58. pyoptik-1.4.0.post0/docs/source/gallery/plot_silica.rst +84 -0
  59. pyoptik-1.4.0.post0/docs/source/gallery/plot_silica_codeobj.pickle +0 -0
  60. pyoptik-1.4.0.post0/docs/source/gallery/plot_silver.ipynb +43 -0
  61. pyoptik-1.4.0.post0/docs/source/gallery/plot_silver.py +22 -0
  62. pyoptik-1.4.0.post0/docs/source/gallery/plot_silver.py.md5 +1 -0
  63. pyoptik-1.4.0.post0/docs/source/gallery/plot_silver.rst +85 -0
  64. pyoptik-1.4.0.post0/docs/source/gallery/plot_silver_codeobj.pickle +0 -0
  65. pyoptik-1.4.0.post0/docs/source/gallery/plot_water.ipynb +43 -0
  66. pyoptik-1.4.0.post0/docs/source/gallery/plot_water.py +22 -0
  67. pyoptik-1.4.0.post0/docs/source/gallery/plot_water.py.md5 +1 -0
  68. pyoptik-1.4.0.post0/docs/source/gallery/plot_water.rst +85 -0
  69. pyoptik-1.4.0.post0/docs/source/gallery/plot_water_codeobj.pickle +0 -0
  70. pyoptik-1.4.0.post0/docs/source/gallery/sg_execution_times.rst +27 -0
  71. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/index.rst +0 -1
  72. pyoptik-1.4.0.post0/docs/source/references.rst +4 -0
  73. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/pyproject.toml +0 -4
  74. pyoptik-1.4.0.post0/tests/test_utils.py +75 -0
  75. pyoptik-1.3.1.post0/PyOptik/data/test.yml +0 -14
  76. pyoptik-1.3.1.post0/PyOptik/utils.py +0 -81
  77. pyoptik-1.3.1.post0/docs/source/code.rst +0 -16
  78. pyoptik-1.3.1.post0/docs/source/gallery/index.rst +0 -103
  79. pyoptik-1.3.1.post0/docs/source/gallery/sg_execution_times.rst +0 -19
  80. pyoptik-1.3.1.post0/docs/source/references.rst +0 -4
  81. pyoptik-1.3.1.post0/tests/test_utils.py +0 -28
  82. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/.github/dependabot.yml +0 -0
  83. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/.github/workflows/coverage.yml +0 -0
  84. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/.github/workflows/deploy_workflow.yml +0 -0
  85. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/.readthedocs.yml +0 -0
  86. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/LICENSE +0 -0
  87. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/base_class.py +0 -0
  88. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/__init__.py +0 -0
  89. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/BAK1.yml +0 -0
  90. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/BK7.yml +0 -0
  91. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/SF5.yml +0 -0
  92. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/ZBLAN.yml +0 -0
  93. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/__init__.py +0 -0
  94. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/argon.yml +0 -0
  95. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/crown.yml +0 -0
  96. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/default.py +0 -0
  97. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/flint.yml +0 -0
  98. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/fluorine_doped_silica_1%.yml +0 -0
  99. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/fluorine_doped_silica_2%.yml +0 -0
  100. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/fused_silica.yml +0 -0
  101. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/germanium.yml +0 -0
  102. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/lithium_niobate.yml +0 -0
  103. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/polystyren.yml +0 -0
  104. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/silica.yml +0 -0
  105. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/silicon.yml +0 -0
  106. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/soda_lime_glass.yml +0 -0
  107. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/sellmeier/water.yml +0 -0
  108. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/tabulated/__init__.py +0 -0
  109. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/tabulated/aluminium.yml +0 -0
  110. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/tabulated/calcium.yml +0 -0
  111. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/tabulated/copper.yml +0 -0
  112. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/tabulated/default.py +0 -0
  113. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/tabulated/gold.yml +0 -0
  114. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/tabulated/iron.yml +0 -0
  115. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/tabulated/nickel.yml +0 -0
  116. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/tabulated/silver.yml +0 -0
  117. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/tabulated/sodium.yml +0 -0
  118. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/data/tabulated/zinc.yml +0 -0
  119. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/directories.py +0 -0
  120. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/download.py +0 -0
  121. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/material.py +0 -0
  122. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/sellmeier_class.py +0 -0
  123. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik/tabulated_class.py +0 -0
  124. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik.egg-info/dependency_links.txt +0 -0
  125. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik.egg-info/requires.txt +0 -0
  126. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/PyOptik.egg-info/top_level.txt +0 -0
  127. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/README.rst +0 -0
  128. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/Makefile +0 -0
  129. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/deprecated/experiment_material.py +0 -0
  130. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/examples/README.rst +0 -0
  131. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/examples/plot_bk7.py +0 -0
  132. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/examples/plot_sf5.py +0 -0
  133. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/examples/plot_silica.py +0 -0
  134. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/examples/plot_silver.py +0 -0
  135. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/examples/plot_water.py +0 -0
  136. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/images/example_bk7.png +0 -0
  137. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/images/logo.png +0 -0
  138. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/make.bat +0 -0
  139. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/_static/default.css +0 -0
  140. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/add_material.ipynb +0 -0
  141. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/add_material.py +0 -0
  142. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/add_material.rst +0 -0
  143. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/add_material_codeobj.pickle +0 -0
  144. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/get_values.ipynb +0 -0
  145. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/get_values.py +0 -0
  146. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/get_values.rst +0 -0
  147. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/get_values_codeobj.pickle +0 -0
  148. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/images/sphx_glr_plot_sellmeier_0_001.png +0 -0
  149. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/images/sphx_glr_plot_sellmeier_1_001.png +0 -0
  150. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/images/thumb/sphx_glr_add_material_thumb.png +0 -0
  151. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/images/thumb/sphx_glr_get_values_thumb.png +0 -0
  152. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/images/thumb/sphx_glr_plot_sellmeier_0_thumb.png +0 -0
  153. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/images/thumb/sphx_glr_plot_sellmeier_1_thumb.png +0 -0
  154. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/plot_sellmeier_0.ipynb +0 -0
  155. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/plot_sellmeier_0.py +0 -0
  156. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/plot_sellmeier_0.py.md5 +0 -0
  157. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/plot_sellmeier_0.rst +0 -0
  158. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/plot_sellmeier_0_codeobj.pickle +0 -0
  159. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/plot_sellmeier_1.ipynb +0 -0
  160. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/plot_sellmeier_1.py +0 -0
  161. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/plot_sellmeier_1.py.md5 +0 -0
  162. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/plot_sellmeier_1.rst +0 -0
  163. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/docs/source/gallery/plot_sellmeier_1_codeobj.pickle +0 -0
  164. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/setup.cfg +0 -0
  165. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/tests/__init__.py +0 -0
  166. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/tests/test_sellmeier.py +0 -0
  167. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/tests/test_tabulated.py +0 -0
  168. {pyoptik-1.3.1.post0 → pyoptik-1.4.0.post0}/tests/test_usual_material.py +0 -0
@@ -6,6 +6,8 @@
6
6
  *htmlcov
7
7
  *.coverage
8
8
  developments/*
9
+ PyOptik/data/**/test*
10
+ PyOptik/data/**/example*
9
11
 
10
12
  dist
11
13
  build
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyOptik
3
- Version: 1.3.1.post0
3
+ Version: 1.4.0.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,4 +7,6 @@ except ImportError:
7
7
 
8
8
  from .utils import build_default_library
9
9
  from .material import UsualMaterial
10
- from .base_class import Material
10
+ from .base_class import Material
11
+ from .tabulated_class import TabulatedMaterial
12
+ from .sellmeier_class import SellmeierMaterial
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '1.3.1.post0'
16
- __version_tuple__ = version_tuple = (1, 3, 1)
15
+ __version__ = version = '1.4.0.post0'
16
+ __version_tuple__ = version_tuple = (1, 4, 0)
@@ -0,0 +1,171 @@
1
+
2
+ import yaml
3
+ from typing import Optional, List, Tuple, NoReturn
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) -> NoReturn:
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() -> NoReturn:
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) -> NoReturn:
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) -> NoReturn:
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.1.post0
3
+ Version: 1.4.0.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
@@ -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()
@@ -0,0 +1,60 @@
1
+ :orphan:
2
+
3
+ .. _source_code:
4
+
5
+ Source Code Documentation
6
+ =========================
7
+
8
+ This section provides an overview of the key classes and functions within the `PyOptik` library, including the `Sellmeier` class. Detailed documentation of each component is generated automatically, showing all available members, inherited members, and their corresponding source code.
9
+
10
+ Class Documentation
11
+ ===================
12
+
13
+ Below, you'll find automatically generated documentation for other significant classes and functions in the `PyOptik` library.
14
+
15
+ .. _sellmeier_material:
16
+
17
+ SellmeierMaterial
18
+ -----------------
19
+
20
+ The `SellmeierMaterial` class extends the `Material` base class to specifically handle materials described by the Sellmeier equation.
21
+
22
+ .. autoclass:: PyOptik.SellmeierMaterial
23
+ :members:
24
+ :inherited-members:
25
+ :member-order: bysource
26
+ :show-inheritance:
27
+ :undoc-members:
28
+
29
+
30
+ TabulatedMaterial
31
+ -----------------
32
+
33
+ The `TabulatedMaterial` class extends the `Material` base class to specifically handle materials described by the tabulated values.
34
+
35
+ .. autoclass:: PyOptik.TabulatedMaterial
36
+ :members:
37
+ :inherited-members:
38
+ :member-order: bysource
39
+ :show-inheritance:
40
+ :undoc-members:
41
+
42
+ Utility Functions
43
+ -----------------
44
+
45
+ The `PyOptik.utils` module contains utility functions that assist with tasks like downloading data files, creating custom materials, and managing directories.
46
+
47
+ .. automodule:: PyOptik.utils
48
+ :members:
49
+ :undoc-members:
50
+ :show-inheritance:
51
+ :member-order: bysource
52
+
53
+ Directives for Sphinx Gallery
54
+ =============================
55
+
56
+ The following are directives for integrating code examples using Sphinx Gallery:
57
+
58
+ .. note::
59
+ You can find example usage of the `SellmeierMaterial` and `TabulatedMaterial` classes, along with utility functions, in the "Examples" section of the documentation. These examples are automatically generated from the code and illustrate practical applications of the library.
60
+
@@ -50,6 +50,7 @@ sphinx_gallery_conf = {
50
50
  'gallery_dirs': 'gallery',
51
51
  'image_scrapers': ('matplotlib'),
52
52
  'ignore_pattern': '/__',
53
+ 'filename_pattern': r'.*\.py',
53
54
  'plot_gallery': True,
54
55
  'thumbnail_size': [600, 600],
55
56
  'download_all_examples': False,
@@ -0,0 +1,43 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "\n# Example: Create a Custom Sellmeier YAML File\n\nThis example demonstrates how to create a custom Sellmeier YAML file using the\n`create_sellmeier_file` function from the `PyOptik.utils` module.\n"
8
+ ]
9
+ },
10
+ {
11
+ "cell_type": "code",
12
+ "execution_count": null,
13
+ "metadata": {
14
+ "collapsed": false
15
+ },
16
+ "outputs": [],
17
+ "source": [
18
+ "from PyOptik.utils import create_sellmeier_file\nfrom PyOptik.directories import sellmeier_data_path\nfrom PyOptik import SellmeierMaterial\n\n# Define the file properties\nfilename = 'example_sellmeier'\ncoefficients = [1.0, 0.5, 0.2, 0.1, 0.05]\nformula_type = 1\n\n# Call the function to create the file\ncreate_sellmeier_file(\n filename=filename,\n coefficients=coefficients,\n formula_type=formula_type,\n wavelength_range=(0.2, 2.0),\n reference=\"Sample Reference\",\n comments=\"This is a sample Sellmeier file created for demonstration purposes.\"\n)\n\nprint(f\"Sellmeier YAML file {filename}.yml has been created in {sellmeier_data_path}\")\n\nm = SellmeierMaterial('example_download')\n\nm.plot()"
19
+ ]
20
+ }
21
+ ],
22
+ "metadata": {
23
+ "kernelspec": {
24
+ "display_name": "Python 3",
25
+ "language": "python",
26
+ "name": "python3"
27
+ },
28
+ "language_info": {
29
+ "codemirror_mode": {
30
+ "name": "ipython",
31
+ "version": 3
32
+ },
33
+ "file_extension": ".py",
34
+ "mimetype": "text/x-python",
35
+ "name": "python",
36
+ "nbconvert_exporter": "python",
37
+ "pygments_lexer": "ipython3",
38
+ "version": "3.11.0"
39
+ }
40
+ },
41
+ "nbformat": 4,
42
+ "nbformat_minor": 0
43
+ }
@@ -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('example_download')
31
+
32
+ m.plot()
@@ -0,0 +1 @@
1
+ b9a236b8d62b0a4224483ca056ab4775