-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix documentation typos * Correct faulty comparison * Implement Rouseel-Vanhellemont-Meas algorithm * Fix RVM algorithm * Disable Jansson code for now * Include new tests for mixture materials * Remove commented-out code
- Loading branch information
Showing
3 changed files
with
70 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
"""Tests for the different mixture models""" | ||
|
||
import pytest | ||
import elli | ||
import numpy as np | ||
|
||
|
||
material_list = [ | ||
("Si", "Aspnes"), | ||
("GaAs", "Aspnes"), | ||
("SiO2", "Malitson"), | ||
("CaF2", "Li"), | ||
("Rh", "Weaver"), | ||
("MoS2", "Song-1L"), | ||
] | ||
|
||
|
||
@pytest.fixture | ||
def RII(): | ||
RII = elli.db.RII() | ||
return RII | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"host_book, host_page", | ||
material_list, | ||
) | ||
@pytest.mark.parametrize( | ||
"guest_book, guest_page", | ||
material_list, | ||
) | ||
@pytest.mark.parametrize( | ||
"EMA", | ||
[ | ||
elli.LooyengaEMA, | ||
elli.MaxwellGarnettEMA, | ||
], | ||
) | ||
def test_mixture_models(host_book, host_page, guest_book, guest_page, EMA, RII): | ||
host_mat = RII.get_mat(host_book, host_page) | ||
guest_mat = RII.get_mat(guest_book, guest_page) | ||
|
||
lbda = np.arange(250, 800, 25) | ||
|
||
np.testing.assert_allclose( | ||
elli.BruggemanEMA(host_mat, guest_mat, 0.1).get_tensor(lbda), | ||
EMA(host_mat, guest_mat, 0.1).get_tensor(lbda), | ||
rtol=0.5, | ||
atol=0.5 + 0.5j, | ||
) |