Skip to content

Commit

Permalink
Merge branch 'main' into add_tfr_weights
Browse files Browse the repository at this point in the history
  • Loading branch information
tsbinns authored Oct 24, 2024
2 parents b4537b2 + c63da99 commit f155238
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/changes/devel/12909.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug in :func:`mne.io.read_raw_gdf` when NumPy >= 2 is used, by `Clemens Brunner`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12912.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added the ``psd_args`` argument to :func:`mne.viz.plot_ica_sources` and :meth:`mne.preprocessing.ICA.plot_sources`, by `Richard Scholz`_.
2 changes: 1 addition & 1 deletion mne/io/edf/edf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ def _read_gdf_header(fname, exclude, include=None):
ne = np.fromfile(fid, UINT8, 3)
n_events = ne[0]
for i in range(1, len(ne)):
n_events = n_events + ne[i] * 2 ** (i * 8)
n_events = n_events + int(ne[i]) * 2 ** (i * 8)
event_sr = np.fromfile(fid, FLOAT32, 1)[0]

pos = np.fromfile(fid, UINT32, n_events) - 1 # 1-based inds
Expand Down
2 changes: 2 additions & 0 deletions mne/preprocessing/ica.py
Original file line number Diff line number Diff line change
Expand Up @@ -2588,6 +2588,7 @@ def plot_sources(
precompute=None,
use_opengl=None,
*,
psd_args=None,
theme=None,
overview_mode=None,
splash=True,
Expand All @@ -2601,6 +2602,7 @@ def plot_sources(
title=title,
show=show,
block=block,
psd_args=psd_args,
show_first_samp=show_first_samp,
show_scrollbars=show_scrollbars,
time_format=time_format,
Expand Down
1 change: 1 addition & 0 deletions mne/viz/_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ def _create_ica_properties_fig(self, idx):
self.mne.ica_inst,
picks=pick,
axes=axes,
psd_args=self.mne.psd_args,
precomputed_data=self.mne.data_ica_properties,
show=False,
)
Expand Down
10 changes: 10 additions & 0 deletions mne/viz/ica.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def plot_ica_sources(
precompute=None,
use_opengl=None,
*,
psd_args=None,
theme=None,
overview_mode=None,
splash=True,
Expand Down Expand Up @@ -91,6 +92,12 @@ def plot_ica_sources(
%(time_format)s
%(precompute)s
%(use_opengl)s
psd_args : dict | None
Dictionary of arguments to pass to :meth:`~mne.Epochs.compute_psd` in
interactive mode. Ignored if ``inst`` is not supplied. If ``None``,
nothing is passed. Defaults to ``None``.
.. versionadded:: 1.9
%(theme_pg)s
.. versionadded:: 1.0
Expand Down Expand Up @@ -133,6 +140,7 @@ def plot_ica_sources(
show=show,
title=title,
block=block,
psd_args=psd_args,
show_first_samp=show_first_samp,
show_scrollbars=show_scrollbars,
time_format=time_format,
Expand Down Expand Up @@ -1284,6 +1292,7 @@ def _plot_sources(
precompute,
use_opengl,
*,
psd_args,
theme=None,
overview_mode=None,
splash=True,
Expand Down Expand Up @@ -1431,6 +1440,7 @@ def _plot_sources(
use_opengl=use_opengl,
theme=theme,
overview_mode=overview_mode,
psd_args=psd_args,
splash=splash,
)
if is_epo:
Expand Down
3 changes: 3 additions & 0 deletions mne/viz/tests/test_ica.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@ def test_plot_ica_sources(raw_orig, browser_backend, monkeypatch):
leg = ax.get_legend()
assert len(leg.get_texts()) == len(ica.exclude) == 1

# test passing psd_args argument
ica.plot_sources(epochs, psd_args=dict(fmax=50))

# plot with bad channels excluded
ica.exclude = [0]
ica.plot_sources(evoked)
Expand Down

0 comments on commit f155238

Please sign in to comment.