Skip to content

Commit

Permalink
Try to fix ICA Report (#12167)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoechenberger authored Nov 3, 2023
1 parent 70a915b commit 87d6be9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/changes/devel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Bugs
- Fix bug with :meth:`mne.viz.Brain.get_view` where calling :meth:`~mne.viz.Brain.show_view` with returned parameters would change the view (:gh:`12000` by `Eric Larson`_)
- Fix bug with :meth:`mne.viz.Brain.show_view` where ``distance=None`` would change the view distance (:gh:`12000` by `Eric Larson`_)
- Fix bug with :meth:`~mne.viz.Brain.add_annotation` when reading an annotation from a file with both hemispheres shown (:gh:`11946` by `Marijn van Vliet`_)
- Fix bug with reported component number and errant reporting of PCA explained variance as ICA explained variance in :meth:`mne.Report.add_ica` (:gh:`12155` by `Eric Larson`_)
- Fix bug with reported component number and errant reporting of PCA explained variance as ICA explained variance in :meth:`mne.Report.add_ica` (:gh:`12155`, :gh:`12167` by `Eric Larson`_ and `Richard Höchenberger`_)
- Fix bug with axis clip box boundaries in :func:`mne.viz.plot_evoked_topo` and related functions (:gh:`11999` by `Eric Larson`_)
- Fix bug with ``subject_info`` when loading data from and exporting to EDF file (:gh:`11952` by `Paul Roujansky`_)
- Fix bug where :class:`mne.Info` HTML representations listed all channel counts instead of good channel counts under the heading "Good channels" (:gh:`12145` by `Eric Larson`_)
Expand Down
8 changes: 5 additions & 3 deletions mne/report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,9 +587,6 @@ def _plot_ica_properties_as_arrays(*, ica, inst, picks, n_jobs):
"""
import matplotlib.pyplot as plt

if picks is None:
picks = list(range(ica.n_components_))

def _plot_one_ica_property(*, ica, inst, pick):
figs = ica.plot_properties(inst=inst, picks=pick, show=False)
assert len(figs) == 1
Expand Down Expand Up @@ -1666,9 +1663,14 @@ def _add_ica_properties(
)
return

if picks is None:
picks = list(range(ica.n_components_))

figs = _plot_ica_properties_as_arrays(
ica=ica, inst=inst, picks=picks, n_jobs=n_jobs
)
assert len(figs) == len(picks)

captions = []
for idx in range(len(figs)):
caption = f"ICA component {picks[idx]}."
Expand Down
1 change: 1 addition & 0 deletions mne/report/tests/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,7 @@ def test_manual_report_2d(tmp_path, invisible_fig):
inst=epochs_baseline,
picks=[0],
)
r.add_ica(ica=ica, title="my ica with picks=None", inst=epochs_baseline, picks=None)
r.add_covariance(cov=cov, info=raw_fname, title="my cov")
r.add_forward(
forward=fwd_fname,
Expand Down

0 comments on commit 87d6be9

Please sign in to comment.