From 7288fa37618286156681f68216c20874bca36713 Mon Sep 17 00:00:00 2001 From: Martin Schubert Date: Fri, 22 Nov 2024 16:53:27 -0800 Subject: [PATCH 1/4] Test parsing of yaml files, and add workflow --- .github/workflows/test.yml | 30 ++++++++++++++++++++++++++++++ tests/test_parse.py | 22 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 .github/workflows/test.yml create mode 100644 tests/test_parse.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..72e36377f --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,30 @@ +name: CI + +on: + pull_request: + push: + branches: + - main + schedule: + - cron: "0 13 * * 1" # Every Monday at 9AM EST + +jobs: + test-parsing: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + cache: "pip" + cache-dependency-path: pyproject.toml + + - name: Test pre-commit hooks + run: | + python -m pip install --upgrade pip + pip install parameterized + pip install pytest + pytest diff --git a/tests/test_parse.py b/tests/test_parse.py new file mode 100644 index 000000000..82ca2bd30 --- /dev/null +++ b/tests/test_parse.py @@ -0,0 +1,22 @@ +"""Tests that all files can be parsed.""" + +import pathlib +import unittest +import yaml +from parameterized import parameterized + +DATABASE_PATH = pathlib.Path(__file__).resolve().parent.parent / "database" +PATHS = list(DATABASE_PATH.rglob("*.yml")) + + +def custom_name_func(testcase_func, param_num, param): + del param_num + path = str(param.args[0]) + return f"{testcase_func.__name__}{parameterized.to_safe_name(path)}" + + +class ParseTest(unittest.TestCase): + @parameterized.expand(PATHS, name_func=custom_name_func) + def test_can_parse(self, path): + with open(path, "r") as stream: + yaml.safe_load(stream) From d44f76f6275afd44379712564a645b06990d7a95 Mon Sep 17 00:00:00 2001 From: Martin Schubert Date: Fri, 22 Nov 2024 16:58:19 -0800 Subject: [PATCH 2/4] fix workflow --- .github/workflows/test.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 72e36377f..7fdd58c91 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,16 +15,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.10" - cache: "pip" - cache-dependency-path: pyproject.toml - - - name: Test pre-commit hooks + - name: Set up environment run: | python -m pip install --upgrade pip pip install parameterized pip install pytest - pytest + + - name: Run tests + run: pytest From da016897bc62e6699f5c34fd556d88b7b397bdb8 Mon Sep 17 00:00:00 2001 From: Martin Schubert Date: Fri, 22 Nov 2024 16:59:34 -0800 Subject: [PATCH 3/4] fix workflow --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7fdd58c91..5b3a1e64b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,4 +22,4 @@ jobs: pip install pytest - name: Run tests - run: pytest + run: pytest From 0d892ea8e8ea4c80c90854c1cbc24dea7eb8b193 Mon Sep 17 00:00:00 2001 From: Martin Schubert Date: Fri, 22 Nov 2024 17:10:00 -0800 Subject: [PATCH 4/4] fix yml formatting --- database/data-nk/main/CdSe/Ninomiya-cubic.yml | 5 +++-- database/data-nk/main/InP/Pettit.yml | 5 +++-- database/data-nk/main/Si/Schinke.yml | 5 +++-- database/data-nk/main/SiO2/Malitson.yml | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/database/data-nk/main/CdSe/Ninomiya-cubic.yml b/database/data-nk/main/CdSe/Ninomiya-cubic.yml index b84cbaaee..542c3f5a8 100644 --- a/database/data-nk/main/CdSe/Ninomiya-cubic.yml +++ b/database/data-nk/main/CdSe/Ninomiya-cubic.yml @@ -2,8 +2,9 @@ # refractiveindex.info database is in the public domain # copyright and related rights waived via CC0 1.0 -REFERENCES: "1) S. Ninomiya and S. Adachi. Optical properties of cubic and hexagonal CdSe, J. Appl. Phys. 78, 4681-4689 (1995)
2) Y. D. Kim, M. V. Klein, S. F. Ren, Y. C. Chang, H. Luo, N. Samarth, J. K. Furdyna. -Optical properties of zinc-blende CdSe and ZnxCd1−xSe films grown on GaAs, Phys. Rev. B 49, 7262-7270 (1994)
* Authors of Ref. 1 provide a simplified model of the interband transitions (MDF) based on the experimental data from Ref. 2.
[Calculation script (Python)]" +REFERENCES: | + "1) S. Ninomiya and S. Adachi. Optical properties of cubic and hexagonal CdSe, J. Appl. Phys. 78, 4681-4689 (1995)
2) Y. D. Kim, M. V. Klein, S. F. Ren, Y. C. Chang, H. Luo, N. Samarth, J. K. Furdyna. + Optical properties of zinc-blende CdSe and ZnxCd1−xSe films grown on GaAs, Phys. Rev. B 49, 7262-7270 (1994)
* Authors of Ref. 1 provide a simplified model of the interband transitions (MDF) based on the experimental data from Ref. 2.
[Calculation script (Python)]" COMMENTS: | Cubic CdSe. Room temperature. DATA: diff --git a/database/data-nk/main/InP/Pettit.yml b/database/data-nk/main/InP/Pettit.yml index a42a5b44a..ae1688800 100644 --- a/database/data-nk/main/InP/Pettit.yml +++ b/database/data-nk/main/InP/Pettit.yml @@ -2,8 +2,9 @@ # refractiveindex.info database is in the public domain # copyright and related rights waived via CC0 1.0 -REFERENCES: "1) G. D. Pettit and W. J. Turner. Refractive index of InP, J. Appl. Phys. 36, 2081 (1965)
2) A. N. Pikhtin and A. D. Yas’kov. Disperson of the refractive index -of semiconductors with diamond and zinc-blende structures, Sov. Phys. Semicond. 12, 622-626 (1978) (as cited in Handbook of Optics, 2nd edition, Vol. 2. McGraw-Hill 1994)
3) Handbook of Optics, 2nd edition, Vol. 2. McGraw-Hill 1994
* Ref. 3 provides a Sellmeier equation based on data from Ref. 1 and Ref. 2." +REFERENCES: | + "1) G. D. Pettit and W. J. Turner. Refractive index of InP, J. Appl. Phys. 36, 2081 (1965)
2) A. N. Pikhtin and A. D. Yas’kov. Disperson of the refractive index + of semiconductors with diamond and zinc-blende structures, Sov. Phys. Semicond. 12, 622-626 (1978) (as cited in Handbook of Optics, 2nd edition, Vol. 2. McGraw-Hill 1994)
3) Handbook of Optics, 2nd edition, Vol. 2. McGraw-Hill 1994
* Ref. 3 provides a Sellmeier equation based on data from Ref. 1 and Ref. 2." COMMENTS: | Room temperature DATA: diff --git a/database/data-nk/main/Si/Schinke.yml b/database/data-nk/main/Si/Schinke.yml index ddc14224d..c9438febe 100644 --- a/database/data-nk/main/Si/Schinke.yml +++ b/database/data-nk/main/Si/Schinke.yml @@ -2,8 +2,9 @@ # refractiveindex.info database is in the public domain # copyright and related rights waived via CC0 1.0 -REFERENCES: "1) C. Schinke, P. C. Peest, J. Schmidt, R. Brendel, K. Bothe, M. R. Vogt, I. Kröger, S. Winter, A. Schirmacher, S. Lim, H. T. Nguyen, D. MacDonald. Uncertainty analysis for the coefficient of band-to-band absorption of crystalline silicon. -AIP Advances 5, 67168 (2015)
2) M. R. Vogt. Development of physical models for the simulation of optical properties of solar cell modules, PhD. Thesis (2015)" +REFERENCES: | + "1) C. Schinke, P. C. Peest, J. Schmidt, R. Brendel, K. Bothe, M. R. Vogt, I. Kröger, S. Winter, A. Schirmacher, S. Lim, H. T. Nguyen, D. MacDonald. Uncertainty analysis for the coefficient of band-to-band absorption of crystalline silicon. + AIP Advances 5, 67168 (2015)
2) M. R. Vogt. Development of physical models for the simulation of optical properties of solar cell modules, PhD. Thesis (2015)" COMMENTS: | Relative uncertainties of the absorption coefficient: 0.4% at 0.250 µm, 11% at 0.6 µm, 1.4% at 1 µm, 12% at 1.2 µm and 180% at 1.45 µm. Temperature: 295 K. DATA: diff --git a/database/data-nk/main/SiO2/Malitson.yml b/database/data-nk/main/SiO2/Malitson.yml index 979d4f35f..3c556fca8 100644 --- a/database/data-nk/main/SiO2/Malitson.yml +++ b/database/data-nk/main/SiO2/Malitson.yml @@ -2,8 +2,9 @@ # refractiveindex.info database is in the public domain # copyright and related rights waived via CC0 1.0 -REFERENCES: "1) I. H. Malitson. Interspecimen comparison of the refractive index of fused silica, J. Opt. Soc. Am. 55, 1205-1208 (1965)
2) C. Z. Tan. Determination of refractive index of silica glass for infrared wavelengths by IR spectroscopy, J. Non-Cryst. Solids 223, 158-163 (1998)
-* Sellmeier formula is reported in Ref. 1 for the 0.21-3.71 μm wavelength range. Ref. 2 verifies the validity of the formula up to 6.7 μm." +REFERENCES: | + "1) I. H. Malitson. Interspecimen comparison of the refractive index of fused silica, J. Opt. Soc. Am. 55, 1205-1208 (1965)
2) C. Z. Tan. Determination of refractive index of silica glass for infrared wavelengths by IR spectroscopy, J. Non-Cryst. Solids 223, 158-163 (1998)
+ * Sellmeier formula is reported in Ref. 1 for the 0.21-3.71 μm wavelength range. Ref. 2 verifies the validity of the formula up to 6.7 μm." COMMENTS: | Fused silica, 20 °C DATA: