Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix yml files, add test, add workflow #1

Merged
merged 4 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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 environment
run: |
python -m pip install --upgrade pip
pip install parameterized
pip install pytest

- name: Run tests
run: pytest
5 changes: 3 additions & 2 deletions database/data-nk/main/CdSe/Ninomiya-cubic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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, <a href="https://doi.org/10.1063/1.359815"><i>J. Appl. Phys.</i> <b>78</b>, 4681-4689 (1995)</a><br>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 Zn<sub>x</sub>Cd<sub>1−x</sub>Se films grown on GaAs, <a href="https://doi.org/10.1103/PhysRevB.49.7262"><i>Phys. Rev. B</i> <b>49</b>, 7262-7270 (1994)</a><br>* Authors of Ref. 1 provide a simplified model of the interband transitions (MDF) based on the experimental data from Ref. 2.<br>[<a href="https://github.com/polyanskiy/refractiveindex.info-scripts/blob/master/scripts/Ninomiya%201995%20-%20cubic%20CdSe.py">Calculation script (Python)</a>]"
REFERENCES: |
"1) S. Ninomiya and S. Adachi. Optical properties of cubic and hexagonal CdSe, <a href="https://doi.org/10.1063/1.359815"><i>J. Appl. Phys.</i> <b>78</b>, 4681-4689 (1995)</a><br>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 Zn<sub>x</sub>Cd<sub>1−x</sub>Se films grown on GaAs, <a href="https://doi.org/10.1103/PhysRevB.49.7262"><i>Phys. Rev. B</i> <b>49</b>, 7262-7270 (1994)</a><br>* Authors of Ref. 1 provide a simplified model of the interband transitions (MDF) based on the experimental data from Ref. 2.<br>[<a href="https://github.com/polyanskiy/refractiveindex.info-scripts/blob/master/scripts/Ninomiya%201995%20-%20cubic%20CdSe.py">Calculation script (Python)</a>]"
COMMENTS: |
Cubic CdSe. Room temperature.
DATA:
Expand Down
5 changes: 3 additions & 2 deletions database/data-nk/main/InP/Pettit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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, <a href="https://doi.org/10.1063/1.1714410"><i>J. Appl. Phys.</i> <b>36</b>, 2081 (1965)</a><br>2) A. N. Pikhtin and A. D. Yas’kov. Disperson of the refractive index
of semiconductors with diamond and zinc-blende structures, <i>Sov. Phys. Semicond.</i> <b>12</b>, 622-626 (1978) (as cited in Handbook of Optics, 2nd edition, Vol. 2. McGraw-Hill 1994)<br>3) Handbook of Optics, 2nd edition, Vol. 2. McGraw-Hill 1994<br> * 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, <a href="https://doi.org/10.1063/1.1714410"><i>J. Appl. Phys.</i> <b>36</b>, 2081 (1965)</a><br>2) A. N. Pikhtin and A. D. Yas’kov. Disperson of the refractive index
of semiconductors with diamond and zinc-blende structures, <i>Sov. Phys. Semicond.</i> <b>12</b>, 622-626 (1978) (as cited in Handbook of Optics, 2nd edition, Vol. 2. McGraw-Hill 1994)<br>3) Handbook of Optics, 2nd edition, Vol. 2. McGraw-Hill 1994<br> * Ref. 3 provides a Sellmeier equation based on data from Ref. 1 and Ref. 2."
COMMENTS: |
Room temperature
DATA:
Expand Down
5 changes: 3 additions & 2 deletions database/data-nk/main/Si/Schinke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
<a href="https://doi.org/10.1063%2F1.4923379"><i>AIP Advances</i> <b>5</b>, 67168 (2015)</a><br>2) M. R. Vogt. <i>Development of physical models for the simulation of optical properties of solar cell modules</i>, <a href="https://www.tib.eu/en/search/id/TIBKAT%3A852464657">PhD. Thesis (2015)</a>"
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.
<a href="https://doi.org/10.1063%2F1.4923379"><i>AIP Advances</i> <b>5</b>, 67168 (2015)</a><br>2) M. R. Vogt. <i>Development of physical models for the simulation of optical properties of solar cell modules</i>, <a href="https://www.tib.eu/en/search/id/TIBKAT%3A852464657">PhD. Thesis (2015)</a>"
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:
Expand Down
5 changes: 3 additions & 2 deletions database/data-nk/main/SiO2/Malitson.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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, <a href="https://doi.org/10.1364/JOSA.55.001205"><i>J. Opt. Soc. Am.</i> <b>55</b>, 1205-1208 (1965)</a><br>2) C. Z. Tan. Determination of refractive index of silica glass for infrared wavelengths by IR spectroscopy, <a href="https://doi.org/10.1016/S0022-3093(97)00438-9"><i>J. Non-Cryst. Solids</i> <b>223</b>, 158-163 (1998)</a><br>
<sup>*</sup> 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, <a href="https://doi.org/10.1364/JOSA.55.001205"><i>J. Opt. Soc. Am.</i> <b>55</b>, 1205-1208 (1965)</a><br>2) C. Z. Tan. Determination of refractive index of silica glass for infrared wavelengths by IR spectroscopy, <a href="https://doi.org/10.1016/S0022-3093(97)00438-9"><i>J. Non-Cryst. Solids</i> <b>223</b>, 158-163 (1998)</a><br>
<sup>*</sup> 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:
Expand Down
22 changes: 22 additions & 0 deletions tests/test_parse.py
Original file line number Diff line number Diff line change
@@ -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)