Skip to content

Commit e8040d9

Browse files
authored
Update spectral_factor tests to specify integration_limit. (#11)
Default behaviour of the spectral_factor function changed when the integration_limit parameter was added.
1 parent da4eec4 commit e8040d9

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

pvpltools/test/test_iec61853.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_convert_to_banded():
2929

3030

3131
def test_calc_spectral_factor():
32-
# TODO: @Anton, review atol values in all assert_allclose calls (6 total)
32+
3333
# make three test spectra
3434
bi0 = np.array(BANDED_AM15G)
3535
bi1 = bi0 * np.linspace(1.1, 0.5, 29) # blue enhanced
@@ -40,34 +40,34 @@ def test_calc_spectral_factor():
4040
# flat SR beyond limits
4141
sr = pd.Series([1.0, 1.0], [200, 5000])
4242
bsr = convert_to_banded(sr)
43-
smm = calc_spectral_factor(bi, bsr)
44-
assert_allclose(smm, [1, 1, 1], atol=1e-2)
43+
smm = calc_spectral_factor(bi, bsr, integration_limit=28)
44+
assert_allclose(smm, [1, 1, 1])
4545

4646
# flat SR exactly to limits
4747
sr = pd.Series([1.0, 1.0],
4848
[SPECTRAL_BAND_EDGES[0], SPECTRAL_BAND_EDGES[-2]])
4949
bsr = convert_to_banded(sr)
50-
smm = calc_spectral_factor(bi, bsr)
51-
assert_allclose(smm, [1, 1, 1], atol=1e-2)
50+
smm = calc_spectral_factor(bi, bsr, integration_limit=28)
51+
assert_allclose(smm, [1, 1, 1])
5252

5353
# flat SR in Si range
5454
sr = pd.Series([1.0, 1.0], [300, 1200])
5555
bsr = convert_to_banded(sr)
56-
smm = calc_spectral_factor(bi, bsr)
57-
assert_allclose(smm, [1., 1.04744717, 0.94786063], atol=1e-2)
56+
smm = calc_spectral_factor(bi, bsr, integration_limit=28)
57+
assert_allclose(smm, [1., 1.04744717, 0.94786063])
5858

5959
# sawtooth SR in Si range
6060
sr = pd.Series([0.1, 1.0, 0.0], [300, 1000, 1200])
6161
bsr = convert_to_banded(sr)
62-
smm = calc_spectral_factor(bi, bsr)
63-
assert_allclose(smm, [1., 1.00059311, 0.99934824], atol=1e-2)
62+
smm = calc_spectral_factor(bi, bsr, integration_limit=28)
63+
assert_allclose(smm, [1., 1.00059311, 0.99934824])
6464

6565
# scaling doesn't make a difference
66-
smm = calc_spectral_factor(bi, bsr * 3)
67-
assert_allclose(smm, [1., 1.00059311, 0.99934824], atol=1e-2)
66+
smm = calc_spectral_factor(bi, bsr * 3, integration_limit=28)
67+
assert_allclose(smm, [1., 1.00059311, 0.99934824])
6868

69-
smm = calc_spectral_factor(bi * 2, bsr)
70-
assert_allclose(smm, [1., 1.00059311, 0.99934824], atol=1e-2)
69+
smm = calc_spectral_factor(bi * 2, bsr, integration_limit=28)
70+
assert_allclose(smm, [1., 1.00059311, 0.99934824])
7171

7272

7373
def test_BilinearInterpolator():

0 commit comments

Comments
 (0)