PyOptik 1.8.0.post0__tar.gz → 1.8.2.post0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PKG-INFO +25 -14
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/__init__.py +0 -1
- pyoptik-1.8.2.post0/PyOptik/__main__.py +7 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/_version.py +2 -2
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/minimal.yml +2 -0
- pyoptik-1.8.2.post0/PyOptik/data/plastics.yml +8 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/material/sellmeier_class.py +7 -6
- pyoptik-1.8.2.post0/PyOptik/material_bank.py +388 -0
- pyoptik-1.8.2.post0/PyOptik/utils.py +38 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik.egg-info/PKG-INFO +25 -14
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik.egg-info/SOURCES.txt +7 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/README.rst +24 -13
- pyoptik-1.8.2.post0/development/dev_0.py +6 -0
- {pyoptik-1.8.0.post0/docs/source/gallery → pyoptik-1.8.2.post0/docs/examples}/sellmeier/plot_bk7.py +1 -0
- {pyoptik-1.8.0.post0/docs/source/gallery → pyoptik-1.8.2.post0/docs/examples}/sellmeier/plot_silica.py +1 -0
- {pyoptik-1.8.0.post0/docs/source/gallery → pyoptik-1.8.2.post0/docs/examples}/sellmeier/plot_water.py +1 -0
- {pyoptik-1.8.0.post0/docs/source/gallery → pyoptik-1.8.2.post0/docs/examples}/tabulated/plot_sf5.py +1 -0
- {pyoptik-1.8.0.post0/docs/source/gallery → pyoptik-1.8.2.post0/docs/examples}/tabulated/plot_silver.py +1 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/examples/utils/build_library.py +2 -2
- {pyoptik-1.8.0.post0/docs/source/gallery → pyoptik-1.8.2.post0/docs/examples}/utils/create_sellmeier_file.py +1 -0
- {pyoptik-1.8.0.post0/docs/source/gallery → pyoptik-1.8.2.post0/docs/examples}/utils/create_tabulated_file.py +1 -0
- {pyoptik-1.8.0.post0/docs/source/gallery → pyoptik-1.8.2.post0/docs/examples}/utils/download_yml_file.py +1 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/code.rst +15 -8
- pyoptik-1.8.2.post0/docs/source/gallery/utils/build_library.ipynb +43 -0
- pyoptik-1.8.2.post0/docs/source/gallery/utils/build_library.py +30 -0
- pyoptik-1.8.2.post0/docs/source/gallery/utils/build_library.py.md5 +1 -0
- pyoptik-1.8.2.post0/docs/source/gallery/utils/build_library.rst +173 -0
- pyoptik-1.8.2.post0/docs/source/gallery/utils/build_library_codeobj.pickle +0 -0
- pyoptik-1.8.2.post0/docs/source/gallery/utils/images/thumb/sphx_glr_build_library_thumb.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/index.rst +18 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/sg_execution_times.rst +4 -2
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/pyproject.toml +1 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/tests/test_sellmeier.py +2 -3
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/tests/test_tabulated.py +2 -3
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/tests/test_usual_material.py +8 -1
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/tests/test_utils.py +17 -18
- pyoptik-1.8.0.post0/PyOptik/__main__.py +0 -6
- pyoptik-1.8.0.post0/PyOptik/material_bank.py +0 -184
- pyoptik-1.8.0.post0/PyOptik/utils.py +0 -267
- pyoptik-1.8.0.post0/development/dev_0.py +0 -14
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/.github/dependabot.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/.github/workflows/deploy_anaconda.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/.github/workflows/deploy_coverage.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/.github/workflows/deploy_documentation.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/.github/workflows/deploy_workflow.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/.gitignore +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/.readthedocs.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/LICENSE +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/__init__.py +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/classics.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/glasses.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/metals.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/organics.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/others.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/sellmeier/BAK1.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/sellmeier/BK7.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/sellmeier/SF5.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/sellmeier/ZBLAN.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/sellmeier/air.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/sellmeier/argon.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/sellmeier/crown.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/sellmeier/flint.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/sellmeier/fused_silica.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/sellmeier/germanium.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/sellmeier/lithium_niobate.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/sellmeier/polystyren.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/sellmeier/silicon.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/sellmeier/soda_lime_glass.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/sellmeier/water.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/tabulated/aluminium.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/tabulated/calcium.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/tabulated/copper.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/tabulated/gold.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/tabulated/iron.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/tabulated/nickel.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/tabulated/silver.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/tabulated/sodium.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/data/tabulated/zinc.yml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/directories.py +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/material/__init__.py +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/material/base_class.py +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/material/tabulated_class.py +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik/units.py +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik.egg-info/dependency_links.txt +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik.egg-info/requires.txt +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/PyOptik.egg-info/top_level.txt +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/Makefile +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/examples/README.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/examples/sellmeier/README.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/examples/tabulated/README.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/examples/utils/README.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/images/example_bk7.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/images/logo.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/make.bat +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/_static/default.css +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/conf.py +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/index.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/images/sphx_glr_plot_bk7_001.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/images/sphx_glr_plot_silica_001.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/images/sphx_glr_plot_water_001.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/images/thumb/sphx_glr_plot_bk7_thumb.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/images/thumb/sphx_glr_plot_silica_thumb.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/images/thumb/sphx_glr_plot_water_thumb.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/index.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/plot_bk7.ipynb +0 -0
- {pyoptik-1.8.0.post0/docs/examples → pyoptik-1.8.2.post0/docs/source/gallery}/sellmeier/plot_bk7.py +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/plot_bk7.py.md5 +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/plot_bk7.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/plot_bk7_codeobj.pickle +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/plot_silica.ipynb +0 -0
- {pyoptik-1.8.0.post0/docs/examples → pyoptik-1.8.2.post0/docs/source/gallery}/sellmeier/plot_silica.py +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/plot_silica.py.md5 +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/plot_silica.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/plot_silica_codeobj.pickle +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/plot_water.ipynb +0 -0
- {pyoptik-1.8.0.post0/docs/examples → pyoptik-1.8.2.post0/docs/source/gallery}/sellmeier/plot_water.py +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/plot_water.py.md5 +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/plot_water.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/plot_water_codeobj.pickle +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/sellmeier/sg_execution_times.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/tabulated/images/sphx_glr_plot_sf5_001.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/tabulated/images/sphx_glr_plot_silver_001.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/tabulated/images/thumb/sphx_glr_plot_sf5_thumb.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/tabulated/images/thumb/sphx_glr_plot_silver_thumb.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/tabulated/index.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/tabulated/plot_sf5.ipynb +0 -0
- {pyoptik-1.8.0.post0/docs/examples → pyoptik-1.8.2.post0/docs/source/gallery}/tabulated/plot_sf5.py +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/tabulated/plot_sf5.py.md5 +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/tabulated/plot_sf5.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/tabulated/plot_sf5_codeobj.pickle +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/tabulated/plot_silver.ipynb +0 -0
- {pyoptik-1.8.0.post0/docs/examples → pyoptik-1.8.2.post0/docs/source/gallery}/tabulated/plot_silver.py +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/tabulated/plot_silver.py.md5 +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/tabulated/plot_silver.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/tabulated/plot_silver_codeobj.pickle +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/tabulated/sg_execution_times.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/create_sellmeier_file.ipynb +0 -0
- {pyoptik-1.8.0.post0/docs/examples → pyoptik-1.8.2.post0/docs/source/gallery}/utils/create_sellmeier_file.py +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/create_sellmeier_file.py.md5 +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/create_sellmeier_file.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/create_sellmeier_file_codeobj.pickle +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/create_tabulated_file.ipynb +0 -0
- {pyoptik-1.8.0.post0/docs/examples → pyoptik-1.8.2.post0/docs/source/gallery}/utils/create_tabulated_file.py +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/create_tabulated_file.py.md5 +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/create_tabulated_file.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/create_tabulated_file_codeobj.pickle +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/download_yml_file.ipynb +0 -0
- {pyoptik-1.8.0.post0/docs/examples → pyoptik-1.8.2.post0/docs/source/gallery}/utils/download_yml_file.py +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/download_yml_file.py.md5 +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/download_yml_file.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/download_yml_file_codeobj.pickle +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/images/sphx_glr_create_sellmeier_file_001.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/images/sphx_glr_create_tabulated_file_001.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/images/sphx_glr_download_yml_file_001.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/images/thumb/sphx_glr_create_sellmeier_file_thumb.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/images/thumb/sphx_glr_create_tabulated_file_thumb.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/gallery/utils/images/thumb/sphx_glr_download_yml_file_thumb.png +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/index.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/docs/source/references.rst +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/meta.yaml +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/setup.cfg +0 -0
- {pyoptik-1.8.0.post0 → pyoptik-1.8.2.post0}/tests/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyOptik
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.2.post0
|
|
4
4
|
Summary: A package for refractive index values.
|
|
5
5
|
Author-email: Martin Poinsinet de Sivry-Houle <martin.poinsinet.de.sivry@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -60,26 +60,27 @@ Requires-Dist: pydata-sphinx-theme==0.14.1; extra == "documentation"
|
|
|
60
60
|
PyOptik
|
|
61
61
|
=======
|
|
62
62
|
|
|
63
|
-
PyOptik is a
|
|
63
|
+
PyOptik is a Python tool designed to import refractive indexes and extinction coefficients for various materials across different wavelengths. The data provided by PyOptik can be used in numerous applications, including simulating light interactions with particles. All data is sourced from the reputable RefractiveIndex.INFO database.
|
|
64
64
|
|
|
65
65
|
|logo|
|
|
66
66
|
|
|
67
67
|
.. list-table::
|
|
68
|
-
:widths: 10 25 25
|
|
68
|
+
:widths: 10 25 25
|
|
69
69
|
:header-rows: 1
|
|
70
70
|
|
|
71
|
+
* - Meta
|
|
72
|
+
- |python|
|
|
73
|
+
- |docs|
|
|
71
74
|
* - Testing
|
|
72
75
|
- |ci/cd|
|
|
73
76
|
- |coverage|
|
|
74
|
-
|
|
75
|
-
* - Package
|
|
77
|
+
* - PyPi
|
|
76
78
|
- |PyPi|
|
|
77
79
|
- |PyPi_download|
|
|
80
|
+
* - Anaconda
|
|
78
81
|
- |anaconda|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
- |docs|
|
|
82
|
-
-
|
|
82
|
+
- |anaconda_download|
|
|
83
|
+
|
|
83
84
|
|
|
84
85
|
Features
|
|
85
86
|
********
|
|
@@ -119,10 +120,10 @@ In this example, we will download the `others` category of materials and remove
|
|
|
119
120
|
|
|
120
121
|
.. code:: python
|
|
121
122
|
|
|
122
|
-
from PyOptik
|
|
123
|
+
from PyOptik import MaterialBank
|
|
123
124
|
|
|
124
|
-
# Download the '
|
|
125
|
-
build_library('
|
|
125
|
+
# Download the 'classics' category and remove previous files
|
|
126
|
+
MaterialBank.build_library('classics', remove_previous=True)
|
|
126
127
|
|
|
127
128
|
**Available Categories:**
|
|
128
129
|
|
|
@@ -131,14 +132,14 @@ To download materials from another category, simply pass the category name as an
|
|
|
131
132
|
.. code:: python
|
|
132
133
|
|
|
133
134
|
# Download materials from the 'glasses' category
|
|
134
|
-
build_library('glasses')
|
|
135
|
+
MaterialBank.build_library('glasses')
|
|
135
136
|
|
|
136
137
|
To download all material categories at once:
|
|
137
138
|
|
|
138
139
|
.. code:: python
|
|
139
140
|
|
|
140
141
|
# Download all available material categories
|
|
141
|
-
build_library('all')
|
|
142
|
+
MaterialBank.build_library('all')
|
|
142
143
|
|
|
143
144
|
You can also set the `remove_previous` parameter to `True` to remove old data before downloading new material data.
|
|
144
145
|
|
|
@@ -247,11 +248,14 @@ As of 2024, PyOptik is still under development. If you would like to collaborate
|
|
|
247
248
|
**Email**: `martin.poinsinet.de.sivry@gmail.com <mailto:martin.poinsinet.de.sivry@gmail.com?subject=PyOptik>`_
|
|
248
249
|
|
|
249
250
|
.. |python| image:: https://img.shields.io/pypi/pyversions/pyoptik.svg
|
|
251
|
+
:alt: Python
|
|
250
252
|
:target: https://www.python.org/
|
|
251
253
|
|
|
252
254
|
.. |logo| image:: https://github.com/MartinPdeS/PyOptik/raw/master/docs/images/logo.png
|
|
255
|
+
:alt: PyOptik logo
|
|
253
256
|
|
|
254
257
|
.. |example_bk7| image:: https://github.com/MartinPdeS/PyOptik/raw/master/docs/images/example_bk7.png
|
|
258
|
+
:alt: PyOptik example: BK7
|
|
255
259
|
:target: https://github.com/MartinPdeS/PyOptik/blob/master/docs/images/example_bk7.png
|
|
256
260
|
|
|
257
261
|
.. |docs| image:: https://github.com/martinpdes/pyoptik/actions/workflows/deploy_documentation.yml/badge.svg
|
|
@@ -263,14 +267,21 @@ As of 2024, PyOptik is still under development. If you would like to collaborate
|
|
|
263
267
|
:alt: Unittest Status
|
|
264
268
|
|
|
265
269
|
.. |PyPi| image:: https://badge.fury.io/py/pyoptik.svg
|
|
270
|
+
:alt: PyPi version
|
|
266
271
|
:target: https://badge.fury.io/py/pyoptik
|
|
267
272
|
|
|
268
273
|
.. |PyPi_download| image:: https://img.shields.io/pypi/dm/pyoptik.svg
|
|
274
|
+
:alt: PyPi version
|
|
269
275
|
:target: https://pypistats.org/packages/pyoptik
|
|
270
276
|
|
|
277
|
+
.. |anaconda_download| image:: https://anaconda.org/martinpdes/pyoptik/badges/downloads.svg
|
|
278
|
+
:alt: Anaconda downloads
|
|
279
|
+
:target: https://anaconda.org/martinpdes/pyoptik
|
|
280
|
+
|
|
271
281
|
.. |coverage| image:: https://raw.githubusercontent.com/MartinPdeS/PyOptik/python-coverage-comment-action-data/badge.svg
|
|
272
282
|
:alt: Unittest coverage
|
|
273
283
|
:target: https://htmlpreview.github.io/?https://github.com/MartinPdeS/PyOptik/blob/python-coverage-comment-action-data/htmlcov/index.html
|
|
274
284
|
|
|
275
285
|
.. |anaconda| image:: https://anaconda.org/martinpdes/pyoptik/badges/version.svg
|
|
286
|
+
:alt: Anaconda version
|
|
276
287
|
:target: https://anaconda.org/martinpdes/pyoptik
|
|
@@ -12,5 +12,5 @@ __version__: str
|
|
|
12
12
|
__version_tuple__: VERSION_TUPLE
|
|
13
13
|
version_tuple: VERSION_TUPLE
|
|
14
14
|
|
|
15
|
-
__version__ = version = '1.8.
|
|
16
|
-
__version_tuple__ = version_tuple = (1, 8,
|
|
15
|
+
__version__ = version = '1.8.2.post0'
|
|
16
|
+
__version_tuple__ = version_tuple = (1, 8, 2)
|
|
@@ -2,6 +2,8 @@ sellmeier:
|
|
|
2
2
|
argon: https://refractiveindex.info/database/data-nk/main/Ar/Bideau-Mehu.yml
|
|
3
3
|
air: https://refractiveindex.info/database/data-nk/other/mixed%20gases/air/Ciddor.yml
|
|
4
4
|
water: https://refractiveindex.info/database/data-nk/main/H2O/Daimon-19.0C.yml
|
|
5
|
+
soda_lime_glass: https://refractiveindex.info/database/data-nk/glass/misc/soda-lime/Rubin-clear.yml
|
|
6
|
+
silicon: https://refractiveindex.info/database/data-nk/main/Si/Salzberg.yml
|
|
5
7
|
|
|
6
8
|
tabulated:
|
|
7
9
|
zinc: https://refractiveindex.info/database/data-nk/main/Zn/Werner.yml
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
sellmeier:
|
|
2
|
+
polyetylene: https://refractiveindex.info/database/data-nk/organic/(C2H4)n%20-%20polyethylene/Smith.yml
|
|
3
|
+
pva: https://refractiveindex.info/database/data-nk/organic/(C2H3Cl)n%20-%20polyvinyl%20chloride/Zhang.yml
|
|
4
|
+
pvc: https://refractiveindex.info/database/data-nk/organic/(C2H4O)n%20-%20polyvinyl%20alcohol/Schnepf.yml
|
|
5
|
+
pdms: https://refractiveindex.info/database/data-nk/organic/(C2H6OSi)n%20-%20polydimethylsiloxane/Schneider-RTV615.yml
|
|
6
|
+
polystyrene: https://refractiveindex.info/database/data-nk/organic/(C8H8)n%20-%20polystyrene/Sultanova.yml
|
|
7
|
+
polycarbonate: https://refractiveindex.info/database/data-nk/organic/(C16H14O3)n%20-%20polycarbonate/Sultanova.yml
|
|
8
|
+
cellulose: https://refractiveindex.info/database/data-nk/organic/(C6H10O5)n%20-%20cellulose/Sultanova.yml
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
|
+
import yaml
|
|
5
|
+
import numpy
|
|
6
|
+
import itertools
|
|
7
|
+
from MPSPlots.styles import mps
|
|
8
|
+
import matplotlib.pyplot as plt
|
|
4
9
|
from pydantic import Field, ConfigDict
|
|
5
10
|
from pydantic.dataclasses import dataclass
|
|
6
|
-
import matplotlib.pyplot as plt
|
|
7
|
-
import numpy
|
|
8
11
|
from typing import Tuple, Optional, Union
|
|
9
|
-
import
|
|
12
|
+
from PyOptik.units import micrometer, Quantity
|
|
10
13
|
from PyOptik.directories import sellmeier_data_path
|
|
11
|
-
import itertools
|
|
12
14
|
from PyOptik.material.base_class import BaseMaterial
|
|
13
|
-
|
|
14
|
-
from PyOptik.units import meter, micrometer, Quantity
|
|
15
|
+
|
|
15
16
|
|
|
16
17
|
config_dict = ConfigDict(
|
|
17
18
|
arbitrary_types_allowed=True
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
import numpy
|
|
5
|
+
import os
|
|
6
|
+
import re
|
|
7
|
+
import yaml
|
|
8
|
+
import logging
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import List, Union, Optional, Tuple
|
|
11
|
+
from PyOptik.directories import data_path
|
|
12
|
+
from PyOptik.material.sellmeier_class import SellmeierMaterial
|
|
13
|
+
from PyOptik.material.tabulated_class import TabulatedMaterial
|
|
14
|
+
from PyOptik.utils import download_yml_file
|
|
15
|
+
from tabulate import tabulate
|
|
16
|
+
from dataclasses import dataclass
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@dataclass(frozen=True, slots=True)
|
|
20
|
+
class _MaterialBank():
|
|
21
|
+
"""
|
|
22
|
+
A class representing a centralized material bank for common optical materials available in the PyOptik library.
|
|
23
|
+
|
|
24
|
+
The `_MaterialBank` class provides access to a predefined list of materials used in optical simulations,
|
|
25
|
+
categorized into Sellmeier and Tabulated materials. It allows users to dynamically retrieve materials
|
|
26
|
+
based on their names without the need to instantiate the class. The material bank can be expanded
|
|
27
|
+
or modified by adding or removing materials from the bank, and it provides utilities to fetch material data
|
|
28
|
+
dynamically when accessed as class attributes.
|
|
29
|
+
|
|
30
|
+
Attributes
|
|
31
|
+
----------
|
|
32
|
+
all : list
|
|
33
|
+
A combined list of all materials, including both Sellmeier and Tabulated materials.
|
|
34
|
+
|
|
35
|
+
Usage
|
|
36
|
+
-----
|
|
37
|
+
Materials can be accessed directly as class attributes:
|
|
38
|
+
|
|
39
|
+
>>> material = _MaterialBank
|
|
40
|
+
>>> bk7_material = material.BK7 # Dynamically retrieves the BK7 material.
|
|
41
|
+
|
|
42
|
+
To add a new material to the Sellmeier bank:
|
|
43
|
+
|
|
44
|
+
>>> material.add_sellmeier_to_bank("new_material.yml", "http://example.com/material.yml")
|
|
45
|
+
|
|
46
|
+
To remove a material from the bank:
|
|
47
|
+
|
|
48
|
+
>>> MaterialBank.remove_item("obsolete_material.yml")
|
|
49
|
+
|
|
50
|
+
Raises
|
|
51
|
+
------
|
|
52
|
+
FileNotFoundError
|
|
53
|
+
If a material is not found in either the Sellmeier or Tabulated material lists.
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
def __getattr__(self, material_name: str) -> Union[SellmeierMaterial, TabulatedMaterial]:
|
|
57
|
+
"""
|
|
58
|
+
Retrieve a material by name dynamically at the class level.
|
|
59
|
+
|
|
60
|
+
Parameters
|
|
61
|
+
----------
|
|
62
|
+
material_name : str
|
|
63
|
+
The name of the material to retrieve.
|
|
64
|
+
|
|
65
|
+
Returns
|
|
66
|
+
-------
|
|
67
|
+
Union[SellmeierMaterial, TabulatedMaterial]
|
|
68
|
+
An instance of the material if found.
|
|
69
|
+
|
|
70
|
+
Raises
|
|
71
|
+
------
|
|
72
|
+
FileNotFoundError
|
|
73
|
+
If the material is not found in either the Sellmeier or Tabulated lists.
|
|
74
|
+
"""
|
|
75
|
+
if material_name in self.sellmeier:
|
|
76
|
+
return SellmeierMaterial(filename=material_name)
|
|
77
|
+
|
|
78
|
+
if material_name in self.tabulated:
|
|
79
|
+
return TabulatedMaterial(filename=material_name)
|
|
80
|
+
|
|
81
|
+
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{material_name}'")
|
|
82
|
+
|
|
83
|
+
@property
|
|
84
|
+
def sellmeier(self) -> List[str]:
|
|
85
|
+
return [
|
|
86
|
+
os.path.splitext(f)[0] for f in os.listdir(data_path / 'sellmeier') if os.path.isfile(os.path.join(data_path / 'sellmeier', f)) and f.endswith('.yml')
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
@property
|
|
90
|
+
def tabulated(self) -> List[str]:
|
|
91
|
+
return [
|
|
92
|
+
os.path.splitext(f)[0] for f in os.listdir(data_path / 'tabulated') if os.path.isfile(os.path.join(data_path / 'tabulated', f)) and f.endswith('.yml')
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
@property
|
|
96
|
+
def all(self) -> List[str]:
|
|
97
|
+
return self.sellmeier + self.tabulated
|
|
98
|
+
|
|
99
|
+
def print_materials(cls) -> None:
|
|
100
|
+
"""
|
|
101
|
+
Prints out all the available Sellmeier and Tabulated materials in a tabulated format.
|
|
102
|
+
"""
|
|
103
|
+
sellmeier_materials = cls.sellmeier
|
|
104
|
+
tabulated_materials = cls.tabulated
|
|
105
|
+
|
|
106
|
+
# Create data for the table
|
|
107
|
+
table_data = []
|
|
108
|
+
max_len = max(len(sellmeier_materials), len(tabulated_materials))
|
|
109
|
+
for i in range(max_len):
|
|
110
|
+
sellmeier = sellmeier_materials[i] if i < len(sellmeier_materials) else ""
|
|
111
|
+
tabulated = tabulated_materials[i] if i < len(tabulated_materials) else ""
|
|
112
|
+
table_data.append([sellmeier, tabulated])
|
|
113
|
+
|
|
114
|
+
# Define headers
|
|
115
|
+
headers = ["Sellmeier Materials", "Tabulated Materials"]
|
|
116
|
+
|
|
117
|
+
# Print the table using tabulate
|
|
118
|
+
print(tabulate(table_data, headers=headers, tablefmt="grid"))
|
|
119
|
+
|
|
120
|
+
@classmethod
|
|
121
|
+
def add_sellmeier_to_bank(cls, filename: str, url: str) -> None:
|
|
122
|
+
"""
|
|
123
|
+
Add a Sellmeier material to the material bank.
|
|
124
|
+
|
|
125
|
+
Downloads a YAML file containing the Sellmeier material data from a specified URL and stores it
|
|
126
|
+
in the Sellmeier materials directory.
|
|
127
|
+
|
|
128
|
+
Parameters
|
|
129
|
+
----------
|
|
130
|
+
filename : str
|
|
131
|
+
The name of the file to be saved in the Sellmeier material bank.
|
|
132
|
+
url : str
|
|
133
|
+
The URL from where the material file is downloaded.
|
|
134
|
+
|
|
135
|
+
Returns
|
|
136
|
+
-------
|
|
137
|
+
None
|
|
138
|
+
"""
|
|
139
|
+
return download_yml_file(filename=filename, url=url, location=data_path / 'sellmeier')
|
|
140
|
+
|
|
141
|
+
@classmethod
|
|
142
|
+
def add_tabulated_to_bank(cls, filename: str, url: str) -> None:
|
|
143
|
+
"""
|
|
144
|
+
Add a Tabulated material to the material bank.
|
|
145
|
+
|
|
146
|
+
Downloads a YAML file containing the Tabulated material data from a specified URL and stores it
|
|
147
|
+
in the Tabulated materials directory.
|
|
148
|
+
|
|
149
|
+
Parameters
|
|
150
|
+
----------
|
|
151
|
+
filename : str
|
|
152
|
+
The name of the file to be saved in the Tabulated material bank.
|
|
153
|
+
url : str
|
|
154
|
+
The URL from where the material file is downloaded.
|
|
155
|
+
|
|
156
|
+
Returns
|
|
157
|
+
-------
|
|
158
|
+
None
|
|
159
|
+
"""
|
|
160
|
+
return download_yml_file(filename=filename, url=url, location=data_path / 'tabulated')
|
|
161
|
+
|
|
162
|
+
@classmethod
|
|
163
|
+
def remove_item(cls, filename: str, location: str = 'any') -> None:
|
|
164
|
+
"""
|
|
165
|
+
Remove a file associated with a given element name from the specified location.
|
|
166
|
+
|
|
167
|
+
Parameters
|
|
168
|
+
----------
|
|
169
|
+
filename : str
|
|
170
|
+
The name of the file to remove, without the '.yml' suffix.
|
|
171
|
+
location : str
|
|
172
|
+
The location to search for the file, either 'sellmeier', 'tabulated', or 'any' (default is 'any').
|
|
173
|
+
|
|
174
|
+
Raises
|
|
175
|
+
------
|
|
176
|
+
FileNotFoundError
|
|
177
|
+
If the specified file does not exist.
|
|
178
|
+
ValueError
|
|
179
|
+
If an invalid location is provided.
|
|
180
|
+
"""
|
|
181
|
+
location = location.lower()
|
|
182
|
+
|
|
183
|
+
if location not in ['any', 'sellmeier', 'tabulated']:
|
|
184
|
+
raise ValueError("Invalid location. Please choose 'sellmeier', 'tabulated', or 'any'.")
|
|
185
|
+
|
|
186
|
+
if location in ['any', 'sellmeier']:
|
|
187
|
+
sellmeier_file = data_path / 'sellmeier' / f"{filename}.yml"
|
|
188
|
+
if sellmeier_file.exists():
|
|
189
|
+
sellmeier_file.unlink()
|
|
190
|
+
|
|
191
|
+
if location in ['any', 'tabulated']:
|
|
192
|
+
tabulated_file = data_path / 'tabulated' / f"{filename}.yml"
|
|
193
|
+
if tabulated_file.exists():
|
|
194
|
+
tabulated_file.unlink()
|
|
195
|
+
|
|
196
|
+
def clean_data_files(self, regex: str, location: str = 'any') -> None:
|
|
197
|
+
"""
|
|
198
|
+
Remove all files matching the given regex from the specified location.
|
|
199
|
+
|
|
200
|
+
Parameters
|
|
201
|
+
----------
|
|
202
|
+
regex : str
|
|
203
|
+
The regex pattern to match the filenames (without the '.yml' suffix).
|
|
204
|
+
location : str
|
|
205
|
+
The location to search for files, either 'sellmeier', 'tabulated', or 'any' (default is 'any').
|
|
206
|
+
|
|
207
|
+
Raises
|
|
208
|
+
------
|
|
209
|
+
ValueError
|
|
210
|
+
If an invalid location is provided.
|
|
211
|
+
"""
|
|
212
|
+
# Compile the regex pattern
|
|
213
|
+
pattern = re.compile(regex)
|
|
214
|
+
|
|
215
|
+
# Normalize the location parameter
|
|
216
|
+
location = location.lower()
|
|
217
|
+
|
|
218
|
+
if location not in ['any', 'sellmeier', 'tabulated']:
|
|
219
|
+
raise ValueError("Invalid location. Please choose 'sellmeier', 'tabulated', or 'any'.")
|
|
220
|
+
|
|
221
|
+
# Function to remove matching files in a given directory
|
|
222
|
+
def remove_matching_files(directory: Path):
|
|
223
|
+
if not directory.exists():
|
|
224
|
+
return
|
|
225
|
+
for file in directory.glob("*.yml"):
|
|
226
|
+
if pattern.match(file.stem):
|
|
227
|
+
logging.info(f"Removing file: {file}")
|
|
228
|
+
file.unlink()
|
|
229
|
+
|
|
230
|
+
# Remove files from the sellmeier location if specified
|
|
231
|
+
if location in ['any', 'sellmeier']:
|
|
232
|
+
remove_matching_files(data_path / 'sellmeier')
|
|
233
|
+
|
|
234
|
+
# Remove files from the tabulated location if specified
|
|
235
|
+
if location in ['any', 'tabulated']:
|
|
236
|
+
remove_matching_files(data_path / 'tabulated')
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def build_library(self, library: Union[str, List[str]] = 'classics', remove_previous: bool = False) -> None:
|
|
240
|
+
"""
|
|
241
|
+
Downloads and saves materials data from the specified URLs.
|
|
242
|
+
|
|
243
|
+
Parameters
|
|
244
|
+
----------
|
|
245
|
+
library : str | list[str]
|
|
246
|
+
The name or list of names of the libraries to download.
|
|
247
|
+
remove_previous : bool
|
|
248
|
+
If True, removes existing files before downloading new ones.
|
|
249
|
+
"""
|
|
250
|
+
AVAILABLE_LIBRARIES = {'classics', 'glasses', 'metals', 'organics', 'others', 'minimal'}
|
|
251
|
+
|
|
252
|
+
libraries_to_download = AVAILABLE_LIBRARIES if library == 'all' else set(numpy.atleast_1d(library))
|
|
253
|
+
|
|
254
|
+
# Ensure the requested library exists
|
|
255
|
+
assert libraries_to_download.issubset(AVAILABLE_LIBRARIES), f"Library value should be in {AVAILABLE_LIBRARIES}"
|
|
256
|
+
|
|
257
|
+
# Remove previous files if the flag is set
|
|
258
|
+
if remove_previous:
|
|
259
|
+
logging.info(f"Removing previous files from the library.")
|
|
260
|
+
self.clean_data_files(regex=".*", location="sellmeier") # Remove all sellmeier files
|
|
261
|
+
self.clean_data_files(regex=".*", location="tabulated") # Remove all tabulated files
|
|
262
|
+
|
|
263
|
+
for lib in libraries_to_download:
|
|
264
|
+
file_path = data_path / lib
|
|
265
|
+
with open(file_path.with_suffix('.yml'), 'r') as file:
|
|
266
|
+
data_dict = yaml.safe_load(file)
|
|
267
|
+
|
|
268
|
+
# Download new files for sellmeier
|
|
269
|
+
if data_dict.get('sellmeier', False):
|
|
270
|
+
for element_name, url in data_dict['sellmeier'].items():
|
|
271
|
+
download_yml_file(url=url, filename=element_name, location=data_path / 'sellmeier')
|
|
272
|
+
|
|
273
|
+
# Download new files for tabulated
|
|
274
|
+
if data_dict.get('tabulated', False):
|
|
275
|
+
for element_name, url in data_dict['tabulated'].items():
|
|
276
|
+
download_yml_file(url=url, filename=element_name, location=data_path / 'tabulated')
|
|
277
|
+
|
|
278
|
+
def create_sellmeier_file(
|
|
279
|
+
self,
|
|
280
|
+
filename: str,
|
|
281
|
+
formula_type: int,
|
|
282
|
+
coefficients: List[float],
|
|
283
|
+
wavelength_range: Optional[Tuple[float, float]] = None,
|
|
284
|
+
reference: Optional[str] = None,
|
|
285
|
+
comments: Optional[str] = None,
|
|
286
|
+
specs: Optional[dict] = None) -> None:
|
|
287
|
+
"""
|
|
288
|
+
Creates a YAML file with custom Sellmeier coefficients in the correct format.
|
|
289
|
+
|
|
290
|
+
Parameters
|
|
291
|
+
----------
|
|
292
|
+
filename : str
|
|
293
|
+
The name of the file to create (without the extension).
|
|
294
|
+
formula_type : int
|
|
295
|
+
The type of Sellmeier formula.
|
|
296
|
+
coefficients : list[float]
|
|
297
|
+
A list of coefficients for the Sellmeier equation.
|
|
298
|
+
wavelength_range : Tuple[float, float]
|
|
299
|
+
The range of wavelengths, in micrometers.
|
|
300
|
+
reference : str
|
|
301
|
+
A reference for the material data.
|
|
302
|
+
comments : Optional[str]
|
|
303
|
+
Additional comments about the material.
|
|
304
|
+
specs : Optional[dict]
|
|
305
|
+
Additional specifications, such as temperature and whether the wavelength is in a vacuum.
|
|
306
|
+
"""
|
|
307
|
+
reference = 'None' if reference is None else reference
|
|
308
|
+
|
|
309
|
+
# Create the data dictionary for YAML
|
|
310
|
+
data = {}
|
|
311
|
+
data['REFERENCES'] = reference
|
|
312
|
+
data['DATA'] = dict(
|
|
313
|
+
type=f'formula {formula_type}',
|
|
314
|
+
coefficients=" ".join(map(str, coefficients))
|
|
315
|
+
)
|
|
316
|
+
|
|
317
|
+
if wavelength_range is not None:
|
|
318
|
+
min_bound, max_bound = wavelength_range
|
|
319
|
+
data['DATA'].update({'wavelength_range': f"{min_bound} {max_bound}"})
|
|
320
|
+
|
|
321
|
+
data['DATA'] = [data['DATA']]
|
|
322
|
+
# Add comments if provided
|
|
323
|
+
if comments:
|
|
324
|
+
data['COMMENTS'] = comments
|
|
325
|
+
|
|
326
|
+
# Add specs if provided
|
|
327
|
+
if specs:
|
|
328
|
+
data['SPECS'] = specs
|
|
329
|
+
|
|
330
|
+
# Define the file path
|
|
331
|
+
file_path = data_path / 'sellmeier' / f"{filename}.yml"
|
|
332
|
+
|
|
333
|
+
# Write the data to a YAML file
|
|
334
|
+
with open(file_path, 'w') as file:
|
|
335
|
+
yaml.dump(data, file, default_flow_style=False)
|
|
336
|
+
|
|
337
|
+
logging.info(f"Sellmeier data saved to {file_path}")
|
|
338
|
+
|
|
339
|
+
def create_tabulated_file(
|
|
340
|
+
self,
|
|
341
|
+
filename: str,
|
|
342
|
+
data: List[Tuple[float, float, float]],
|
|
343
|
+
reference: Optional[str] = None,
|
|
344
|
+
comments: Optional[str] = None) -> None:
|
|
345
|
+
"""
|
|
346
|
+
Creates a YAML file with tabulated nk data in the correct format.
|
|
347
|
+
|
|
348
|
+
Parameters
|
|
349
|
+
----------
|
|
350
|
+
filename : str)
|
|
351
|
+
The name of the file to create (without the extension).
|
|
352
|
+
data : List[Tuple[float, float, float]])
|
|
353
|
+
The tabulated nk data.
|
|
354
|
+
reference : Optional[str])
|
|
355
|
+
A reference for the material data.
|
|
356
|
+
comments : Optional[str])
|
|
357
|
+
Additional comments about the material.
|
|
358
|
+
"""
|
|
359
|
+
reference = 'None' if reference is None else reference
|
|
360
|
+
|
|
361
|
+
# Convert the data list to a formatted string
|
|
362
|
+
data_str = "\n".join(" ".join(map(str, row)) for row in data)
|
|
363
|
+
|
|
364
|
+
# Create the data dictionary for YAML
|
|
365
|
+
yaml_data = {
|
|
366
|
+
'REFERENCES': reference,
|
|
367
|
+
'DATA': [
|
|
368
|
+
{
|
|
369
|
+
'type': 'tabulated nk',
|
|
370
|
+
'data': data_str,
|
|
371
|
+
}
|
|
372
|
+
]
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
# Add comments if provided
|
|
376
|
+
if comments:
|
|
377
|
+
yaml_data['COMMENTS'] = comments
|
|
378
|
+
|
|
379
|
+
# Define the file path
|
|
380
|
+
file_path = data_path / 'tabulated' / f"{filename}.yml"
|
|
381
|
+
|
|
382
|
+
# Write the data to a YAML file
|
|
383
|
+
with open(file_path, 'w') as file:
|
|
384
|
+
yaml.dump(yaml_data, file, default_flow_style=False)
|
|
385
|
+
|
|
386
|
+
logging.info(f"Tabulated nk data saved to {file_path}")
|
|
387
|
+
|
|
388
|
+
MaterialBank = _MaterialBank()
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def download_yml_file(url: str, filename: str, location: str) -> None:
|
|
5
|
+
"""
|
|
6
|
+
Downloads a .yml file from a specified URL and saves it locally.
|
|
7
|
+
|
|
8
|
+
Parameters
|
|
9
|
+
----------
|
|
10
|
+
url : str
|
|
11
|
+
The URL of the .yml file to download.
|
|
12
|
+
save_path : str
|
|
13
|
+
The local path where the .yml file should be saved.
|
|
14
|
+
|
|
15
|
+
Raises
|
|
16
|
+
------
|
|
17
|
+
HTTPError: If the download fails due to an HTTP error.
|
|
18
|
+
"""
|
|
19
|
+
file_path = location / f"{filename}.yml"
|
|
20
|
+
try:
|
|
21
|
+
# Send a GET request to the URL
|
|
22
|
+
response = requests.get(url)
|
|
23
|
+
response.raise_for_status() # Raise an error for bad status codes
|
|
24
|
+
|
|
25
|
+
# Save the content of the response as a file
|
|
26
|
+
file_path.parent.mkdir(parents=True, exist_ok=True) # Create directories if they don't exist
|
|
27
|
+
|
|
28
|
+
with open(file_path, 'wb') as file:
|
|
29
|
+
file.write(response.content)
|
|
30
|
+
|
|
31
|
+
print(f"File downloaded and saved to {file_path}")
|
|
32
|
+
|
|
33
|
+
except requests.exceptions.HTTPError as http_err:
|
|
34
|
+
print(f"HTTP error occurred: {http_err}")
|
|
35
|
+
except Exception as err:
|
|
36
|
+
print(f"An error occurred: {err}")
|
|
37
|
+
|
|
38
|
+
|