PyOptik 0.7.15.post0__tar.gz → 0.7.16.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 (62) hide show
  1. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/PKG-INFO +1 -2
  2. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/PyOptik/_version.py +2 -2
  3. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/PyOptik/directories.py +1 -11
  4. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/PyOptik/experiment_material.py +25 -27
  5. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/PyOptik/sellmeier_material.py +31 -30
  6. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/PyOptik.egg-info/PKG-INFO +1 -2
  7. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/PyOptik.egg-info/requires.txt +0 -1
  8. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/conf.py +0 -1
  9. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/pyproject.toml +0 -1
  10. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/tests/test_measurements.py +0 -2
  11. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/tests/test_sellmeier.py +0 -2
  12. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/.github/dependabot.yml +0 -0
  13. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/.github/workflows/deploy_workflow.yml +0 -0
  14. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/.gitignore +0 -0
  15. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/.readthedocs.yml +0 -0
  16. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/LICENSE +0 -0
  17. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/PyOptik/__init__.py +0 -0
  18. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/PyOptik.egg-info/SOURCES.txt +0 -0
  19. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/PyOptik.egg-info/dependency_links.txt +0 -0
  20. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/PyOptik.egg-info/top_level.txt +0 -0
  21. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/README.rst +0 -0
  22. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/Makefile +0 -0
  23. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/examples/README.rst +0 -0
  24. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/examples/measurements_tio2.py +0 -0
  25. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/examples/measurements_water.py +0 -0
  26. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/examples/sellmeier_bk7.py +0 -0
  27. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/examples/sellmeier_sf5.py +0 -0
  28. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/examples/sellmeier_silica.py +0 -0
  29. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/images/logo.png +0 -0
  30. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/make.bat +0 -0
  31. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/_static/default.css +0 -0
  32. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/code.rst +0 -0
  33. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/add_material.ipynb +0 -0
  34. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/add_material.py +0 -0
  35. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/add_material.rst +0 -0
  36. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/add_material_codeobj.pickle +0 -0
  37. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/get_values.ipynb +0 -0
  38. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/get_values.py +0 -0
  39. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/get_values.rst +0 -0
  40. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/get_values_codeobj.pickle +0 -0
  41. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/images/sphx_glr_plot_sellmeier_0_001.png +0 -0
  42. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/images/sphx_glr_plot_sellmeier_1_001.png +0 -0
  43. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/images/thumb/sphx_glr_add_material_thumb.png +0 -0
  44. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/images/thumb/sphx_glr_get_values_thumb.png +0 -0
  45. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/images/thumb/sphx_glr_plot_sellmeier_0_thumb.png +0 -0
  46. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/images/thumb/sphx_glr_plot_sellmeier_1_thumb.png +0 -0
  47. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/index.rst +0 -0
  48. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/plot_sellmeier_0.ipynb +0 -0
  49. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/plot_sellmeier_0.py +0 -0
  50. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/plot_sellmeier_0.py.md5 +0 -0
  51. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/plot_sellmeier_0.rst +0 -0
  52. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/plot_sellmeier_0_codeobj.pickle +0 -0
  53. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/plot_sellmeier_1.ipynb +0 -0
  54. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/plot_sellmeier_1.py +0 -0
  55. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/plot_sellmeier_1.py.md5 +0 -0
  56. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/plot_sellmeier_1.rst +0 -0
  57. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/plot_sellmeier_1_codeobj.pickle +0 -0
  58. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/gallery/sg_execution_times.rst +0 -0
  59. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/index.rst +0 -0
  60. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/docs/source/references.rst +0 -0
  61. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/setup.cfg +0 -0
  62. {pyoptik-0.7.15.post0 → pyoptik-0.7.16.post0}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyOptik
3
- Version: 0.7.15.post0
3
+ Version: 0.7.16.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
@@ -42,7 +42,6 @@ Requires-Dist: pydantic>=2.6.3
42
42
  Requires-Dist: numpy
43
43
  Requires-Dist: scipy
44
44
  Requires-Dist: MPSTools
45
- Requires-Dist: MPSPlots>=1.4.5
46
45
  Requires-Dist: tabulate
47
46
  Provides-Extra: testing
48
47
  Requires-Dist: pytest>=0.6; extra == "testing"
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.7.15.post0'
16
- __version_tuple__ = version_tuple = (0, 7, 15)
15
+ __version__ = version = '0.7.16.post0'
16
+ __version_tuple__ = version_tuple = (0, 7, 16)
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
- import os
5
4
  from pathlib import Path
6
5
  import PyOptik
7
6
 
@@ -11,8 +10,7 @@ __all__ = [
11
10
  'project_path',
12
11
  'doc_path',
13
12
  'doc_css_path',
14
- 'logo_path',
15
- 'version_path',
13
+ 'logo_path'
16
14
  ]
17
15
 
18
16
  root_path = Path(PyOptik.__path__[0])
@@ -27,16 +25,8 @@ doc_css_path = doc_path.joinpath('source/_static/default.css')
27
25
 
28
26
  logo_path = doc_path.joinpath('images/logo.png')
29
27
 
30
- version_path = root_path.joinpath('VERSION')
31
-
32
28
  examples_path = root_path.joinpath('examples')
33
29
 
34
- ZeroPath = os.path.dirname(root_path)
35
-
36
- DataPath = os.path.join(root_path, 'Data')
37
-
38
- NPZPath = os.path.join(DataPath, 'npz')
39
-
40
30
 
41
31
  if __name__ == '__main__':
42
32
  for path_name in __all__:
@@ -2,27 +2,26 @@
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
4
  import os
5
- from typing import Union, Iterable
5
+ from typing import Union, Iterable, NoReturn
6
6
  from MPSTools.material_catalogue.loader import get_material_index
7
- from MPSPlots.render2D import SceneList
8
-
7
+ import matplotlib.pyplot as plt
9
8
  from MPSTools.tools.directories import measurements_file_path
10
9
  from pydantic.dataclasses import dataclass
11
10
 
12
11
 
13
- def valid_name(string):
12
+ def valid_name(string: str) -> bool:
13
+ """Check if the provided string is a valid material name."""
14
14
  return not string.startswith('_')
15
15
 
16
16
 
17
+ # List of available materials
17
18
  list_of_available_files = os.listdir(measurements_file_path)
18
-
19
19
  material_list = [element[:-5] for element in list_of_available_files]
20
-
21
20
  material_list = list(filter(valid_name, material_list))
22
21
 
23
22
 
24
23
  @dataclass
25
- class DataMeasurement():
24
+ class DataMeasurement:
26
25
  """
27
26
  A class for computing the refractive index using locally saved measurement data for specified materials.
28
27
 
@@ -30,19 +29,18 @@ class DataMeasurement():
30
29
  material_name (str): The name of the material.
31
30
 
32
31
  Methods:
33
- reference (str): Returns the bibliographic reference for the material's data.
32
+ reference: Returns the bibliographic reference for the material's data.
34
33
  get_refractive_index: Computes the refractive index for given wavelength(s).
35
34
  plot: Visualizes the refractive index as a function of wavelength.
36
35
  """
37
-
38
36
  material_name: str
39
37
 
40
38
  def __post_init__(self):
41
39
  """
42
40
  Initializes the DataMeasurement object with a specified material name.
43
41
 
44
- Parameters:
45
- material_name (str): The name of the material for which to compute the refractive index.
42
+ Raises:
43
+ ValueError: If the material_name is not in the list of available materials.
46
44
  """
47
45
  if self.material_name not in material_list:
48
46
  raise ValueError(f"{self.material_name} is not in the list of available materials.")
@@ -54,18 +52,21 @@ class DataMeasurement():
54
52
 
55
53
  Returns:
56
54
  str: The bibliographic reference for the material's measurement data.
55
+
56
+ Raises:
57
+ NotImplementedError: If the feature is not implemented yet.
57
58
  """
58
59
  raise NotImplementedError("Feature not implemented yet.")
59
60
 
60
- def get_refractive_index(self, wavelength_range: Union[float, Iterable]) -> Union[float, Iterable]:
61
+ def get_refractive_index(self, wavelength_range: Union[float, Iterable[float]]) -> Union[float, Iterable[float]]:
61
62
  """
62
63
  Computes the refractive index for the specified wavelength range using the material's measurement data.
63
64
 
64
65
  Parameters:
65
- wavelength_range (Union[float, Iterable]): The wavelength(s) in meters.
66
+ wavelength_range (Union[float, Iterable[float]]): The wavelength(s) in meters.
66
67
 
67
68
  Returns:
68
- Union[float, Iterable]: The refractive index or indices for the specified wavelength(s).
69
+ Union[float, Iterable[float]]: The refractive index or indices for the specified wavelength(s).
69
70
  """
70
71
  return get_material_index(
71
72
  material_name=self.material_name,
@@ -73,23 +74,22 @@ class DataMeasurement():
73
74
  subdir='measurements'
74
75
  )
75
76
 
76
- def plot(self, wavelength_range: Iterable) -> SceneList:
77
+ def plot(self, wavelength_range: Iterable[float]) -> NoReturn:
77
78
  """
78
79
  Generates a plot of the refractive index as a function of wavelength for the specified material.
79
80
 
80
81
  Parameters:
81
- wavelength_range (Iterable): The range of wavelengths to plot.
82
-
83
- Returns:
84
- SceneList: An object containing the plot of refractive index against wavelength.
82
+ wavelength_range (Iterable[float]): The range of wavelengths to plot.
85
83
  """
86
- scene = SceneList()
87
- ax = scene.append_ax(x_label='Wavelength [m]', y_label='Refractive index')
84
+ figure, ax = plt.subplots(1, 1)
85
+ ax.set_xlabel('Wavelength [m]')
86
+ ax.set_ylabel('Refractive index')
88
87
 
89
88
  refractive_index = self.get_refractive_index(wavelength_range)
90
- ax.add_line(x=wavelength_range, y=refractive_index, line_width=2)
89
+ ax.plot(wavelength_range, refractive_index.real, linewidth=2, label='real part')
90
+ ax.plot(wavelength_range, refractive_index.imag, linewidth=2, label='imag part')
91
91
 
92
- return scene
92
+ plt.show()
93
93
 
94
94
  def __repr__(self) -> str:
95
95
  """
@@ -98,7 +98,7 @@ class DataMeasurement():
98
98
  Returns:
99
99
  str: Formal representation of the object, showing the material name.
100
100
  """
101
- return str(self.material_name)
101
+ return f"DataMeasurement(material_name='{self.material_name}')"
102
102
 
103
103
  def __str__(self) -> str:
104
104
  """
@@ -107,6 +107,4 @@ class DataMeasurement():
107
107
  Returns:
108
108
  str: Informal representation of the object.
109
109
  """
110
- return self.__repr__()
111
-
112
- # -
110
+ return self.material_name
@@ -2,33 +2,32 @@
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
4
  import os
5
- import numpy as np
6
- from typing import Union, Iterable
5
+ import numpy
6
+ from typing import Union, Iterable, NoReturn
7
7
  from MPSTools.material_catalogue.loader import get_material_index
8
- from MPSPlots.render2D import SceneList
8
+ import matplotlib.pyplot as plt
9
9
  from MPSTools.tools.directories import sellmeier_file_path
10
10
  from pydantic.dataclasses import dataclass
11
11
 
12
12
 
13
- def valid_name(string):
13
+ def valid_name(string: str) -> bool:
14
+ """Check if the provided string is a valid material name."""
14
15
  return not string.startswith('_')
15
16
 
16
17
 
18
+ # List of available materials
17
19
  list_of_available_files = os.listdir(sellmeier_file_path)
18
-
19
20
  material_list = [element[:-5] for element in list_of_available_files]
20
-
21
21
  material_list = list(filter(valid_name, material_list))
22
22
 
23
23
 
24
24
  @dataclass
25
- class Sellmeier():
25
+ class Sellmeier:
26
26
  """
27
27
  A class for computing the refractive index using the Sellmeier equation based on locally stored Sellmeier coefficients.
28
28
 
29
29
  Attributes:
30
30
  material_name (str): Name of the material.
31
- sellmeier_coefficients (dict): Sellmeier coefficients for the material loaded from a local source.
32
31
 
33
32
  Methods:
34
33
  reference: Returns the reference for the Sellmeier coefficients.
@@ -39,13 +38,18 @@ class Sellmeier():
39
38
 
40
39
  def __post_init__(self):
41
40
  """
42
- Initializes the DataMeasurement object with a specified material name.
41
+ Initializes the Sellmeier object with a specified material name.
43
42
 
44
- Parameters:
45
- material_name (str): The name of the material for which to compute the refractive index.
43
+ Raises:
44
+ ValueError: If the material_name is not in the list of available materials.
46
45
  """
47
46
  if self.material_name not in material_list:
48
47
  raise ValueError(f"{self.material_name} is not in the list of available materials.")
48
+ self.sellmeier_coefficients = get_material_index(
49
+ material_name=self.material_name,
50
+ wavelength=numpy.array([1.0]), # Dummy wavelength to load coefficients
51
+ subdir='sellmeier'
52
+ )
49
53
 
50
54
  @property
51
55
  def reference(self) -> str:
@@ -57,7 +61,7 @@ class Sellmeier():
57
61
  """
58
62
  return self.sellmeier_coefficients['sellmeier']['reference']
59
63
 
60
- def get_refractive_index(self, wavelength_range: Union[float, Iterable]) -> Union[float, np.ndarray]:
64
+ def get_refractive_index(self, wavelength_range: Union[float, Iterable]) -> Union[float, numpy.ndarray]:
61
65
  """
62
66
  Computes the refractive index for the specified wavelength(s) using the Sellmeier equation.
63
67
 
@@ -65,10 +69,10 @@ class Sellmeier():
65
69
  wavelength_range (Union[float, Iterable]): The wavelength(s) in meters for which to compute the refractive index.
66
70
 
67
71
  Returns:
68
- Union[float, np.ndarray]: The computed refractive index, either as a scalar or a NumPy array.
72
+ Union[float, numpy.ndarray]: The computed refractive index, either as a scalar or a NumPy array.
69
73
  """
70
- return_scalar = np.isscalar(wavelength_range)
71
- wavelength_array = np.atleast_1d(wavelength_range).astype(float)
74
+ return_scalar = numpy.isscalar(wavelength_range)
75
+ wavelength_array = numpy.atleast_1d(wavelength_range).astype(float)
72
76
 
73
77
  refractive_index = get_material_index(
74
78
  material_name=self.material_name,
@@ -78,41 +82,38 @@ class Sellmeier():
78
82
 
79
83
  return refractive_index.item() if return_scalar else refractive_index
80
84
 
81
- def plot(self, wavelength_range: Iterable) -> SceneList:
85
+ def plot(self, wavelength_range: Iterable) -> NoReturn:
82
86
  """
83
87
  Plots the refractive index as a function of wavelength over a specified range.
84
88
 
85
89
  Parameters:
86
90
  wavelength_range (Iterable): The range of wavelengths to plot, in meters.
87
-
88
- Returns:
89
- SceneList: A SceneList object containing the plot.
90
91
  """
91
- scene = SceneList()
92
- ax = scene.append_ax(x_label='Wavelength [m]', y_label='Refractive index')
92
+ figure, ax = plt.subplots(1, 1)
93
+ ax.set_xlabel('Wavelength [m]')
94
+ ax.set_ylabel('Refractive index')
93
95
 
94
96
  refractive_index = self.get_refractive_index(wavelength_range)
95
-
96
- ax.add_line(x=wavelength_range, y=refractive_index, line_width=2)
97
-
98
- return scene
97
+ ax.plot(wavelength_range, refractive_index, linewidth=2)
98
+ plt.show()
99
99
 
100
100
  def __repr__(self) -> str:
101
101
  """
102
- Provides a formal string representation of the DataMeasurement object.
102
+ Provides a formal string representation of the Sellmeier object.
103
103
 
104
104
  Returns:
105
105
  str: Formal representation of the object, showing the material name.
106
106
  """
107
- return str(self.material_name)
107
+ return f"Sellmeier(material_name='{self.material_name}')"
108
108
 
109
109
  def __str__(self) -> str:
110
110
  """
111
- Provides an informal string representation of the DataMeasurement object.
111
+ Provides an informal string representation of the Sellmeier object.
112
112
 
113
113
  Returns:
114
114
  str: Informal representation of the object.
115
115
  """
116
- return self.__repr__()
116
+ return self.material_name
117
+
117
118
 
118
- # -
119
+ Material = Sellmeier
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyOptik
3
- Version: 0.7.15.post0
3
+ Version: 0.7.16.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
@@ -42,7 +42,6 @@ Requires-Dist: pydantic>=2.6.3
42
42
  Requires-Dist: numpy
43
43
  Requires-Dist: scipy
44
44
  Requires-Dist: MPSTools
45
- Requires-Dist: MPSPlots>=1.4.5
46
45
  Requires-Dist: tabulate
47
46
  Provides-Extra: testing
48
47
  Requires-Dist: pytest>=0.6; extra == "testing"
@@ -2,7 +2,6 @@ pydantic>=2.6.3
2
2
  numpy
3
3
  scipy
4
4
  MPSTools
5
- MPSPlots>=1.4.5
6
5
  tabulate
7
6
 
8
7
  [documentation]
@@ -3,7 +3,6 @@
3
3
 
4
4
  import sys
5
5
  from sphinx_gallery.sorting import FileNameSortKey
6
- from packaging.version import parse
7
6
  from MPSPlots.styles import use_mpsplots_style
8
7
 
9
8
  import PyOptik
@@ -29,7 +29,6 @@ dependencies = [
29
29
  "numpy",
30
30
  "scipy",
31
31
  "MPSTools",
32
- "MPSPlots>=1.4.5",
33
32
  "tabulate",
34
33
  ]
35
34
 
@@ -17,6 +17,4 @@ def test_material_plot(patch, material_name: str):
17
17
 
18
18
  figure = material.plot(wavelength_range=wavelength_range)
19
19
 
20
- figure.show()
21
-
22
20
  # -
@@ -17,7 +17,5 @@ def test_material_plot(patch, material_name: str):
17
17
 
18
18
  figure = material.plot(wavelength_range=wavelength_range)
19
19
 
20
- figure.show()
21
-
22
20
 
23
21
  # -
File without changes
File without changes