PyOptik 2.0.1__tar.gz → 2.0.3__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 (140) hide show
  1. {pyoptik-2.0.1 → pyoptik-2.0.3}/.github/dependabot.yml +1 -1
  2. pyoptik-2.0.3/.gitignore +29 -0
  3. pyoptik-2.0.3/.pre-commit-config.yaml +20 -0
  4. {pyoptik-2.0.1 → pyoptik-2.0.3}/PKG-INFO +2 -2
  5. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/_version.py +3 -3
  6. pyoptik-2.0.3/PyOptik/data/sellmeier/example_sellmeier.yml +6 -0
  7. pyoptik-2.0.3/PyOptik/data/sellmeier/test_sellmeier_file.yml +7 -0
  8. pyoptik-2.0.3/PyOptik/data/tabulated/example_tabulated.yml +13 -0
  9. pyoptik-2.0.3/PyOptik/data/tabulated/test_tabulated_file.yml +9 -0
  10. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/material/sellmeier_class.py +6 -11
  11. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/material/tabulated_class.py +6 -12
  12. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik.egg-info/PKG-INFO +2 -2
  13. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik.egg-info/SOURCES.txt +5 -1
  14. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik.egg-info/requires.txt +1 -1
  15. {pyoptik-2.0.1 → pyoptik-2.0.3}/pyproject.toml +1 -1
  16. pyoptik-2.0.1/.gitignore +0 -28
  17. pyoptik-2.0.1/docs/source/gallery/index.rst +0 -289
  18. {pyoptik-2.0.1 → pyoptik-2.0.3}/.flake8 +0 -0
  19. {pyoptik-2.0.1 → pyoptik-2.0.3}/.github/workflows/deploy_PyPi.yml +0 -0
  20. {pyoptik-2.0.1 → pyoptik-2.0.3}/.github/workflows/deploy_anaconda.yml +0 -0
  21. {pyoptik-2.0.1 → pyoptik-2.0.3}/.github/workflows/deploy_coverage.yml +0 -0
  22. {pyoptik-2.0.1 → pyoptik-2.0.3}/.github/workflows/deploy_documentation.yml +0 -0
  23. {pyoptik-2.0.1 → pyoptik-2.0.3}/LICENSE +0 -0
  24. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/__init__.py +0 -0
  25. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/__main__.py +0 -0
  26. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/__init__.py +0 -0
  27. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/BAF10.yml +0 -0
  28. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/BAK1.yml +0 -0
  29. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/BK7.yml +0 -0
  30. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/FK51A.yml +0 -0
  31. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/LASF9.yml +0 -0
  32. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/SF10.yml +0 -0
  33. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/SF11.yml +0 -0
  34. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/SF5.yml +0 -0
  35. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/ZBLAN.yml +0 -0
  36. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/acetone.yml +0 -0
  37. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/acetylene.yml +0 -0
  38. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/air.yml +0 -0
  39. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/argon.yml +0 -0
  40. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/cellulose.yml +0 -0
  41. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/crown.yml +0 -0
  42. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/ethane.yml +0 -0
  43. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/ethanol.yml +0 -0
  44. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/ethylene.yml +0 -0
  45. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/flint.yml +0 -0
  46. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/fused_silica.yml +0 -0
  47. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/germanium.yml +0 -0
  48. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/glycerol.yml +0 -0
  49. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/lithium_niobate.yml +0 -0
  50. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/methane.yml +0 -0
  51. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/methanol.yml +0 -0
  52. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/polycarbonate.yml +0 -0
  53. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/polystyren.yml +0 -0
  54. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/polystyrene.yml +0 -0
  55. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/propanol.yml +0 -0
  56. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/pvc.yml +0 -0
  57. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/soda_lime_glass.yml +0 -0
  58. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/sellmeier/water.yml +0 -0
  59. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/aluminium.yml +0 -0
  60. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/bismuth.yml +0 -0
  61. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/calcium.yml +0 -0
  62. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/chromium.yml +0 -0
  63. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/copper.yml +0 -0
  64. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/gold.yml +0 -0
  65. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/iron.yml +0 -0
  66. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/lead.yml +0 -0
  67. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/magnesium.yml +0 -0
  68. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/nickel.yml +0 -0
  69. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/paladium.yml +0 -0
  70. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/polyetylene.yml +0 -0
  71. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/pva.yml +0 -0
  72. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/rhodium.yml +0 -0
  73. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/silicon.yml +0 -0
  74. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/silver.yml +0 -0
  75. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/sodium.yml +0 -0
  76. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/tantalum.yml +0 -0
  77. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/titanium.yml +0 -0
  78. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/tungsten.yml +0 -0
  79. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/vanadium.yml +0 -0
  80. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/data/tabulated/zinc.yml +0 -0
  81. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/directories.py +0 -0
  82. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/libraries/__init__.py +0 -0
  83. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/libraries/classics.yml +0 -0
  84. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/libraries/dielectrics.yml +0 -0
  85. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/libraries/metals.yml +0 -0
  86. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/libraries/minimal.yml +0 -0
  87. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/libraries/organics.yml +0 -0
  88. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/libraries/others.yml +0 -0
  89. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/libraries/polymers.yml +0 -0
  90. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/libraries/repertoire.yml +0 -0
  91. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/material/__init__.py +0 -0
  92. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/material/base_class.py +0 -0
  93. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/material_bank.py +0 -0
  94. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/material_type.py +0 -0
  95. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik/utils.py +0 -0
  96. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik.egg-info/dependency_links.txt +0 -0
  97. {pyoptik-2.0.1 → pyoptik-2.0.3}/PyOptik.egg-info/top_level.txt +0 -0
  98. {pyoptik-2.0.1 → pyoptik-2.0.3}/README.rst +0 -0
  99. {pyoptik-2.0.1 → pyoptik-2.0.3}/development/dev_0.py +0 -0
  100. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/Makefile +0 -0
  101. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/README.rst +0 -0
  102. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/group_properties/README.rst +0 -0
  103. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/group_properties/plot_group_properties.py +0 -0
  104. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/sellmeier/README.rst +0 -0
  105. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/sellmeier/plot_bk7.py +0 -0
  106. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/sellmeier/plot_compare_glasses.py +0 -0
  107. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/sellmeier/plot_silica.py +0 -0
  108. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/sellmeier/plot_water.py +0 -0
  109. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/tabulated/README.rst +0 -0
  110. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/tabulated/plot_polyethylene.py +0 -0
  111. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/tabulated/plot_silicon_nk.py +0 -0
  112. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/tabulated/plot_silver.py +0 -0
  113. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/utils/README.rst +0 -0
  114. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/utils/__build_library.py +0 -0
  115. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/utils/__download_yml_file.py +0 -0
  116. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/utils/create_sellmeier_file.py +0 -0
  117. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/utils/create_tabulated_file.py +0 -0
  118. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/examples/utils/search_materials.py +0 -0
  119. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/images/example_bk7.png +0 -0
  120. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/images/logo.png +0 -0
  121. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/make.bat +0 -0
  122. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/source/_static/default.css +0 -0
  123. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/source/_static/thumbnail.png +0 -0
  124. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/source/code.rst +0 -0
  125. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/source/conf.py +0 -0
  126. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/source/index.rst +0 -0
  127. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/source/references.rst +0 -0
  128. {pyoptik-2.0.1 → pyoptik-2.0.3}/docs/source/sg_execution_times.rst +0 -0
  129. {pyoptik-2.0.1 → pyoptik-2.0.3}/meta.yaml +0 -0
  130. {pyoptik-2.0.1 → pyoptik-2.0.3}/setup.cfg +0 -0
  131. {pyoptik-2.0.1 → pyoptik-2.0.3}/tests/__init__.py +0 -0
  132. {pyoptik-2.0.1 → pyoptik-2.0.3}/tests/test_base_material_decorator.py +0 -0
  133. {pyoptik-2.0.1 → pyoptik-2.0.3}/tests/test_group_properties.py +0 -0
  134. {pyoptik-2.0.1 → pyoptik-2.0.3}/tests/test_main_cli.py +0 -0
  135. {pyoptik-2.0.1 → pyoptik-2.0.3}/tests/test_material_bank_extra.py +0 -0
  136. {pyoptik-2.0.1 → pyoptik-2.0.3}/tests/test_sellmeier.py +0 -0
  137. {pyoptik-2.0.1 → pyoptik-2.0.3}/tests/test_tabulated.py +0 -0
  138. {pyoptik-2.0.1 → pyoptik-2.0.3}/tests/test_usual_materials.py +0 -0
  139. {pyoptik-2.0.1 → pyoptik-2.0.3}/tests/test_utils.py +0 -0
  140. {pyoptik-2.0.1 → pyoptik-2.0.3}/tests/test_utils_extra.py +0 -0
@@ -6,6 +6,6 @@ updates:
6
6
  directory: "/"
7
7
  target-branch: "master"
8
8
  schedule:
9
- interval: "weekly"
9
+ interval: "monthly"
10
10
  day: "sunday"
11
11
  time: "09:00"
@@ -0,0 +1,29 @@
1
+
2
+ # Ignore all
3
+ /*
4
+
5
+ # Except ...
6
+ !.github
7
+ !PyOptik
8
+ !development
9
+ !docs
10
+ !tests
11
+ !.flake8
12
+ !.gitignore
13
+ !.pre-commit-config.yaml
14
+ !LICENSE
15
+ !meta.yaml
16
+ !pyproject.toml
17
+ !README.rst
18
+ !notebook.ipynb
19
+ !CMakeLists.txt
20
+
21
+ # But ignore docs/build inside docs and code
22
+ docs/build/
23
+ docs/source/gallery/
24
+
25
+ # Compiled files in the project
26
+ *__pycache__*
27
+ *.DS_Store*
28
+ *.so*
29
+ *.a*
@@ -0,0 +1,20 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.6.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-added-large-files
9
+
10
+ - repo: https://github.com/psf/black
11
+ rev: 24.4.2
12
+ hooks:
13
+ - id: black
14
+
15
+ - repo: https://github.com/astral-sh/ruff-pre-commit
16
+ rev: v0.6.9
17
+ hooks:
18
+ - id: ruff
19
+ args: [--select, I, --fix] # import-order rules + auto-fix
20
+ - id: ruff-format # optional (formatter)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyOptik
3
- Version: 2.0.1
3
+ Version: 2.0.3
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
@@ -40,7 +40,7 @@ Requires-Dist: numpy
40
40
  Requires-Dist: matplotlib~=3.8
41
41
  Requires-Dist: requests~=2.31
42
42
  Requires-Dist: pyyaml~=6.0
43
- Requires-Dist: MPSPlots>=1.6
43
+ Requires-Dist: MPSPlots
44
44
  Requires-Dist: tabulate~=0.9
45
45
  Requires-Dist: TypedUnit
46
46
  Provides-Extra: testing
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '2.0.1'
32
- __version_tuple__ = version_tuple = (2, 0, 1)
31
+ __version__ = version = '2.0.3'
32
+ __version_tuple__ = version_tuple = (2, 0, 3)
33
33
 
34
- __commit_id__ = commit_id = 'g052103443'
34
+ __commit_id__ = commit_id = 'g3462f06c3'
@@ -0,0 +1,6 @@
1
+ COMMENTS: 'This is a sample Sellmeier file created for demonstration purposes. '
2
+ DATA:
3
+ - coefficients: 1.86e-06 1.31e-08 -1.37e-11 4.34e-07 0.627 0.17
4
+ type: formula 1
5
+ wavelength_range: 0.2 2.0
6
+ REFERENCES: Sample Reference
@@ -0,0 +1,7 @@
1
+ COMMENTS: Dummy comment
2
+ DATA:
3
+ - coefficients: 0 10.6684293 0.301516485 0.0030434748 1.13475115 1.54133408 1104
4
+ type: formula 2
5
+ wavelength_range: 1 1.2
6
+ REFERENCES: None
7
+ SPECS: Random specs
@@ -0,0 +1,13 @@
1
+ COMMENTS: 'This file contains sample tabulated data for demonstration purposes. '
2
+ DATA:
3
+ - data: '0.1879 0.94 1.337
4
+
5
+ 0.1916 0.95 1.388
6
+
7
+ 0.1953 0.97 1.44
8
+
9
+ 0.1993 0.98 1.493
10
+
11
+ 0.2033 0.99 1.55'
12
+ type: tabulated nk
13
+ REFERENCES: Example Reference for Tabulated Data
@@ -0,0 +1,9 @@
1
+ COMMENTS: Room temperature
2
+ DATA:
3
+ - data: '0.1879 0.94 1.337
4
+
5
+ 0.1916 0.95 1.388
6
+
7
+ 0.1953 0.97 1.44'
8
+ type: tabulated nk
9
+ REFERENCES: Example of tabulated test file
@@ -4,8 +4,7 @@
4
4
  import yaml
5
5
  import numpy
6
6
  import itertools
7
- from MPSPlots.styles import mps
8
- import matplotlib.pyplot as plt
7
+ from MPSPlots import helper
9
8
  from TypedUnit import Length, RefractiveIndex, validate_units, ureg
10
9
 
11
10
  from PyOptik.directories import sellmeier_data_path
@@ -148,7 +147,8 @@ class SellmeierMaterial(BaseMaterial):
148
147
 
149
148
  return n[0] if return_as_scalar else n
150
149
 
151
- def plot(self, samples: int = 100) -> None:
150
+ @helper.pre_plot(nrows=1, ncols=1)
151
+ def plot(self, axes, samples: int = 100) -> None:
152
152
  """
153
153
  Plots the refractive index as a function of wavelength over a specified range.
154
154
 
@@ -171,18 +171,13 @@ class SellmeierMaterial(BaseMaterial):
171
171
  # Calculate the refractive index over the wavelength range
172
172
  refractive_index = self.compute_refractive_index(wavelength)
173
173
 
174
- with plt.style.context(mps):
175
- fig, ax = plt.subplots()
176
-
177
- ax.set(
174
+ axes.set(
178
175
  ylabel='Refractive Index',
179
176
  xlabel=r'Wavelength [$\mu$m]',
180
177
  title=f"Refractive Index vs. Wavelength: [{self.filename}]"
181
178
  )
182
- ax.plot(wavelength.to(ureg.micrometer).magnitude, refractive_index.real, linewidth=2, label='Real Part')
183
- ax.legend()
184
-
185
- plt.show()
179
+ axes.plot(wavelength.to(ureg.micrometer).magnitude, refractive_index.real, linewidth=2, label='Real Part')
180
+ axes.legend()
186
181
 
187
182
  def print(self) -> str:
188
183
  """
@@ -2,10 +2,8 @@
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
4
  import numpy
5
- from typing import Optional, Union
6
5
  import yaml
7
- import matplotlib.pyplot as plt
8
- from MPSPlots.styles import mps
6
+ from MPSPlots import helper
9
7
  from TypedUnit import Length, validate_units, ureg
10
8
 
11
9
  from PyOptik.material.base_class import BaseMaterial
@@ -128,7 +126,8 @@ class TabulatedMaterial(BaseMaterial):
128
126
 
129
127
  return index[0] if return_as_scalar else index
130
128
 
131
- def plot(self, samples: int = 100) -> None:
129
+ @helper.pre_plot(nrows=1, ncols=1)
130
+ def plot(self, axes, samples: int = 100) -> None:
132
131
  """
133
132
  Plots the tabulated refractive index (n) and absorption (k) as a function of wavelength.
134
133
 
@@ -150,18 +149,15 @@ class TabulatedMaterial(BaseMaterial):
150
149
 
151
150
  n_values, k_values = self.compute_refractive_index(wavelength).real, self.compute_refractive_index(wavelength).imag
152
151
 
153
- with plt.style.context(mps):
154
- _, ax1 = plt.subplots()
155
-
156
- ax1.set(
152
+ axes.set(
157
153
  title=f"Refractive Index and Absorption vs. Wavelength [{self.filename}]",
158
154
  xlabel='Wavelength [µm]',
159
155
  ylabel='Refractive Index (n)',
160
156
  )
161
157
 
162
- ax1.plot(wavelength.to(ureg.micrometer).magnitude, n_values, 'o-', color='tab:blue', label='n')
158
+ axes.plot(wavelength.to(ureg.micrometer).magnitude, n_values, 'o-', color='tab:blue', label='n')
163
159
 
164
- ax2 = ax1.twinx()
160
+ ax2 = axes.twinx()
165
161
 
166
162
  ax2.set(
167
163
  xlabel='Wavelength [µm]',
@@ -170,8 +166,6 @@ class TabulatedMaterial(BaseMaterial):
170
166
 
171
167
  ax2.plot(wavelength.to(ureg.micrometer).magnitude, k_values, 'o-', color='tab:red', label='k')
172
168
 
173
- plt.show()
174
-
175
169
  def print(self) -> str:
176
170
  """
177
171
  Provides a formal string representation of the TabulatedMaterial object, including key attributes.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyOptik
3
- Version: 2.0.1
3
+ Version: 2.0.3
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
@@ -40,7 +40,7 @@ Requires-Dist: numpy
40
40
  Requires-Dist: matplotlib~=3.8
41
41
  Requires-Dist: requests~=2.31
42
42
  Requires-Dist: pyyaml~=6.0
43
- Requires-Dist: MPSPlots>=1.6
43
+ Requires-Dist: MPSPlots
44
44
  Requires-Dist: tabulate~=0.9
45
45
  Requires-Dist: TypedUnit
46
46
  Provides-Extra: testing
@@ -1,5 +1,6 @@
1
1
  .flake8
2
2
  .gitignore
3
+ .pre-commit-config.yaml
3
4
  LICENSE
4
5
  README.rst
5
6
  meta.yaml
@@ -40,6 +41,7 @@ PyOptik/data/sellmeier/crown.yml
40
41
  PyOptik/data/sellmeier/ethane.yml
41
42
  PyOptik/data/sellmeier/ethanol.yml
42
43
  PyOptik/data/sellmeier/ethylene.yml
44
+ PyOptik/data/sellmeier/example_sellmeier.yml
43
45
  PyOptik/data/sellmeier/flint.yml
44
46
  PyOptik/data/sellmeier/fused_silica.yml
45
47
  PyOptik/data/sellmeier/germanium.yml
@@ -53,12 +55,14 @@ PyOptik/data/sellmeier/polystyrene.yml
53
55
  PyOptik/data/sellmeier/propanol.yml
54
56
  PyOptik/data/sellmeier/pvc.yml
55
57
  PyOptik/data/sellmeier/soda_lime_glass.yml
58
+ PyOptik/data/sellmeier/test_sellmeier_file.yml
56
59
  PyOptik/data/sellmeier/water.yml
57
60
  PyOptik/data/tabulated/aluminium.yml
58
61
  PyOptik/data/tabulated/bismuth.yml
59
62
  PyOptik/data/tabulated/calcium.yml
60
63
  PyOptik/data/tabulated/chromium.yml
61
64
  PyOptik/data/tabulated/copper.yml
65
+ PyOptik/data/tabulated/example_tabulated.yml
62
66
  PyOptik/data/tabulated/gold.yml
63
67
  PyOptik/data/tabulated/iron.yml
64
68
  PyOptik/data/tabulated/lead.yml
@@ -72,6 +76,7 @@ PyOptik/data/tabulated/silicon.yml
72
76
  PyOptik/data/tabulated/silver.yml
73
77
  PyOptik/data/tabulated/sodium.yml
74
78
  PyOptik/data/tabulated/tantalum.yml
79
+ PyOptik/data/tabulated/test_tabulated_file.yml
75
80
  PyOptik/data/tabulated/titanium.yml
76
81
  PyOptik/data/tabulated/tungsten.yml
77
82
  PyOptik/data/tabulated/vanadium.yml
@@ -119,7 +124,6 @@ docs/source/references.rst
119
124
  docs/source/sg_execution_times.rst
120
125
  docs/source/_static/default.css
121
126
  docs/source/_static/thumbnail.png
122
- docs/source/gallery/index.rst
123
127
  tests/__init__.py
124
128
  tests/test_base_material_decorator.py
125
129
  tests/test_group_properties.py
@@ -3,7 +3,7 @@ numpy
3
3
  matplotlib~=3.8
4
4
  requests~=2.31
5
5
  pyyaml~=6.0
6
- MPSPlots>=1.6
6
+ MPSPlots
7
7
  tabulate~=0.9
8
8
  TypedUnit
9
9
 
@@ -27,7 +27,7 @@ dependencies = [
27
27
  "matplotlib ~=3.8",
28
28
  "requests ~=2.31",
29
29
  "pyyaml ~=6.0",
30
- "MPSPlots >=1.6",
30
+ "MPSPlots",
31
31
  "tabulate ~=0.9",
32
32
  "TypedUnit"
33
33
  ]
pyoptik-2.0.1/.gitignore DELETED
@@ -1,28 +0,0 @@
1
- # General patterns
2
- *.DS_store
3
- *.ipynb_checkpoints*
4
- *__pycache__*
5
- *.so
6
- *.a
7
- .coverage*
8
- *.pytest_cache
9
- htmlcov*
10
- dist
11
- build
12
- *.egg*
13
- *.whl
14
- CMakeCache.txt
15
- CMakeFiles
16
- install_manifest.txt
17
- cmake_install.cmake
18
- wheelhouse
19
-
20
- # Docs-specific patterns
21
- docs/source/gallery/*
22
- !docs/source/gallery/index.rst
23
- PyOptik/data/**/test*
24
- PyOptik/data/**/example*
25
-
26
- # Override for documentation_build
27
- !documentation_build
28
- !documentation_build/**
@@ -1,289 +0,0 @@
1
- :orphan:
2
-
3
- .. _examples_gallery:
4
-
5
- Examples Gallery
6
- ================
7
-
8
- Welcome to the PyOptik Examples Gallery. Here you will find a collection of examples that demonstrate the versatility and power of PyOptik.
9
- These examples range from simple introductory use cases to more advanced, application-specific tutorials.
10
-
11
- The gallery includes:
12
-
13
- - **Basic API Usage**: Learn how to get started with PyOptik, covering fundamental operations and core functionalities of the library.
14
-
15
- - **Application Tutorials**: Follow step-by-step guides that show how PyOptik can be used in practical, real-world scenarios, such as:
16
-
17
- - **Simulating Optical Properties**: Understand how to simulate the optical properties of various materials, including refractive index and absorption characteristics.
18
-
19
- - **Fiber Optic Analysis**: See how PyOptik can be utilized for fiber optics simulations, providing insights into light propagation and mode analysis.
20
-
21
- - **Biomedical Imaging Applications**: Discover how PyOptik can be leveraged for imaging purposes, including applications in biomedical optics.
22
-
23
- These examples are designed to help users at all levels, whether you are a beginner learning how to use the basic API or an experienced user looking for guidance on more advanced use cases.
24
-
25
- Explore the gallery and unlock the potential of PyOptik for your optical simulations and research!
26
-
27
-
28
- .. toctree::
29
- :maxdepth: 2
30
- :hidden:
31
-
32
- sellmeier/index.rst
33
- tabulated/index.rst
34
- utils/index.rst
35
-
36
-
37
-
38
-
39
- .. raw:: html
40
-
41
- <div class="sphx-glr-thumbnails">
42
-
43
-
44
- .. raw:: html
45
-
46
- </div>
47
-
48
- Examples: Sellmeier Material
49
- ============================
50
-
51
- This folder contains examples that demonstrate how to use the `SellmeierMaterial` class from the PyOptik library. These examples illustrate the practical applications of modeling materials using the Sellmeier equation, which is commonly used in optical design to determine the refractive index of various materials.
52
-
53
- Contents
54
- --------
55
-
56
- - **Basic Sellmeier Calculation**: Shows how to instantiate the `SellmeierMaterial` class and calculate the refractive index for different wavelengths.
57
- - **Plotting Refractive Index**: Demonstrates how to visualize the refractive index as a function of wavelength using the `plot` method.
58
- - **Application Example**: Provides an example of how to use the Sellmeier model in a more advanced optical simulation or analysis.
59
-
60
- Usage
61
- -----
62
-
63
- To run these examples, make sure you have installed all required dependencies as outlined in the main `PyOptik` README. Navigate to this folder and execute the Python scripts as follows:
64
-
65
-
66
-
67
- .. raw:: html
68
-
69
- <div class="sphx-glr-thumbnails">
70
-
71
-
72
- .. raw:: html
73
-
74
- <div class="sphx-glr-thumbcontainer" tooltip="This module demonstrates the usage of the PyOptik library to calculate and plot the refractive ...">
75
-
76
- .. only:: html
77
-
78
- .. image:: /gallery/sellmeier/images/thumb/sphx_glr_plot_bk7_thumb.png
79
- :alt:
80
-
81
- :ref:`sphx_glr_gallery_sellmeier_plot_bk7.py`
82
-
83
- .. raw:: html
84
-
85
- <div class="sphx-glr-thumbnail-title">Plot the Refractive Index of Optical Material: BK7</div>
86
- </div>
87
-
88
-
89
- .. raw:: html
90
-
91
- <div class="sphx-glr-thumbcontainer" tooltip="This module demonstrates the usage of the PyOptik library to calculate and plot the refractive ...">
92
-
93
- .. only:: html
94
-
95
- .. image:: /gallery/sellmeier/images/thumb/sphx_glr_plot_silica_thumb.png
96
- :alt:
97
-
98
- :ref:`sphx_glr_gallery_sellmeier_plot_silica.py`
99
-
100
- .. raw:: html
101
-
102
- <div class="sphx-glr-thumbnail-title">Plot the Refractive Index of Optical Material: Silica</div>
103
- </div>
104
-
105
-
106
- .. raw:: html
107
-
108
- <div class="sphx-glr-thumbcontainer" tooltip="This module demonstrates the usage of the PyOptik library to calculate and plot the refractive ...">
109
-
110
- .. only:: html
111
-
112
- .. image:: /gallery/sellmeier/images/thumb/sphx_glr_plot_water_thumb.png
113
- :alt:
114
-
115
- :ref:`sphx_glr_gallery_sellmeier_plot_water.py`
116
-
117
- .. raw:: html
118
-
119
- <div class="sphx-glr-thumbnail-title">Plot the Refractive Index of Optical Material: Water</div>
120
- </div>
121
-
122
-
123
- .. raw:: html
124
-
125
- </div>
126
-
127
- Examples: Tabulated Material
128
- ============================
129
-
130
- This folder contains examples demonstrating how to use the `TabulatedMaterial` class from the PyOptik library.
131
- These examples illustrate the practical applications of working with tabulated refractive index and absorption data, which is useful for analyzing materials based on empirical measurements.
132
-
133
- Contents
134
- --------
135
-
136
- - **Basic Tabulated Material Usage**: Shows how to create an instance of the `TabulatedMaterial` class and access the refractive index and absorption values.
137
- - **Interpolating Refractive Index**: Demonstrates how to interpolate the refractive index and absorption values for a given range of wavelengths.
138
- - **Visualization Example**: Provides an example of plotting the refractive index and absorption over a range of wavelengths using the `plot` method.
139
-
140
-
141
-
142
-
143
- .. raw:: html
144
-
145
- <div class="sphx-glr-thumbnails">
146
-
147
-
148
- .. raw:: html
149
-
150
- <div class="sphx-glr-thumbcontainer" tooltip="This module demonstrates the usage of the PyOptik library to calculate and plot the refractive ...">
151
-
152
- .. only:: html
153
-
154
- .. image:: /gallery/tabulated/images/thumb/sphx_glr_plot_polyethylene_thumb.png
155
- :alt:
156
-
157
- :ref:`sphx_glr_gallery_tabulated_plot_polyethylene.py`
158
-
159
- .. raw:: html
160
-
161
- <div class="sphx-glr-thumbnail-title">Plot the Refractive Index of Optical Material: Polyethylene</div>
162
- </div>
163
-
164
-
165
- .. raw:: html
166
-
167
- <div class="sphx-glr-thumbcontainer" tooltip="This module demonstrates the usage of the PyOptik library to calculate and plot the refractive ...">
168
-
169
- .. only:: html
170
-
171
- .. image:: /gallery/tabulated/images/thumb/sphx_glr_plot_silver_thumb.png
172
- :alt:
173
-
174
- :ref:`sphx_glr_gallery_tabulated_plot_silver.py`
175
-
176
- .. raw:: html
177
-
178
- <div class="sphx-glr-thumbnail-title">Plot the Refractive Index of Optical Material: Silver</div>
179
- </div>
180
-
181
-
182
- .. raw:: html
183
-
184
- </div>
185
-
186
- Examples: Utility Functions
187
- ===========================
188
-
189
- This folder contains examples demonstrating the various utility functions provided by the `PyOptik.utils` module.
190
- These utilities are designed to facilitate common tasks such as managing directories, downloading necessary data, and creating custom material definitions.
191
- The examples provided here aim to help you leverage these utilities effectively in your workflows.
192
-
193
-
194
-
195
- .. raw:: html
196
-
197
- <div class="sphx-glr-thumbnails">
198
-
199
-
200
- .. raw:: html
201
-
202
- <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to build a material library using the build_library function from...">
203
-
204
- .. only:: html
205
-
206
- .. image:: /gallery/utils/images/thumb/sphx_glr_build_library_thumb.png
207
- :alt:
208
-
209
- :ref:`sphx_glr_gallery_utils_build_library.py`
210
-
211
- .. raw:: html
212
-
213
- <div class="sphx-glr-thumbnail-title">Building database and Printing Materials</div>
214
- </div>
215
-
216
-
217
- .. raw:: html
218
-
219
- <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to create a custom Sellmeier YAML file using the create_sellmeier...">
220
-
221
- .. only:: html
222
-
223
- .. image:: /gallery/utils/images/thumb/sphx_glr_create_sellmeier_file_thumb.png
224
- :alt:
225
-
226
- :ref:`sphx_glr_gallery_utils_create_sellmeier_file.py`
227
-
228
- .. raw:: html
229
-
230
- <div class="sphx-glr-thumbnail-title">Example: Create a Custom Sellmeier YAML File</div>
231
- </div>
232
-
233
-
234
- .. raw:: html
235
-
236
- <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to create a custom YAML file containing tabulated nk data using t...">
237
-
238
- .. only:: html
239
-
240
- .. image:: /gallery/utils/images/thumb/sphx_glr_create_tabulated_file_thumb.png
241
- :alt:
242
-
243
- :ref:`sphx_glr_gallery_utils_create_tabulated_file.py`
244
-
245
- .. raw:: html
246
-
247
- <div class="sphx-glr-thumbnail-title">Example: Create a Custom Tabulated Data YAML File</div>
248
- </div>
249
-
250
-
251
- .. raw:: html
252
-
253
- <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to download a YAML file from a URL using the download_yml_file fu...">
254
-
255
- .. only:: html
256
-
257
- .. image:: /gallery/utils/images/thumb/sphx_glr_download_yml_file_thumb.png
258
- :alt:
259
-
260
- :ref:`sphx_glr_gallery_utils_download_yml_file.py`
261
-
262
- .. raw:: html
263
-
264
- <div class="sphx-glr-thumbnail-title">Example: Download a YAML file</div>
265
- </div>
266
-
267
-
268
- .. raw:: html
269
-
270
- </div>
271
-
272
-
273
- .. toctree::
274
- :hidden:
275
- :includehidden:
276
-
277
-
278
- /gallery/sellmeier/index.rst
279
- /gallery/tabulated/index.rst
280
- /gallery/utils/index.rst
281
- /gallery/group_properties/index.rst
282
-
283
-
284
-
285
- .. only:: html
286
-
287
- .. rst-class:: sphx-glr-signature
288
-
289
- `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes