PyOptik 1.10.4__tar.gz → 1.10.6__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.
- {pyoptik-1.10.4 → pyoptik-1.10.6}/.github/workflows/deploy_documentation.yml +3 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PKG-INFO +1 -1
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/_version.py +2 -2
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik.egg-info/PKG-INFO +1 -1
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik.egg-info/SOURCES.txt +1 -1
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/examples/tabulated/plot_silver.py +0 -1
- {pyoptik-1.10.4 → pyoptik-1.10.6}/meta.yaml +1 -1
- pyoptik-1.10.6/tests/test_utils.py +166 -0
- pyoptik-1.10.4/tests/test_utils.py +0 -166
- {pyoptik-1.10.4 → pyoptik-1.10.6}/.flake8 +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/.github/dependabot.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/.github/workflows/deploy_PyPi.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/.github/workflows/deploy_anaconda.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/.github/workflows/deploy_coverage.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/.gitignore +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/.readthedocs.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/LICENSE +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/__init__.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/__main__.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/__init__.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/BAF10.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/BAK1.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/FK51A.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/LASF9.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/SF10.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/SF11.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/SF5.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/ZBLAN.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/acetone.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/acetylene.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/air.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/argon.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/cellulose.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/crown.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/ethane.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/ethanol.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/ethylene.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/flint.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/fused_silica.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/germanium.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/glycerol.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/lithium_niobate.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/methane.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/methanol.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/polycarbonate.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/polystyren.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/polystyrene.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/propanol.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/pvc.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/soda_lime_glass.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/sellmeier/water.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/BK7.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/aluminium.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/bismuth.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/calcium.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/chromium.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/copper.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/gold.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/iron.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/lead.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/magnesium.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/nickel.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/paladium.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/polyetylene.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/pva.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/rhodium.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/silicon.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/silver.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/sodium.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/tantalum.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/titanium.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/tungsten.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/vanadium.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/data/tabulated/zinc.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/directories.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/libraries/__init__.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/libraries/classics.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/libraries/dielectrics.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/libraries/metals.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/libraries/minimal.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/libraries/organics.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/libraries/others.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/libraries/polymers.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/libraries/repertoire.yml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/material/__init__.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/material/base_class.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/material/sellmeier_class.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/material/tabulated_class.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/material_bank.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/material_type.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/units.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik/utils.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik.egg-info/dependency_links.txt +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik.egg-info/requires.txt +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/PyOptik.egg-info/top_level.txt +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/README.rst +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/development/dev_0.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/Makefile +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/examples/README.rst +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/examples/sellmeier/README.rst +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/examples/sellmeier/plot_bk7.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/examples/sellmeier/plot_silica.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/examples/sellmeier/plot_water.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/examples/tabulated/README.rst +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/examples/tabulated/plot_sf5.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/examples/utils/README.rst +0 -0
- /pyoptik-1.10.4/docs/examples/utils/build_library.py → /pyoptik-1.10.6/docs/examples/utils/__build_library.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/examples/utils/__download_yml_file.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/examples/utils/create_sellmeier_file.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/examples/utils/create_tabulated_file.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/images/example_bk7.png +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/images/logo.png +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/make.bat +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/source/_static/default.css +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/source/_static/thumbnail.png +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/source/code.rst +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/source/conf.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/source/gallery/index.rst +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/source/index.rst +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/docs/source/references.rst +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/pyproject.toml +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/setup.cfg +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/tests/__init__.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/tests/test_sellmeier.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/tests/test_tabulated.py +0 -0
- {pyoptik-1.10.4 → pyoptik-1.10.6}/tests/test_usual_material.py +0 -0
|
@@ -103,8 +103,8 @@ docs/examples/tabulated/README.rst
|
|
|
103
103
|
docs/examples/tabulated/plot_sf5.py
|
|
104
104
|
docs/examples/tabulated/plot_silver.py
|
|
105
105
|
docs/examples/utils/README.rst
|
|
106
|
+
docs/examples/utils/__build_library.py
|
|
106
107
|
docs/examples/utils/__download_yml_file.py
|
|
107
|
-
docs/examples/utils/build_library.py
|
|
108
108
|
docs/examples/utils/create_sellmeier_file.py
|
|
109
109
|
docs/examples/utils/create_tabulated_file.py
|
|
110
110
|
docs/images/example_bk7.png
|
|
@@ -9,7 +9,6 @@ This module demonstrates the usage of the PyOptik library to calculate and plot
|
|
|
9
9
|
# %%
|
|
10
10
|
import numpy
|
|
11
11
|
from PyOptik import MaterialBank
|
|
12
|
-
MaterialBank.build_library('metals')
|
|
13
12
|
|
|
14
13
|
# Initialize the material with the Sellmeier model
|
|
15
14
|
material = MaterialBank.silver
|
|
@@ -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,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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|