Skip to content

Commit 201869e

Browse files
committed
error shading tests
1 parent bd38137 commit 201869e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

fooof/tests/plts/test_error.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Tests for fooof.plts.error."""
22

3+
from pytest import raises, mark, param
4+
35
import numpy as np
46

57
from fooof.tests.tutils import plot_test
@@ -16,3 +18,20 @@ def test_plot_spectral_error(skip_if_no_mpl):
1618
errs = np.ones(len(fs))
1719

1820
plot_spectral_error(fs, errs)
21+
22+
23+
@plot_test
24+
def test_plot_error_shade(skip_if_no_mpl, tfg):
25+
26+
freqs = tfg.freqs
27+
powers = tfg.power_spectra
28+
29+
# Invalid 1d array, without shade
30+
with raises(ValueError):
31+
plot_error_shade(freqs, powers[0])
32+
33+
# Valid 1d array with shade
34+
plot_error_shade(freqs, np.mean(powers, axis=0), shade=np.std(powers, axis=0))
35+
36+
# 2d array
37+
plot_error_shade(freqs, powers)

0 commit comments

Comments
 (0)