Skip to content

Commit 1c68900

Browse files
committed
DOC/TEST: Update report tutorial and tests for rank parameter
1 parent d784905 commit 1c68900

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

mne/report/tests/test_report.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,3 +1360,17 @@ def test_gif(tmp_path):
13601360
bad_name.write_bytes(b"")
13611361
with pytest.raises(ValueError, match="Allowed values"):
13621362
r.add_image(bad_name, "fname")
1363+
1364+
def test_add_covariance_rank():
1365+
from mne import create_info
1366+
from mne.cov import make_ad_hoc_cov
1367+
from mne.report import Report
1368+
1369+
info = create_info(ch_names=["EEG 001"], sfreq=1000, ch_types=["eeg"])
1370+
cov = make_ad_hoc_cov(info)
1371+
1372+
report = Report()
1373+
report.add_covariance(cov, info=info, title="Test Cov", rank=1)
1374+
1375+
html = "".join(report.html)
1376+
assert "Rank" in html

tutorials/intro/70_report.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,16 @@
164164
cov_path = sample_dir / "sample_audvis-cov.fif"
165165

166166
report = mne.Report(title="Covariance example")
167-
report.add_covariance(cov=cov_path, info=raw_path, title="Covariance")
167+
168+
# Optionally display the covariance rank in the report
169+
rank = 60
170+
171+
report.add_covariance(
172+
cov,
173+
info=info,
174+
title="Noise covariance",
175+
rank=rank,
176+
)
168177
report.save("report_cov.html", overwrite=True)
169178

170179
# %%

0 commit comments

Comments
 (0)