PyOptik 1.8.8.post0__tar.gz → 1.9.2.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 (164) hide show
  1. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/.github/workflows/deploy_coverage.yml +2 -4
  2. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/.gitignore +12 -9
  3. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PKG-INFO +11 -8
  4. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/__init__.py +2 -0
  5. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/_version.py +2 -2
  6. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/material/base_class.py +9 -0
  7. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/material/sellmeier_class.py +2 -3
  8. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/material/tabulated_class.py +7 -2
  9. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/material_bank.py +21 -32
  10. pyoptik-1.9.2.post0/PyOptik/material_type.py +9 -0
  11. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/utils.py +15 -5
  12. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik.egg-info/PKG-INFO +11 -8
  13. pyoptik-1.9.2.post0/PyOptik.egg-info/SOURCES.txt +91 -0
  14. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/README.rst +11 -8
  15. pyoptik-1.9.2.post0/development/dev_0.py +9 -0
  16. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/examples/utils/create_sellmeier_file.py +0 -3
  17. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/examples/utils/create_tabulated_file.py +1 -3
  18. {pyoptik-1.8.8.post0/docs/source/gallery → pyoptik-1.9.2.post0/docs/examples}/utils/download_yml_file.py +12 -7
  19. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/tests/test_sellmeier.py +1 -1
  20. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/tests/test_tabulated.py +1 -1
  21. pyoptik-1.9.2.post0/tests/test_usual_material.py +50 -0
  22. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/tests/test_utils.py +33 -15
  23. pyoptik-1.8.8.post0/PyOptik.egg-info/SOURCES.txt +0 -158
  24. pyoptik-1.8.8.post0/development/dev_0.py +0 -9
  25. pyoptik-1.8.8.post0/docs/examples/utils/download_yml_file.py +0 -23
  26. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/images/sphx_glr_plot_bk7_001.png +0 -0
  27. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/images/sphx_glr_plot_silica_001.png +0 -0
  28. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/images/sphx_glr_plot_water_001.png +0 -0
  29. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/images/thumb/sphx_glr_plot_bk7_thumb.png +0 -0
  30. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/images/thumb/sphx_glr_plot_silica_thumb.png +0 -0
  31. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/images/thumb/sphx_glr_plot_water_thumb.png +0 -0
  32. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/index.rst +0 -96
  33. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/plot_bk7.ipynb +0 -43
  34. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/plot_bk7.py +0 -23
  35. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/plot_bk7.py.md5 +0 -1
  36. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/plot_bk7.rst +0 -83
  37. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/plot_bk7_codeobj.pickle +0 -0
  38. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/plot_silica.ipynb +0 -43
  39. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/plot_silica.py +0 -22
  40. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/plot_silica.py.md5 +0 -1
  41. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/plot_silica.rst +0 -83
  42. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/plot_silica_codeobj.pickle +0 -0
  43. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/plot_water.ipynb +0 -43
  44. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/plot_water.py +0 -23
  45. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/plot_water.py.md5 +0 -1
  46. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/plot_water.rst +0 -84
  47. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/plot_water_codeobj.pickle +0 -0
  48. pyoptik-1.8.8.post0/docs/source/gallery/sellmeier/sg_execution_times.rst +0 -17
  49. pyoptik-1.8.8.post0/docs/source/gallery/tabulated/images/sphx_glr_plot_sf5_001.png +0 -0
  50. pyoptik-1.8.8.post0/docs/source/gallery/tabulated/images/sphx_glr_plot_silver_001.png +0 -0
  51. pyoptik-1.8.8.post0/docs/source/gallery/tabulated/images/thumb/sphx_glr_plot_sf5_thumb.png +0 -0
  52. pyoptik-1.8.8.post0/docs/source/gallery/tabulated/images/thumb/sphx_glr_plot_silver_thumb.png +0 -0
  53. pyoptik-1.8.8.post0/docs/source/gallery/tabulated/index.rst +0 -75
  54. pyoptik-1.8.8.post0/docs/source/gallery/tabulated/plot_sf5.ipynb +0 -43
  55. pyoptik-1.8.8.post0/docs/source/gallery/tabulated/plot_sf5.py +0 -22
  56. pyoptik-1.8.8.post0/docs/source/gallery/tabulated/plot_sf5.py.md5 +0 -1
  57. pyoptik-1.8.8.post0/docs/source/gallery/tabulated/plot_sf5.rst +0 -83
  58. pyoptik-1.8.8.post0/docs/source/gallery/tabulated/plot_sf5_codeobj.pickle +0 -0
  59. pyoptik-1.8.8.post0/docs/source/gallery/tabulated/plot_silver.ipynb +0 -43
  60. pyoptik-1.8.8.post0/docs/source/gallery/tabulated/plot_silver.py +0 -23
  61. pyoptik-1.8.8.post0/docs/source/gallery/tabulated/plot_silver.py.md5 +0 -1
  62. pyoptik-1.8.8.post0/docs/source/gallery/tabulated/plot_silver.rst +0 -112
  63. pyoptik-1.8.8.post0/docs/source/gallery/tabulated/plot_silver_codeobj.pickle +0 -0
  64. pyoptik-1.8.8.post0/docs/source/gallery/tabulated/sg_execution_times.rst +0 -15
  65. pyoptik-1.8.8.post0/docs/source/gallery/utils/build_library.ipynb +0 -50
  66. pyoptik-1.8.8.post0/docs/source/gallery/utils/build_library.py +0 -31
  67. pyoptik-1.8.8.post0/docs/source/gallery/utils/build_library.py.md5 +0 -1
  68. pyoptik-1.8.8.post0/docs/source/gallery/utils/build_library.rst +0 -152
  69. pyoptik-1.8.8.post0/docs/source/gallery/utils/build_library_codeobj.pickle +0 -0
  70. pyoptik-1.8.8.post0/docs/source/gallery/utils/create_sellmeier_file.ipynb +0 -43
  71. pyoptik-1.8.8.post0/docs/source/gallery/utils/create_sellmeier_file.py +0 -33
  72. pyoptik-1.8.8.post0/docs/source/gallery/utils/create_sellmeier_file.py.md5 +0 -1
  73. pyoptik-1.8.8.post0/docs/source/gallery/utils/create_sellmeier_file.rst +0 -105
  74. pyoptik-1.8.8.post0/docs/source/gallery/utils/create_sellmeier_file_codeobj.pickle +0 -0
  75. pyoptik-1.8.8.post0/docs/source/gallery/utils/create_tabulated_file.ipynb +0 -43
  76. pyoptik-1.8.8.post0/docs/source/gallery/utils/create_tabulated_file.py +0 -39
  77. pyoptik-1.8.8.post0/docs/source/gallery/utils/create_tabulated_file.py.md5 +0 -1
  78. pyoptik-1.8.8.post0/docs/source/gallery/utils/create_tabulated_file.rst +0 -111
  79. pyoptik-1.8.8.post0/docs/source/gallery/utils/create_tabulated_file_codeobj.pickle +0 -0
  80. pyoptik-1.8.8.post0/docs/source/gallery/utils/download_yml_file.ipynb +0 -43
  81. pyoptik-1.8.8.post0/docs/source/gallery/utils/download_yml_file.py.md5 +0 -1
  82. pyoptik-1.8.8.post0/docs/source/gallery/utils/download_yml_file.rst +0 -95
  83. pyoptik-1.8.8.post0/docs/source/gallery/utils/download_yml_file_codeobj.pickle +0 -0
  84. pyoptik-1.8.8.post0/docs/source/gallery/utils/images/sphx_glr_create_sellmeier_file_001.png +0 -0
  85. pyoptik-1.8.8.post0/docs/source/gallery/utils/images/sphx_glr_create_tabulated_file_001.png +0 -0
  86. pyoptik-1.8.8.post0/docs/source/gallery/utils/images/sphx_glr_download_yml_file_001.png +0 -0
  87. pyoptik-1.8.8.post0/docs/source/gallery/utils/images/thumb/sphx_glr_build_library_thumb.png +0 -0
  88. pyoptik-1.8.8.post0/docs/source/gallery/utils/images/thumb/sphx_glr_create_sellmeier_file_thumb.png +0 -0
  89. pyoptik-1.8.8.post0/docs/source/gallery/utils/images/thumb/sphx_glr_create_tabulated_file_thumb.png +0 -0
  90. pyoptik-1.8.8.post0/docs/source/gallery/utils/images/thumb/sphx_glr_download_yml_file_thumb.png +0 -0
  91. pyoptik-1.8.8.post0/docs/source/gallery/utils/index.rst +0 -104
  92. pyoptik-1.8.8.post0/docs/source/gallery/utils/sg_execution_times.rst +0 -19
  93. pyoptik-1.8.8.post0/tests/test_usual_material.py +0 -27
  94. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/.flake8 +0 -0
  95. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/.github/dependabot.yml +0 -0
  96. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/.github/workflows/deploy_anaconda.yml +0 -0
  97. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/.github/workflows/deploy_documentation.yml +0 -0
  98. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/.github/workflows/deploy_workflow.yml +0 -0
  99. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/.readthedocs.yml +0 -0
  100. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/LICENSE +0 -0
  101. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/__main__.py +0 -0
  102. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/__init__.py +0 -0
  103. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/sellmeier/BAK1.yml +0 -0
  104. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/sellmeier/BK7.yml +0 -0
  105. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/sellmeier/SF5.yml +0 -0
  106. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/sellmeier/ZBLAN.yml +0 -0
  107. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/sellmeier/air.yml +0 -0
  108. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/sellmeier/argon.yml +0 -0
  109. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/sellmeier/crown.yml +0 -0
  110. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/sellmeier/flint.yml +0 -0
  111. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/sellmeier/fused_silica.yml +0 -0
  112. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/sellmeier/germanium.yml +0 -0
  113. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/sellmeier/lithium_niobate.yml +0 -0
  114. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/sellmeier/polystyren.yml +0 -0
  115. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/sellmeier/silicon.yml +0 -0
  116. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/sellmeier/soda_lime_glass.yml +0 -0
  117. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/sellmeier/water.yml +0 -0
  118. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/tabulated/aluminium.yml +0 -0
  119. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/tabulated/calcium.yml +0 -0
  120. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/tabulated/copper.yml +0 -0
  121. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/tabulated/gold.yml +0 -0
  122. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/tabulated/iron.yml +0 -0
  123. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/tabulated/nickel.yml +0 -0
  124. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/tabulated/silver.yml +0 -0
  125. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/tabulated/sodium.yml +0 -0
  126. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/data/tabulated/zinc.yml +0 -0
  127. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/directories.py +0 -0
  128. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/libraries/__init__.py +0 -0
  129. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/libraries/classics.yml +0 -0
  130. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/libraries/dielectrics.yml +0 -0
  131. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/libraries/metals.yml +0 -0
  132. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/libraries/minimal.yml +0 -0
  133. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/libraries/organics.yml +0 -0
  134. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/libraries/others.yml +0 -0
  135. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/libraries/polymers.yml +0 -0
  136. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/material/__init__.py +0 -0
  137. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik/units.py +0 -0
  138. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik.egg-info/dependency_links.txt +0 -0
  139. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik.egg-info/requires.txt +0 -0
  140. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/PyOptik.egg-info/top_level.txt +0 -0
  141. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/Makefile +0 -0
  142. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/examples/README.rst +0 -0
  143. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/examples/sellmeier/README.rst +0 -0
  144. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/examples/sellmeier/plot_bk7.py +0 -0
  145. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/examples/sellmeier/plot_silica.py +0 -0
  146. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/examples/sellmeier/plot_water.py +0 -0
  147. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/examples/tabulated/README.rst +0 -0
  148. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/examples/tabulated/plot_sf5.py +0 -0
  149. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/examples/tabulated/plot_silver.py +0 -0
  150. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/examples/utils/README.rst +0 -0
  151. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/examples/utils/build_library.py +0 -0
  152. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/images/example_bk7.png +0 -0
  153. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/images/logo.png +0 -0
  154. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/make.bat +0 -0
  155. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/source/_static/default.css +0 -0
  156. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/source/code.rst +0 -0
  157. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/source/conf.py +0 -0
  158. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/source/gallery/index.rst +0 -0
  159. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/source/index.rst +0 -0
  160. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/docs/source/references.rst +0 -0
  161. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/meta.yaml +0 -0
  162. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/pyproject.toml +0 -0
  163. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/setup.cfg +0 -0
  164. {pyoptik-1.8.8.post0 → pyoptik-1.9.2.post0}/tests/__init__.py +0 -0
@@ -1,4 +1,4 @@
1
- # .github/workflows/deploy_coverage.yml
1
+ # .github/workflows/coverage.yml
2
2
  name: Coverage
3
3
 
4
4
  on:
@@ -19,7 +19,7 @@ jobs:
19
19
  contents: write
20
20
 
21
21
  steps:
22
- - name: "Set-up: Python 3.10"
22
+ - name: "Set-up: Python ${{ env.cp_python_version }}"
23
23
  uses: actions/setup-python@v4
24
24
  id: cp310
25
25
  with:
@@ -45,10 +45,8 @@ jobs:
45
45
  pytest
46
46
 
47
47
  - name: Coverage comment
48
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
49
48
  uses: py-cov-action/python-coverage-comment-action@v3
50
49
  with:
51
- GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}
52
50
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53
51
  MINIMUM_GREEN: 90
54
52
  MINIMUM_ORANGE: 50
@@ -1,20 +1,23 @@
1
+
2
+
3
+
1
4
  *.DS_store
2
5
  *.ipynb_checkpoints*
3
6
  *__pycache__*
4
7
  *.so
8
+ *.a
9
+ .coverage*
5
10
  *.pytest_cache
6
- *htmlcov
7
- *.coverage
8
- developments/*
9
- PyOptik/data/**/test*
10
- PyOptik/data/**/example*
11
-
11
+ htmlcov
12
12
  dist
13
13
  build
14
14
  *.egg*
15
- perso/
16
-
15
+ *.whl
17
16
  CMakeCache.txt
18
17
  CMakeFiles
19
18
  install_manifest.txt
20
- cmake_install.cmake
19
+ cmake_install.cmake
20
+ wheelhouse
21
+
22
+ docs/source/gallery/*
23
+ !docs/source/gallery/index.rst
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyOptik
3
- Version: 1.8.8.post0
3
+ Version: 1.9.2.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
@@ -203,15 +203,18 @@ You can add a custom material to your library by providing a URL from `refractiv
203
203
 
204
204
  .. code:: python
205
205
 
206
- from PyOptik.utils import download_yml_file
207
- from PyOptik.directories import sellmeier_data_path # or tabulated_data_path for tabulated elements
206
+ from PyOptik import MaterialBank, MaterialType
208
207
 
209
- download_yml_file(
210
- filename='test',
211
- url='https://refractiveindex.info/database/data-nk/main/H2O/Daimon-19.0C.yml',
212
- location=tabulated_data_path
208
+ # Define the URL of the YAML file and the destination
209
+ # Call the function to download the file
210
+ MaterialBank.add_material_to_bank(
211
+ filename='example_download',
212
+ material_type=MaterialType.SELLMEIER,
213
+ url='https://refractiveindex.info/database/data-nk/main/H2O/Daimon-19.0C.yml'
213
214
  )
214
215
 
216
+ MaterialBank.print_available()
217
+
215
218
  **Removing a Material:**
216
219
 
217
220
  You can also remove a material from the library as follows:
@@ -220,7 +223,7 @@ You can also remove a material from the library as follows:
220
223
 
221
224
  from PyOptik.utils import remove_element
222
225
 
223
- remove_element(filename='test', location='any') # location can be "any", "sellmeier" or "tabulated"
226
+ MaterialBank.remove_item(filename='example_download')
224
227
 
225
228
  Testing
226
229
  *******
@@ -6,6 +6,8 @@ except ImportError:
6
6
 
7
7
 
8
8
  from .material_bank import MaterialBank
9
+ from .material_type import MaterialType
10
+
9
11
  from .material import TabulatedMaterial
10
12
  from .material import SellmeierMaterial
11
13
  from .material import base_class
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '1.8.8.post0'
16
- __version_tuple__ = version_tuple = (1, 8, 8)
15
+ __version__ = version = '1.9.2.post0'
16
+ __version_tuple__ = version_tuple = (1, 9, 2)
@@ -8,6 +8,15 @@ import warnings
8
8
 
9
9
 
10
10
  class BaseMaterial:
11
+ def __eq__(self, other) -> bool:
12
+ if not isinstance(other, self.__class__):
13
+ return False
14
+
15
+ if self.filename != other.filename:
16
+ return False
17
+
18
+ return True
19
+
11
20
  def __str__(self) -> str:
12
21
  """
13
22
  Provides an informal string representation of the Material object.
@@ -6,8 +6,7 @@ import numpy
6
6
  import itertools
7
7
  from MPSPlots.styles import mps
8
8
  import matplotlib.pyplot as plt
9
- from pydantic import Field, ConfigDict
10
- from pydantic.dataclasses import dataclass
9
+ from pydantic.dataclasses import Field, ConfigDict, dataclass
11
10
  from typing import Tuple, Optional, Union
12
11
  from PyOptik.units import micrometer, Quantity
13
12
  from PyOptik.directories import sellmeier_data_path
@@ -19,7 +18,7 @@ config_dict = ConfigDict(
19
18
  )
20
19
 
21
20
 
22
- @dataclass(config=config_dict, slots=True)
21
+ @dataclass(config=config_dict, slots=True, eq=False)
23
22
  class SellmeierMaterial(BaseMaterial):
24
23
  """
25
24
  Class representing a material with Sellmeier coefficients for refractive index computation.
@@ -2,7 +2,7 @@
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
4
  import numpy
5
- from pydantic.dataclasses import dataclass, Field
5
+ from pydantic.dataclasses import dataclass, Field, ConfigDict
6
6
  from typing import Optional, Union
7
7
  import yaml
8
8
  from PyOptik.directories import tabulated_data_path
@@ -12,7 +12,12 @@ import matplotlib.pyplot as plt
12
12
  from PyOptik.units import Quantity, micrometer, meter
13
13
 
14
14
 
15
- @dataclass(config=dict(arbitrary_types_allowed=True))
15
+ config_dict = ConfigDict(
16
+ arbitrary_types_allowed=True
17
+ )
18
+
19
+
20
+ @dataclass(config=config_dict, slots=True, eq=False)
16
21
  class TabulatedMaterial(BaseMaterial):
17
22
  """
18
23
  Class representing a material with tabulated refractive index (n) and absorption (k) values.
@@ -8,18 +8,13 @@ import yaml
8
8
  import logging
9
9
  from pathlib import Path
10
10
  from typing import List, Union, Optional, Tuple
11
- from enum import Enum
12
11
  from PyOptik.directories import data_path, libraries_path
13
12
  from PyOptik.material.sellmeier_class import SellmeierMaterial
14
13
  from PyOptik.material.tabulated_class import TabulatedMaterial
15
14
  from PyOptik.utils import download_yml_file
16
15
  from tabulate import tabulate
17
16
  from dataclasses import dataclass
18
-
19
-
20
- class MaterialType(Enum):
21
- SELLMEIER = "sellmeier"
22
- TABULATED = "tabulated"
17
+ from PyOptik.material_type import MaterialType
23
18
 
24
19
 
25
20
  @dataclass(frozen=True, slots=True)
@@ -59,8 +54,8 @@ class _MaterialBank():
59
54
  If a material is not found in either the Sellmeier or Tabulated material lists.
60
55
  """
61
56
 
62
- only_tabulated: bool = False
63
- only_sellmeier: bool = False
57
+ use_tabulated: bool = True
58
+ use_sellmeier: bool = True
64
59
 
65
60
  def __getattr__(self, material_name: str) -> Union[SellmeierMaterial, TabulatedMaterial]:
66
61
  """
@@ -82,16 +77,10 @@ class _MaterialBank():
82
77
  If the material is not found in the filtered or unfiltered lists.
83
78
  """
84
79
  # Apply the filtering logic based on class-level attributes
85
- if self.only_sellmeier and material_name in self.sellmeier:
80
+ if material_name in self.sellmeier:
86
81
  return SellmeierMaterial(filename=material_name)
87
- elif self.only_tabulated and material_name in self.tabulated:
82
+ elif material_name in self.tabulated:
88
83
  return TabulatedMaterial(filename=material_name)
89
- elif not self.only_sellmeier and not self.only_tabulated:
90
- # If no filter is set, check in both lists
91
- if material_name in self.sellmeier:
92
- return SellmeierMaterial(filename=material_name)
93
- elif material_name in self.tabulated:
94
- return TabulatedMaterial(filename=material_name)
95
84
 
96
85
  raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{material_name}'")
97
86
 
@@ -117,30 +106,30 @@ class _MaterialBank():
117
106
  return self.__getattr__(material_name)
118
107
 
119
108
  @classmethod
120
- def set_filter(cls, only_tabulated: bool = False, only_sellmeier: bool = False) -> None:
109
+ def set_filter(cls, use_tabulated: bool = False, use_sellmeier: bool = False) -> None:
121
110
  """
122
111
  Set the filter for the MaterialBank.
123
112
 
124
113
  Parameters
125
114
  ----------
126
- only_tabulated : bool
115
+ use_tabulated : bool
127
116
  If True, restricts retrieval to tabulated materials only.
128
- only_sellmeier : bool
117
+ use_sellmeier : bool
129
118
  If True, restricts retrieval to sellmeier materials only.
130
119
 
131
120
  Raises
132
121
  ------
133
122
  ValueError
134
- If both only_tabulated and only_sellmeier are set to True.
123
+ If both use_tabulated and use_sellmeier are set to True.
135
124
  """
136
- if only_tabulated and only_sellmeier:
137
- raise ValueError("Cannot set both 'only_tabulated' and 'only_sellmeier' to True.")
125
+ if not use_tabulated and not use_sellmeier:
126
+ raise ValueError("Cannot set both 'use_tabulated' and 'use_sellmeier' to False.")
138
127
 
139
- cls.only_tabulated = only_tabulated
140
- cls.only_sellmeier = only_sellmeier
128
+ cls.use_tabulated = use_tabulated
129
+ cls.use_sellmeier = use_sellmeier
141
130
 
142
131
  def _list_materials(self, material_type: MaterialType) -> List[str]:
143
- """
132
+ """create_sellmeier_file
144
133
  Helper method to list materials of a specific type.
145
134
 
146
135
  Parameters
@@ -168,7 +157,7 @@ class _MaterialBank():
168
157
  List[str]
169
158
  A list of all Sellmeier material names.
170
159
  """
171
- return self._list_materials(MaterialType.SELLMEIER)
160
+ return self._list_materials(MaterialType.SELLMEIER) if self.use_sellmeier else []
172
161
 
173
162
  @property
174
163
  def tabulated(self) -> List[str]:
@@ -180,7 +169,7 @@ class _MaterialBank():
180
169
  List[str]
181
170
  A list of all Tabulated material names.
182
171
  """
183
- return self._list_materials(MaterialType.TABULATED)
172
+ return self._list_materials(MaterialType.TABULATED) if self.use_tabulated else []
184
173
 
185
174
  @property
186
175
  def all(self) -> List[str]:
@@ -239,15 +228,15 @@ class _MaterialBank():
239
228
  if material_type not in [MaterialType.SELLMEIER, MaterialType.TABULATED]:
240
229
  raise ValueError("Invalid material type. Please choose MaterialType.SELLMEIER or MaterialType.TABULATED.")
241
230
 
242
- return download_yml_file(filename=filename, url=url, location=data_path / material_type.value)
231
+ return download_yml_file(filename=filename, url=url, location=material_type)
243
232
 
244
233
  @classmethod
245
234
  def add_sellmeier_to_bank(cls, filename: str, url: str) -> None:
246
- return cls.add_material_to_bank(filename, url, MaterialType.SELLMEIER)
235
+ return cls.add_material_to_bank(filename=filename, url=url, material_type=MaterialType.SELLMEIER)
247
236
 
248
237
  @classmethod
249
238
  def add_tabulated_to_bank(cls, filename: str, url: str) -> None:
250
- return cls.add_material_to_bank(filename, url, MaterialType.TABULATED)
239
+ return cls.add_material_to_bank(filename=filename, url=url, material_type=MaterialType.TABULATED)
251
240
 
252
241
  @classmethod
253
242
  def remove_item(cls, filename: str, location: Union[str, MaterialType] = 'any') -> None:
@@ -360,12 +349,12 @@ class _MaterialBank():
360
349
  # Download new files for sellmeier
361
350
  if data_dict.get('sellmeier', False):
362
351
  for element_name, url in data_dict['sellmeier'].items():
363
- download_yml_file(url=url, filename=element_name, location=data_path / 'sellmeier')
352
+ download_yml_file(url=url, filename=element_name, location=MaterialType.SELLMEIER)
364
353
 
365
354
  # Download new files for tabulated
366
355
  if data_dict.get('tabulated', False):
367
356
  for element_name, url in data_dict['tabulated'].items():
368
- download_yml_file(url=url, filename=element_name, location=data_path / 'tabulated')
357
+ download_yml_file(url=url, filename=element_name, location=MaterialType.TABULATED)
369
358
 
370
359
  def create_sellmeier_file(
371
360
  self,
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+
4
+ from enum import Enum
5
+
6
+
7
+ class MaterialType(Enum):
8
+ SELLMEIER = "sellmeier"
9
+ TABULATED = "tabulated"
@@ -1,7 +1,10 @@
1
1
  import requests
2
+ import logging
3
+ from PyOptik.directories import sellmeier_data_path, tabulated_data_path
4
+ from PyOptik.material_type import MaterialType
2
5
 
3
6
 
4
- def download_yml_file(url: str, filename: str, location: str) -> None:
7
+ def download_yml_file(url: str, filename: str, location: MaterialType) -> None:
5
8
  """
6
9
  Downloads a .yml file from a specified URL and saves it locally.
7
10
 
@@ -16,7 +19,14 @@ def download_yml_file(url: str, filename: str, location: str) -> None:
16
19
  ------
17
20
  HTTPError: If the download fails due to an HTTP error.
18
21
  """
19
- file_path = location / f"{filename}.yml"
22
+ match location:
23
+ case MaterialType.SELLMEIER:
24
+ file_path = sellmeier_data_path / f"{filename}.yml"
25
+ case MaterialType.TABULATED:
26
+ file_path = tabulated_data_path / f"{filename}.yml"
27
+ case _:
28
+ raise ValueError(f"Location [{location}] is invalid, it can be either MaterialType.SELLMEIER or MaterialType.TABULATED")
29
+
20
30
  try:
21
31
  # Send a GET request to the URL
22
32
  response = requests.get(url)
@@ -28,9 +38,9 @@ def download_yml_file(url: str, filename: str, location: str) -> None:
28
38
  with open(file_path, 'wb') as file:
29
39
  file.write(response.content)
30
40
 
31
- print(f"File downloaded and saved to {file_path}")
41
+ logging.info(f"File downloaded and saved to {file_path}")
32
42
 
33
43
  except requests.exceptions.HTTPError as http_err:
34
- print(f"HTTP error occurred: {http_err}")
44
+ logging.warning(f"HTTP error occurred: {http_err}")
35
45
  except Exception as err:
36
- print(f"An error occurred: {err}")
46
+ logging.error(f"An error occurred: {err}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyOptik
3
- Version: 1.8.8.post0
3
+ Version: 1.9.2.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
@@ -203,15 +203,18 @@ You can add a custom material to your library by providing a URL from `refractiv
203
203
 
204
204
  .. code:: python
205
205
 
206
- from PyOptik.utils import download_yml_file
207
- from PyOptik.directories import sellmeier_data_path # or tabulated_data_path for tabulated elements
206
+ from PyOptik import MaterialBank, MaterialType
208
207
 
209
- download_yml_file(
210
- filename='test',
211
- url='https://refractiveindex.info/database/data-nk/main/H2O/Daimon-19.0C.yml',
212
- location=tabulated_data_path
208
+ # Define the URL of the YAML file and the destination
209
+ # Call the function to download the file
210
+ MaterialBank.add_material_to_bank(
211
+ filename='example_download',
212
+ material_type=MaterialType.SELLMEIER,
213
+ url='https://refractiveindex.info/database/data-nk/main/H2O/Daimon-19.0C.yml'
213
214
  )
214
215
 
216
+ MaterialBank.print_available()
217
+
215
218
  **Removing a Material:**
216
219
 
217
220
  You can also remove a material from the library as follows:
@@ -220,7 +223,7 @@ You can also remove a material from the library as follows:
220
223
 
221
224
  from PyOptik.utils import remove_element
222
225
 
223
- remove_element(filename='test', location='any') # location can be "any", "sellmeier" or "tabulated"
226
+ MaterialBank.remove_item(filename='example_download')
224
227
 
225
228
  Testing
226
229
  *******
@@ -0,0 +1,91 @@
1
+ .flake8
2
+ .gitignore
3
+ .readthedocs.yml
4
+ LICENSE
5
+ README.rst
6
+ meta.yaml
7
+ pyproject.toml
8
+ .github/dependabot.yml
9
+ .github/workflows/deploy_anaconda.yml
10
+ .github/workflows/deploy_coverage.yml
11
+ .github/workflows/deploy_documentation.yml
12
+ .github/workflows/deploy_workflow.yml
13
+ PyOptik/__init__.py
14
+ PyOptik/__main__.py
15
+ PyOptik/_version.py
16
+ PyOptik/directories.py
17
+ PyOptik/material_bank.py
18
+ PyOptik/material_type.py
19
+ PyOptik/units.py
20
+ PyOptik/utils.py
21
+ PyOptik.egg-info/PKG-INFO
22
+ PyOptik.egg-info/SOURCES.txt
23
+ PyOptik.egg-info/dependency_links.txt
24
+ PyOptik.egg-info/requires.txt
25
+ PyOptik.egg-info/top_level.txt
26
+ PyOptik/data/__init__.py
27
+ PyOptik/data/sellmeier/BAK1.yml
28
+ PyOptik/data/sellmeier/BK7.yml
29
+ PyOptik/data/sellmeier/SF5.yml
30
+ PyOptik/data/sellmeier/ZBLAN.yml
31
+ PyOptik/data/sellmeier/air.yml
32
+ PyOptik/data/sellmeier/argon.yml
33
+ PyOptik/data/sellmeier/crown.yml
34
+ PyOptik/data/sellmeier/flint.yml
35
+ PyOptik/data/sellmeier/fused_silica.yml
36
+ PyOptik/data/sellmeier/germanium.yml
37
+ PyOptik/data/sellmeier/lithium_niobate.yml
38
+ PyOptik/data/sellmeier/polystyren.yml
39
+ PyOptik/data/sellmeier/silicon.yml
40
+ PyOptik/data/sellmeier/soda_lime_glass.yml
41
+ PyOptik/data/sellmeier/water.yml
42
+ PyOptik/data/tabulated/aluminium.yml
43
+ PyOptik/data/tabulated/calcium.yml
44
+ PyOptik/data/tabulated/copper.yml
45
+ PyOptik/data/tabulated/gold.yml
46
+ PyOptik/data/tabulated/iron.yml
47
+ PyOptik/data/tabulated/nickel.yml
48
+ PyOptik/data/tabulated/silver.yml
49
+ PyOptik/data/tabulated/sodium.yml
50
+ PyOptik/data/tabulated/zinc.yml
51
+ PyOptik/libraries/__init__.py
52
+ PyOptik/libraries/classics.yml
53
+ PyOptik/libraries/dielectrics.yml
54
+ PyOptik/libraries/metals.yml
55
+ PyOptik/libraries/minimal.yml
56
+ PyOptik/libraries/organics.yml
57
+ PyOptik/libraries/others.yml
58
+ PyOptik/libraries/polymers.yml
59
+ PyOptik/material/__init__.py
60
+ PyOptik/material/base_class.py
61
+ PyOptik/material/sellmeier_class.py
62
+ PyOptik/material/tabulated_class.py
63
+ development/dev_0.py
64
+ docs/Makefile
65
+ docs/make.bat
66
+ docs/examples/README.rst
67
+ docs/examples/sellmeier/README.rst
68
+ docs/examples/sellmeier/plot_bk7.py
69
+ docs/examples/sellmeier/plot_silica.py
70
+ docs/examples/sellmeier/plot_water.py
71
+ docs/examples/tabulated/README.rst
72
+ docs/examples/tabulated/plot_sf5.py
73
+ docs/examples/tabulated/plot_silver.py
74
+ docs/examples/utils/README.rst
75
+ docs/examples/utils/build_library.py
76
+ docs/examples/utils/create_sellmeier_file.py
77
+ docs/examples/utils/create_tabulated_file.py
78
+ docs/examples/utils/download_yml_file.py
79
+ docs/images/example_bk7.png
80
+ docs/images/logo.png
81
+ docs/source/code.rst
82
+ docs/source/conf.py
83
+ docs/source/index.rst
84
+ docs/source/references.rst
85
+ docs/source/_static/default.css
86
+ docs/source/gallery/index.rst
87
+ tests/__init__.py
88
+ tests/test_sellmeier.py
89
+ tests/test_tabulated.py
90
+ tests/test_usual_material.py
91
+ tests/test_utils.py
@@ -143,15 +143,18 @@ You can add a custom material to your library by providing a URL from `refractiv
143
143
 
144
144
  .. code:: python
145
145
 
146
- from PyOptik.utils import download_yml_file
147
- from PyOptik.directories import sellmeier_data_path # or tabulated_data_path for tabulated elements
148
-
149
- download_yml_file(
150
- filename='test',
151
- url='https://refractiveindex.info/database/data-nk/main/H2O/Daimon-19.0C.yml',
152
- location=tabulated_data_path
146
+ from PyOptik import MaterialBank, MaterialType
147
+
148
+ # Define the URL of the YAML file and the destination
149
+ # Call the function to download the file
150
+ MaterialBank.add_material_to_bank(
151
+ filename='example_download',
152
+ material_type=MaterialType.SELLMEIER,
153
+ url='https://refractiveindex.info/database/data-nk/main/H2O/Daimon-19.0C.yml'
153
154
  )
154
155
 
156
+ MaterialBank.print_available()
157
+
155
158
  **Removing a Material:**
156
159
 
157
160
  You can also remove a material from the library as follows:
@@ -160,7 +163,7 @@ You can also remove a material from the library as follows:
160
163
 
161
164
  from PyOptik.utils import remove_element
162
165
 
163
- remove_element(filename='test', location='any') # location can be "any", "sellmeier" or "tabulated"
166
+ MaterialBank.remove_item(filename='example_download')
164
167
 
165
168
  Testing
166
169
  *******
@@ -0,0 +1,9 @@
1
+ import numpy
2
+ from PyOptik import MaterialBank
3
+ MaterialBank.build_library('classics', remove_previous=True)
4
+ # MaterialBank.print_available() # <- this will provide a table of Tabulated and Sellmeier materials name (usually metals are tabulated)
5
+ # material = MaterialBank.gold # <- this should be a TabulatedMaterial instance
6
+
7
+ # wavelength = numpy.linspace(300e-9, 500e-9, 100)
8
+
9
+ # ri = material.compute_refractive_index(wavelength)
@@ -7,7 +7,6 @@ This example demonstrates how to create a custom Sellmeier YAML file using the
7
7
  """
8
8
 
9
9
  # %%
10
- from PyOptik.directories import sellmeier_data_path
11
10
  from PyOptik import MaterialBank
12
11
 
13
12
  # Define the file properties
@@ -25,8 +24,6 @@ MaterialBank.create_sellmeier_file(
25
24
  comments="This is a sample Sellmeier file created for demonstration purposes. "
26
25
  )
27
26
 
28
- print(f"Sellmeier YAML file {filename}.yml has been created in {sellmeier_data_path}")
29
-
30
27
  m = MaterialBank.get(filename)
31
28
 
32
29
  m.plot()
@@ -7,9 +7,9 @@ This example demonstrates how to create a custom YAML file containing tabulated
7
7
  """
8
8
 
9
9
  # %%
10
- from PyOptik.directories import tabulated_data_path
11
10
  from PyOptik import MaterialBank
12
11
 
12
+
13
13
  # Define the tabulated data (wavelength in micrometers, n, k)
14
14
  tabulated_data = [
15
15
  (0.1879, 0.94, 1.337),
@@ -32,8 +32,6 @@ MaterialBank.create_tabulated_file(
32
32
  comments=comments
33
33
  )
34
34
 
35
- print(f"Tabulated YAML file {filename}.yml has been created in {tabulated_data_path}")
36
-
37
35
  m = MaterialBank.get(filename)
38
36
 
39
37
  m.plot()
@@ -7,17 +7,22 @@ This example demonstrates how to download a YAML file from a URL using the
7
7
  """
8
8
 
9
9
  # %%
10
- from PyOptik.utils import download_yml_file
11
- from PyOptik.directories import sellmeier_data_path
12
- from PyOptik import MaterialBank
10
+ from PyOptik import MaterialBank, MaterialType
13
11
 
14
12
  # Define the URL of the YAML file and the destination
15
- url = 'https://refractiveindex.info/database/data-nk/main/H2O/Daimon-19.0C.yml'
16
- filename = 'example_download'
17
-
18
13
  # Call the function to download the file
19
- download_yml_file(filename=filename, url=url, location=sellmeier_data_path)
14
+ MaterialBank.add_material_to_bank(
15
+ filename='example_download',
16
+ material_type=MaterialType.SELLMEIER,
17
+ url='https://refractiveindex.info/database/data-nk/main/H2O/Daimon-19.0C.yml'
18
+ )
19
+
20
+ MaterialBank.print_available()
20
21
 
21
22
  m = MaterialBank.get('example_download')
22
23
 
23
24
  m.plot()
25
+
26
+ MaterialBank.remove_item(filename='example_download')
27
+
28
+ MaterialBank.print_available()
@@ -10,7 +10,7 @@ import matplotlib.pyplot as plt
10
10
  from PyOptik.units import meter, micrometer, Quantity
11
11
 
12
12
  # MaterialBank.build_library('minimal', remove_previous=True)
13
-
13
+ MaterialBank.set_filter(use_sellmeier=True, use_tabulated=True)
14
14
  material_list = MaterialBank.sellmeier
15
15
 
16
16
 
@@ -11,7 +11,7 @@ from PyOptik import MaterialBank
11
11
 
12
12
 
13
13
  # MaterialBank.build_library('minimal', remove_previous=True)
14
-
14
+ MaterialBank.set_filter(use_sellmeier=True, use_tabulated=True)
15
15
  material_list = MaterialBank.tabulated
16
16
 
17
17