PyOptik 1.10.6__tar.gz → 1.10.7__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 (126) hide show
  1. {pyoptik-1.10.6 → pyoptik-1.10.7}/.github/workflows/deploy_documentation.yml +0 -4
  2. {pyoptik-1.10.6 → pyoptik-1.10.7}/PKG-INFO +1 -3
  3. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/_version.py +2 -2
  4. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/directories.py +1 -0
  5. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/material/sellmeier_class.py +18 -19
  6. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/material/tabulated_class.py +21 -17
  7. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/material_bank.py +0 -2
  8. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik.egg-info/PKG-INFO +1 -3
  9. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik.egg-info/SOURCES.txt +1 -2
  10. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik.egg-info/requires.txt +0 -2
  11. {pyoptik-1.10.6 → pyoptik-1.10.7}/meta.yaml +0 -2
  12. {pyoptik-1.10.6 → pyoptik-1.10.7}/pyproject.toml +3 -3
  13. pyoptik-1.10.7/tests/test_utils.py +166 -0
  14. pyoptik-1.10.6/.readthedocs.yml +0 -35
  15. pyoptik-1.10.6/tests/test_utils.py +0 -166
  16. {pyoptik-1.10.6 → pyoptik-1.10.7}/.flake8 +0 -0
  17. {pyoptik-1.10.6 → pyoptik-1.10.7}/.github/dependabot.yml +0 -0
  18. {pyoptik-1.10.6 → pyoptik-1.10.7}/.github/workflows/deploy_PyPi.yml +0 -0
  19. {pyoptik-1.10.6 → pyoptik-1.10.7}/.github/workflows/deploy_anaconda.yml +0 -0
  20. {pyoptik-1.10.6 → pyoptik-1.10.7}/.github/workflows/deploy_coverage.yml +0 -0
  21. {pyoptik-1.10.6 → pyoptik-1.10.7}/.gitignore +0 -0
  22. {pyoptik-1.10.6 → pyoptik-1.10.7}/LICENSE +0 -0
  23. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/__init__.py +0 -0
  24. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/__main__.py +0 -0
  25. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/__init__.py +0 -0
  26. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/BAF10.yml +0 -0
  27. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/BAK1.yml +0 -0
  28. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/FK51A.yml +0 -0
  29. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/LASF9.yml +0 -0
  30. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/SF10.yml +0 -0
  31. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/SF11.yml +0 -0
  32. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/SF5.yml +0 -0
  33. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/ZBLAN.yml +0 -0
  34. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/acetone.yml +0 -0
  35. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/acetylene.yml +0 -0
  36. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/air.yml +0 -0
  37. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/argon.yml +0 -0
  38. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/cellulose.yml +0 -0
  39. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/crown.yml +0 -0
  40. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/ethane.yml +0 -0
  41. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/ethanol.yml +0 -0
  42. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/ethylene.yml +0 -0
  43. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/flint.yml +0 -0
  44. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/fused_silica.yml +0 -0
  45. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/germanium.yml +0 -0
  46. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/glycerol.yml +0 -0
  47. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/lithium_niobate.yml +0 -0
  48. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/methane.yml +0 -0
  49. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/methanol.yml +0 -0
  50. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/polycarbonate.yml +0 -0
  51. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/polystyren.yml +0 -0
  52. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/polystyrene.yml +0 -0
  53. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/propanol.yml +0 -0
  54. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/pvc.yml +0 -0
  55. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/soda_lime_glass.yml +0 -0
  56. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/sellmeier/water.yml +0 -0
  57. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/BK7.yml +0 -0
  58. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/aluminium.yml +0 -0
  59. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/bismuth.yml +0 -0
  60. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/calcium.yml +0 -0
  61. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/chromium.yml +0 -0
  62. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/copper.yml +0 -0
  63. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/gold.yml +0 -0
  64. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/iron.yml +0 -0
  65. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/lead.yml +0 -0
  66. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/magnesium.yml +0 -0
  67. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/nickel.yml +0 -0
  68. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/paladium.yml +0 -0
  69. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/polyetylene.yml +0 -0
  70. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/pva.yml +0 -0
  71. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/rhodium.yml +0 -0
  72. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/silicon.yml +0 -0
  73. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/silver.yml +0 -0
  74. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/sodium.yml +0 -0
  75. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/tantalum.yml +0 -0
  76. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/titanium.yml +0 -0
  77. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/tungsten.yml +0 -0
  78. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/vanadium.yml +0 -0
  79. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/data/tabulated/zinc.yml +0 -0
  80. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/libraries/__init__.py +0 -0
  81. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/libraries/classics.yml +0 -0
  82. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/libraries/dielectrics.yml +0 -0
  83. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/libraries/metals.yml +0 -0
  84. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/libraries/minimal.yml +0 -0
  85. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/libraries/organics.yml +0 -0
  86. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/libraries/others.yml +0 -0
  87. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/libraries/polymers.yml +0 -0
  88. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/libraries/repertoire.yml +0 -0
  89. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/material/__init__.py +0 -0
  90. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/material/base_class.py +0 -0
  91. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/material_type.py +0 -0
  92. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/units.py +0 -0
  93. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik/utils.py +0 -0
  94. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik.egg-info/dependency_links.txt +0 -0
  95. {pyoptik-1.10.6 → pyoptik-1.10.7}/PyOptik.egg-info/top_level.txt +0 -0
  96. {pyoptik-1.10.6 → pyoptik-1.10.7}/README.rst +0 -0
  97. {pyoptik-1.10.6 → pyoptik-1.10.7}/development/dev_0.py +0 -0
  98. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/Makefile +0 -0
  99. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/examples/README.rst +0 -0
  100. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/examples/sellmeier/README.rst +0 -0
  101. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/examples/sellmeier/plot_bk7.py +0 -0
  102. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/examples/sellmeier/plot_silica.py +0 -0
  103. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/examples/sellmeier/plot_water.py +0 -0
  104. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/examples/tabulated/README.rst +0 -0
  105. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/examples/tabulated/plot_sf5.py +0 -0
  106. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/examples/tabulated/plot_silver.py +0 -0
  107. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/examples/utils/README.rst +0 -0
  108. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/examples/utils/__build_library.py +0 -0
  109. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/examples/utils/__download_yml_file.py +0 -0
  110. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/examples/utils/create_sellmeier_file.py +0 -0
  111. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/examples/utils/create_tabulated_file.py +0 -0
  112. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/images/example_bk7.png +0 -0
  113. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/images/logo.png +0 -0
  114. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/make.bat +0 -0
  115. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/source/_static/default.css +0 -0
  116. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/source/_static/thumbnail.png +0 -0
  117. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/source/code.rst +0 -0
  118. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/source/conf.py +0 -0
  119. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/source/gallery/index.rst +0 -0
  120. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/source/index.rst +0 -0
  121. {pyoptik-1.10.6 → pyoptik-1.10.7}/docs/source/references.rst +0 -0
  122. {pyoptik-1.10.6 → pyoptik-1.10.7}/setup.cfg +0 -0
  123. {pyoptik-1.10.6 → pyoptik-1.10.7}/tests/__init__.py +0 -0
  124. {pyoptik-1.10.6 → pyoptik-1.10.7}/tests/test_sellmeier.py +0 -0
  125. {pyoptik-1.10.6 → pyoptik-1.10.7}/tests/test_tabulated.py +0 -0
  126. /pyoptik-1.10.6/tests/test_usual_material.py → /pyoptik-1.10.7/tests/test_usual_materials.py +0 -0
@@ -8,10 +8,6 @@ on:
8
8
  pull_request:
9
9
  branches: [ "master" ]
10
10
 
11
- concurrency:
12
- group: ${{ github.workflow }}-${{ github.ref }}
13
- cancel-in-progress: true
14
-
15
11
  # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16
12
  permissions:
17
13
  contents: write
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyOptik
3
- Version: 1.10.6
3
+ Version: 1.10.7
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
@@ -36,9 +36,7 @@ Classifier: Intended Audience :: Science/Research
36
36
  Requires-Python: >=3.10
37
37
  Description-Content-Type: text/x-rst
38
38
  License-File: LICENSE
39
- Requires-Dist: flexparser<0.4
40
39
  Requires-Dist: pint~=0.24
41
- Requires-Dist: pydantic~=2.9
42
40
  Requires-Dist: numpy
43
41
  Requires-Dist: matplotlib~=3.8
44
42
  Requires-Dist: requests~=2.31
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '1.10.6'
21
- __version_tuple__ = version_tuple = (1, 10, 6)
20
+ __version__ = version = '1.10.7'
21
+ __version_tuple__ = version_tuple = (1, 10, 7)
@@ -28,6 +28,7 @@ logo_path = doc_path.joinpath('images/logo.png')
28
28
  examples_path = root_path.joinpath('examples')
29
29
 
30
30
  sellmeier_data_path = root_path.joinpath('data/sellmeier')
31
+
31
32
  tabulated_data_path = root_path.joinpath('data/tabulated')
32
33
 
33
34
  data_path = root_path.joinpath('data')
@@ -6,19 +6,12 @@ import numpy
6
6
  import itertools
7
7
  from MPSPlots.styles import mps
8
8
  import matplotlib.pyplot as plt
9
- from pydantic.dataclasses import Field, ConfigDict, dataclass
10
- from typing import Tuple, Optional, Union
9
+ from typing import Optional, Union
11
10
  from PyOptik.units import micrometer, Quantity
12
11
  from PyOptik.directories import sellmeier_data_path
13
12
  from PyOptik.material.base_class import BaseMaterial
14
13
 
15
14
 
16
- config_dict = ConfigDict(
17
- arbitrary_types_allowed=True
18
- )
19
-
20
-
21
- @dataclass(config=config_dict, slots=True, eq=False)
22
15
  class SellmeierMaterial(BaseMaterial):
23
16
  """
24
17
  Class representing a material with Sellmeier coefficients for refractive index computation.
@@ -36,12 +29,24 @@ class SellmeierMaterial(BaseMaterial):
36
29
  formula_type : int
37
30
  The formula type to use for refractive index calculation.
38
31
  """
39
- filename: str
32
+ def __init__(self, filename: str):
33
+ """
34
+ Initializes the SellmeierMaterial with a filename.
35
+
36
+ Parameters
37
+ ----------
38
+
39
+ filename : str
40
+ The name of the YAML file containing material properties.
41
+ """
42
+ self.filename = filename
43
+
44
+ self.coefficients = None
45
+ self.wavelength_bound = None
46
+ self.reference = None
47
+ self.formula_type = None
40
48
 
41
- coefficients: Optional[numpy.ndarray] = Field(default=None)
42
- wavelength_bound: Optional[Tuple[float, float]] = Field(default=None)
43
- reference: Optional[str] = Field(default=None)
44
- formula_type: Optional[int] = Field(default=None)
49
+ self._load_coefficients()
45
50
 
46
51
  def __repr__(self) -> str:
47
52
  return self.__str__()
@@ -49,12 +54,6 @@ class SellmeierMaterial(BaseMaterial):
49
54
  def __str__(self) -> str:
50
55
  return self.filename
51
56
 
52
- def __post_init__(self) -> None:
53
- """
54
- Post-initialization method to load coefficients, wavelength range, formula type, and reference from a YAML file.
55
- """
56
- self._load_coefficients()
57
-
58
57
  def _load_coefficients(self) -> None:
59
58
  """
60
59
  Loads the Sellmeier coefficients, wavelength range, formula type, and reference from the specified YAML file.
@@ -2,7 +2,6 @@
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
4
  import numpy
5
- from pydantic.dataclasses import dataclass, Field, ConfigDict
6
5
  from typing import Optional, Union
7
6
  import yaml
8
7
  from PyOptik.directories import tabulated_data_path
@@ -12,12 +11,7 @@ import matplotlib.pyplot as plt
12
11
  from PyOptik.units import Quantity, micrometer, meter
13
12
 
14
13
 
15
- config_dict = ConfigDict(
16
- arbitrary_types_allowed=True
17
- )
18
14
 
19
-
20
- @dataclass(config=config_dict, slots=True, eq=False)
21
15
  class TabulatedMaterial(BaseMaterial):
22
16
  """
23
17
  Class representing a material with tabulated refractive index (n) and absorption (k) values.
@@ -35,11 +29,27 @@ class TabulatedMaterial(BaseMaterial):
35
29
  reference : Optional[str]
36
30
  Reference information for the material data.
37
31
  """
38
- filename: str
39
- wavelength: numpy.ndarray = Field(init=False)
40
- n_values: numpy.ndarray = Field(init=False)
41
- k_values: numpy.ndarray = Field(init=False)
42
- reference: Optional[str] = Field(init=False)
32
+
33
+ def __init__(self, filename: str):
34
+ """
35
+ Initializes the TabulatedMaterial with a filename.
36
+
37
+ Parameters
38
+ ----------
39
+ filename : str
40
+ The name of the YAML file containing material properties.
41
+ """
42
+ self.filename = filename
43
+
44
+ # Initialize attributes
45
+ self.wavelength_bound = None
46
+ self.wavelength = None
47
+ self.n_values = None
48
+ self.k_values = None
49
+ self.reference = None
50
+
51
+ # Load tabulated data from the YAML file
52
+ self._load_tabulated_data()
43
53
 
44
54
  def __repr__(self) -> str:
45
55
  return self.__str__()
@@ -47,12 +57,6 @@ class TabulatedMaterial(BaseMaterial):
47
57
  def __str__(self) -> str:
48
58
  return self.filename
49
59
 
50
- def __post_init__(self) -> None:
51
- """
52
- Post-initialization method to load the tabulated data from the YAML file.
53
- """
54
- self._load_tabulated_data()
55
-
56
60
  def _load_tabulated_data(self) -> None:
57
61
  """
58
62
  Loads the tabulated refractive index and absorption values from the specified YAML file.
@@ -13,11 +13,9 @@ from PyOptik.material.sellmeier_class import SellmeierMaterial
13
13
  from PyOptik.material.tabulated_class import TabulatedMaterial
14
14
  from PyOptik.utils import download_yml_file
15
15
  from tabulate import tabulate
16
- from dataclasses import dataclass
17
16
  from PyOptik.material_type import MaterialType
18
17
 
19
18
 
20
- @dataclass(frozen=True, slots=True)
21
19
  class _MaterialBank():
22
20
  """
23
21
  A class representing a centralized material bank for common optical materials available in the PyOptik library.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyOptik
3
- Version: 1.10.6
3
+ Version: 1.10.7
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
@@ -36,9 +36,7 @@ Classifier: Intended Audience :: Science/Research
36
36
  Requires-Python: >=3.10
37
37
  Description-Content-Type: text/x-rst
38
38
  License-File: LICENSE
39
- Requires-Dist: flexparser<0.4
40
39
  Requires-Dist: pint~=0.24
41
- Requires-Dist: pydantic~=2.9
42
40
  Requires-Dist: numpy
43
41
  Requires-Dist: matplotlib~=3.8
44
42
  Requires-Dist: requests~=2.31
@@ -1,6 +1,5 @@
1
1
  .flake8
2
2
  .gitignore
3
- .readthedocs.yml
4
3
  LICENSE
5
4
  README.rst
6
5
  meta.yaml
@@ -119,5 +118,5 @@ docs/source/gallery/index.rst
119
118
  tests/__init__.py
120
119
  tests/test_sellmeier.py
121
120
  tests/test_tabulated.py
122
- tests/test_usual_material.py
121
+ tests/test_usual_materials.py
123
122
  tests/test_utils.py
@@ -1,6 +1,4 @@
1
- flexparser<0.4
2
1
  pint~=0.24
3
- pydantic~=2.9
4
2
  numpy
5
3
  matplotlib~=3.8
6
4
  requests~=2.31
@@ -23,14 +23,12 @@ requirements:
23
23
  - setuptools-scm >=8.0
24
24
  - pip
25
25
  run:
26
- - flexparser <0.4 # This is due to a dataclass inheritance problem coming from the pint package
27
26
  - pint ~= 0.24
28
27
  - martinpdes::mpsplots
29
28
  - pyyaml ~=6.0
30
29
  - requests ~=2.31
31
30
  - matplotlib ~=3.8
32
31
  - numpy
33
- - pydantic ~=2.9
34
32
  - tabulate ~=0.9
35
33
 
36
34
  about:
@@ -23,9 +23,7 @@ classifiers = [
23
23
  keywords = ["refracive index", "optics"]
24
24
 
25
25
  dependencies = [
26
- "flexparser <0.4", # This is due to a dataclass inheritance problem coming from the pint package
27
26
  "pint ~=0.24",
28
- "pydantic ~=2.9",
29
27
  "numpy",
30
28
  "matplotlib ~=3.8",
31
29
  "requests ~=2.31",
@@ -72,7 +70,9 @@ minversion = "6.0"
72
70
  xfail_strict = true
73
71
  log_cli_level = "INFO"
74
72
  testpaths = [
75
- "tests/*",
73
+ "tests/test_sellmeier.py",
74
+ "tests/test_tabulated.py",
75
+ "tests/test_usual_materials.py",
76
76
  ]
77
77
  addopts = [
78
78
  '-v',
@@ -0,0 +1,166 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+
4
+ import pytest
5
+ from PyOptik import MaterialBank, MaterialType
6
+ from PyOptik.utils import download_yml_file
7
+
8
+ MaterialBank.set_filter(use_sellmeier=True, use_tabulated=True)
9
+
10
+
11
+ def test_main():
12
+ MaterialBank.build_library('minimal', remove_previous=True)
13
+
14
+ url_water = 'https://refractiveindex.info/database/data/main/H2O/nk/Daimon-19.0C.yml'
15
+
16
+ def test_download_yml_files():
17
+ """
18
+ Test downloading YAML files to different locations. Ensures that files are
19
+ correctly downloaded from a given URL to the specified directory.
20
+ """
21
+ download_yml_file(
22
+ filename='test_tabulated',
23
+ url=url_water,
24
+ location=MaterialType.TABULATED
25
+ )
26
+
27
+ download_yml_file(
28
+ filename='test_sellmeier',
29
+ url=url_water,
30
+ location=MaterialType.SELLMEIER
31
+ )
32
+
33
+
34
+ def test_add_custom():
35
+ MaterialBank.add_tabulated_to_bank(
36
+ filename='test_tabulated',
37
+ url=url_water,
38
+ )
39
+
40
+ MaterialBank.add_sellmeier_to_bank(
41
+ filename='test_sellmeier',
42
+ url=url_water,
43
+ )
44
+
45
+
46
+ def test_fail_add_custom():
47
+ with pytest.raises(ValueError):
48
+ MaterialBank.add_material_to_bank(
49
+ filename='test_tabulated',
50
+ url=url_water,
51
+ material_type='invalid_location'
52
+ )
53
+
54
+
55
+ def test_build_library():
56
+ """
57
+ Test the creation of the default library. Ensures that the default library
58
+ is built without errors.
59
+ """
60
+ pass
61
+ # MaterialBank.build_library('minimal', remove_previous=True)
62
+
63
+
64
+ def test_remove_item():
65
+ """
66
+ Test the removal of an element from a library. Ensures that an element can
67
+ be removed without errors.
68
+ """
69
+ with pytest.raises(ValueError):
70
+ MaterialBank.remove_item(filename='test', location='invalid_location')
71
+
72
+ download_yml_file(
73
+ filename='test_sellmeier',
74
+ url=url_water,
75
+ location=MaterialType.SELLMEIER
76
+ )
77
+
78
+ MaterialBank.remove_item(filename='test_sellmeier', location=MaterialType.SELLMEIER)
79
+
80
+ download_yml_file(
81
+ filename='test_tabulated',
82
+ url=url_water,
83
+ location=MaterialType.TABULATED
84
+ )
85
+
86
+ MaterialBank.remove_item(filename='test_tabulated', location=MaterialType.TABULATED)
87
+
88
+ download_yml_file(
89
+ filename='test_sellmeier',
90
+ url=url_water,
91
+ location=MaterialType.SELLMEIER
92
+ )
93
+
94
+ MaterialBank.clean_data_files(regex='test*', location=MaterialType.SELLMEIER)
95
+
96
+ download_yml_file(
97
+ filename='test_tabulated',
98
+ url=url_water,
99
+ location=MaterialType.TABULATED
100
+ )
101
+
102
+ MaterialBank.clean_data_files(regex='test*', location=MaterialType.TABULATED)
103
+
104
+
105
+ def test_create_custom_sellmeier_file():
106
+ """
107
+ Test the creation of a custom Sellmeier YAML file. Ensures that the file
108
+ is created with the correct coefficients and formula type.
109
+ """
110
+ with pytest.raises(ValueError):
111
+ MaterialBank.create_sellmeier_file(
112
+ filename='test_sellmeier_file',
113
+ coefficients=[0, 1, 2, 3, 4],
114
+ formula_type=9,
115
+ wavelength_range=[1, 1.2],
116
+ comments='Dummy comment',
117
+ specs='Random specs'
118
+ )
119
+
120
+ MaterialBank.test_sellmeier_file.compute_refractive_index(1.1e-6)
121
+
122
+
123
+ def test_fail_with_wrong_formula_type():
124
+ """
125
+ Test the creation of a custom Sellmeier YAML file. Ensures that the file
126
+ is created with the correct coefficients and formula type.
127
+ """
128
+ MaterialBank.create_sellmeier_file(
129
+ filename='test_sellmeier_file',
130
+ coefficients=[0, 10.6684293, 0.301516485, 0.0030434748, 1.13475115, 1.54133408, 1104],
131
+ formula_type=2,
132
+ wavelength_range=[1, 1.2],
133
+ comments='Dummy comment',
134
+ specs='Random specs'
135
+ )
136
+
137
+ MaterialBank.test_sellmeier_file.compute_refractive_index(1.1e-6)
138
+
139
+
140
+ def test_create_custom_tabulated_file():
141
+ """
142
+ Test the creation of a custom tabulated YAML file. Ensures that the file
143
+ is created with the correct tabulated data, reference, and comments.
144
+ """
145
+ MaterialBank.create_tabulated_file(
146
+ filename="test_tabulated_file",
147
+ data=[
148
+ (0.1879, 0.94, 1.337),
149
+ (0.1916, 0.95, 1.388),
150
+ (0.1953, 0.97, 1.440)
151
+ ],
152
+ reference="Example of tabulated test file",
153
+ comments="Room temperature"
154
+ )
155
+
156
+
157
+ def test_download_yml_file_http_error_log(caplog):
158
+ with pytest.raises(ValueError):
159
+ download_yml_file(
160
+ filename='example_download',
161
+ url='__invalid_url__.com',
162
+ location=MaterialType.SELLMEIER
163
+ )
164
+
165
+ if __name__ == "__main__":
166
+ pytest.main(["-W error", "-s", __file__])
@@ -1,35 +0,0 @@
1
- # .readthedocs.yml
2
- # Read the Docs configuration file
3
- # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4
-
5
- # Required
6
- version: 2
7
-
8
- submodules:
9
- include: all
10
- recursive: true
11
-
12
- build:
13
- os: ubuntu-22.04
14
-
15
-
16
- tools:
17
- python: "3.10"
18
- jobs:
19
- pre_install:
20
- - Xvfb :99 &
21
- - export DISPLAY=:99
22
- - cd docs && rm -rf source/gallery
23
- - sleep 3
24
-
25
- python:
26
- install:
27
- - method: pip
28
- path: .
29
- extra_requirements:
30
- - documentation
31
-
32
- sphinx:
33
- builder: html
34
- configuration: docs/source/conf.py
35
- fail_on_warning: false
@@ -1,166 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
-
4
- import pytest
5
- # from PyOptik import MaterialBank, MaterialType
6
- # from PyOptik.utils import download_yml_file
7
-
8
- # MaterialBank.set_filter(use_sellmeier=True, use_tabulated=True)
9
-
10
-
11
- # def test_main():
12
- # MaterialBank.build_library('minimal', remove_previous=True)
13
-
14
- # url_water = 'https://refractiveindex.info/database/data/main/H2O/nk/Daimon-19.0C.yml'
15
-
16
- # def test_download_yml_files():
17
- # """
18
- # Test downloading YAML files to different locations. Ensures that files are
19
- # correctly downloaded from a given URL to the specified directory.
20
- # """
21
- # download_yml_file(
22
- # filename='test_tabulated',
23
- # url=url_water,
24
- # location=MaterialType.TABULATED
25
- # )
26
-
27
- # download_yml_file(
28
- # filename='test_sellmeier',
29
- # url=url_water,
30
- # location=MaterialType.SELLMEIER
31
- # )
32
-
33
-
34
- # def test_add_custom():
35
- # MaterialBank.add_tabulated_to_bank(
36
- # filename='test_tabulated',
37
- # url=url_water,
38
- # )
39
-
40
- # MaterialBank.add_sellmeier_to_bank(
41
- # filename='test_sellmeier',
42
- # url=url_water,
43
- # )
44
-
45
-
46
- # def test_fail_add_custom():
47
- # with pytest.raises(ValueError):
48
- # MaterialBank.add_material_to_bank(
49
- # filename='test_tabulated',
50
- # url=url_water,
51
- # material_type='invalid_location'
52
- # )
53
-
54
-
55
- # def test_build_library():
56
- # """
57
- # Test the creation of the default library. Ensures that the default library
58
- # is built without errors.
59
- # """
60
- # pass
61
- # # MaterialBank.build_library('minimal', remove_previous=True)
62
-
63
-
64
- # def test_remove_item():
65
- # """
66
- # Test the removal of an element from a library. Ensures that an element can
67
- # be removed without errors.
68
- # """
69
- # with pytest.raises(ValueError):
70
- # MaterialBank.remove_item(filename='test', location='invalid_location')
71
-
72
- # download_yml_file(
73
- # filename='test_sellmeier',
74
- # url=url_water,
75
- # location=MaterialType.SELLMEIER
76
- # )
77
-
78
- # MaterialBank.remove_item(filename='test_sellmeier', location=MaterialType.SELLMEIER)
79
-
80
- # download_yml_file(
81
- # filename='test_tabulated',
82
- # url=url_water,
83
- # location=MaterialType.TABULATED
84
- # )
85
-
86
- # MaterialBank.remove_item(filename='test_tabulated', location=MaterialType.TABULATED)
87
-
88
- # download_yml_file(
89
- # filename='test_sellmeier',
90
- # url=url_water,
91
- # location=MaterialType.SELLMEIER
92
- # )
93
-
94
- # MaterialBank.clean_data_files(regex='test*', location=MaterialType.SELLMEIER)
95
-
96
- # download_yml_file(
97
- # filename='test_tabulated',
98
- # url=url_water,
99
- # location=MaterialType.TABULATED
100
- # )
101
-
102
- # MaterialBank.clean_data_files(regex='test*', location=MaterialType.TABULATED)
103
-
104
-
105
- # def test_create_custom_sellmeier_file():
106
- # """
107
- # Test the creation of a custom Sellmeier YAML file. Ensures that the file
108
- # is created with the correct coefficients and formula type.
109
- # """
110
- # with pytest.raises(ValueError):
111
- # MaterialBank.create_sellmeier_file(
112
- # filename='test_sellmeier_file',
113
- # coefficients=[0, 1, 2, 3, 4],
114
- # formula_type=9,
115
- # wavelength_range=[1, 1.2],
116
- # comments='Dummy comment',
117
- # specs='Random specs'
118
- # )
119
-
120
- # MaterialBank.test_sellmeier_file.compute_refractive_index(1.1e-6)
121
-
122
-
123
- # def test_fail_with_wrong_formula_type():
124
- # """
125
- # Test the creation of a custom Sellmeier YAML file. Ensures that the file
126
- # is created with the correct coefficients and formula type.
127
- # """
128
- # MaterialBank.create_sellmeier_file(
129
- # filename='test_sellmeier_file',
130
- # coefficients=[0, 10.6684293, 0.301516485, 0.0030434748, 1.13475115, 1.54133408, 1104],
131
- # formula_type=2,
132
- # wavelength_range=[1, 1.2],
133
- # comments='Dummy comment',
134
- # specs='Random specs'
135
- # )
136
-
137
- # MaterialBank.test_sellmeier_file.compute_refractive_index(1.1e-6)
138
-
139
-
140
- # def test_create_custom_tabulated_file():
141
- # """
142
- # Test the creation of a custom tabulated YAML file. Ensures that the file
143
- # is created with the correct tabulated data, reference, and comments.
144
- # """
145
- # MaterialBank.create_tabulated_file(
146
- # filename="test_tabulated_file",
147
- # data=[
148
- # (0.1879, 0.94, 1.337),
149
- # (0.1916, 0.95, 1.388),
150
- # (0.1953, 0.97, 1.440)
151
- # ],
152
- # reference="Example of tabulated test file",
153
- # comments="Room temperature"
154
- # )
155
-
156
-
157
- # def _test_download_yml_file_http_error_log(caplog):
158
- # with pytest.raises(ValueError):
159
- # download_yml_file(
160
- # filename='example_download',
161
- # url='__invalid_url__.com',
162
- # location=MaterialType.SELLMEIER
163
- # )
164
-
165
- if __name__ == "__main__":
166
- pytest.main(["-W error", "-s", __file__])
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