Skip to content

Commit 8cfd708

Browse files
authored
Merge branch 'main' into cola5
2 parents 6d65b33 + 715540a commit 8cfd708

15 files changed

+37
-21
lines changed

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
repos:
22
# Ruff mne
33
- repo: https://github.com/astral-sh/ruff-pre-commit
4-
rev: v0.9.2
4+
rev: v0.9.3
55
hooks:
66
- id: ruff
77
name: ruff lint mne
@@ -23,7 +23,7 @@ repos:
2323

2424
# Codespell
2525
- repo: https://github.com/codespell-project/codespell
26-
rev: v2.3.0
26+
rev: v2.4.0
2727
hooks:
2828
- id: codespell
2929
additional_dependencies:

doc/changes/devel/13070.bugfix.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Return events when requested even when current matches the desired sfreq in :meth:`mne.io.Raw.resample` by :newcontrib:`Roy Eric Wieske`.

doc/changes/devel/13082.bugfix.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix bug with automated Mesa 3D detection for proper 3D option setting on systems with software rendering, by `Eric Larson`_.

doc/changes/names.inc

+1
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@
258258
.. _Roman Goj: https://romanmne.blogspot.co.uk
259259
.. _Ross Maddox: https://www.urmc.rochester.edu/labs/maddox-lab.aspx
260260
.. _Rotem Falach: https://github.com/Falach
261+
.. _Roy Eric Wieske: https://github.com/Randomidous
261262
.. _Sammi Chekroud: https://github.com/schekroud
262263
.. _Samu Taulu: https://phys.washington.edu/people/samu-taulu
263264
.. _Samuel Deslauriers-Gauthier: https://github.com/sdeslauriers

examples/preprocessing/movement_detection.py

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
##############################################################################
8282
# After checking the annotated movement artifacts, calculate the new transform
8383
# and plot it:
84+
8485
new_dev_head_t = compute_average_dev_head_t(raw, head_pos)
8586
raw.info["dev_head_t"] = new_dev_head_t
8687
fig = mne.viz.plot_alignment(

mne/_fiff/proj.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ def _has_eeg_average_ref_proj(
11001100

11011101

11021102
def _needs_eeg_average_ref_proj(info):
1103-
"""Determine if the EEG needs an averge EEG reference.
1103+
"""Determine if the EEG needs an average EEG reference.
11041104
11051105
This returns True if no custom reference has been applied and no average
11061106
reference projection is present in the list of projections.

mne/conftest.py

+1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ def pytest_configure(config: pytest.Config):
174174
# pandas
175175
ignore:\n*Pyarrow will become a required dependency of pandas.*:DeprecationWarning
176176
ignore:np\.find_common_type is deprecated.*:DeprecationWarning
177+
ignore:Python binding for RankQuantileOptions.*:
177178
# pyvista <-> NumPy 2.0
178179
ignore:__array_wrap__ must accept context and return_scalar arguments.*:DeprecationWarning
179180
# nibabel <-> NumPy 2.0

mne/io/base.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,10 @@ def resample(
13861386
sfreq = float(sfreq)
13871387
o_sfreq = float(self.info["sfreq"])
13881388
if _check_resamp_noop(sfreq, o_sfreq):
1389-
return self
1389+
if events is not None:
1390+
return self, events.copy()
1391+
else:
1392+
return self
13901393

13911394
# When no event object is supplied, some basic detection of dropped
13921395
# events is performed to generate a warning. Finding events can fail

mne/io/fiff/tests/test_raw_fiff.py

+10
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
concatenate_events,
2424
create_info,
2525
equalize_channels,
26+
events_from_annotations,
2627
find_events,
2728
make_fixed_length_epochs,
2829
pick_channels,
@@ -1318,6 +1319,15 @@ def test_crop():
13181319
assert raw.n_times - 1 == raw3.n_times
13191320

13201321

1322+
@testing.requires_testing_data
1323+
def test_resample_with_events():
1324+
"""Test resampling raws with events."""
1325+
raw = read_raw_fif(fif_fname)
1326+
raw.resample(250) # pretend raw is recorded at 250 Hz
1327+
events, _ = events_from_annotations(raw)
1328+
raw, events = raw.resample(250, events=events)
1329+
1330+
13211331
@testing.requires_testing_data
13221332
def test_resample_equiv():
13231333
"""Test resample (with I/O and multiple files)."""

mne/viz/_figure.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ def _redraw(self, update_data=True, annotations=False):
424424
if annotations and not self.mne.is_epochs:
425425
self._draw_annotations()
426426

427-
def _close(self, event):
427+
def _close(self, event=None):
428428
"""Handle close events (via keypress or window [x])."""
429429
from matplotlib.pyplot import close
430430

mne/viz/_mpl_figure.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def _inch_to_rel(self, dim_inches, horiz=True):
186186
class MNEAnnotationFigure(MNEFigure):
187187
"""Interactive dialog figure for annotations."""
188188

189-
def _close(self, event):
189+
def _close(self, event=None):
190190
"""Handle close events (via keypress or window [x])."""
191191
parent = self.mne.parent_fig
192192
# disable span selector
@@ -275,7 +275,7 @@ def _set_active_button(self, idx, *, draw=True):
275275
class MNESelectionFigure(MNEFigure):
276276
"""Interactive dialog figure for channel selections."""
277277

278-
def _close(self, event):
278+
def _close(self, event=None):
279279
"""Handle close events."""
280280
self.mne.parent_fig.mne.child_figs.remove(self)
281281
self.mne.fig_selection = None

mne/viz/backends/_pyvista.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ def _is_osmesa(plotter):
13441344
"surface rendering, consider upgrading to 18.3.6 or "
13451345
"later."
13461346
)
1347-
is_osmesa = "via llvmpipe" in gpu_info
1347+
is_osmesa = "llvmpipe" in gpu_info
13481348
return is_osmesa
13491349

13501350

mne/viz/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ def _onpick_sensor(event, fig, ax, pos, ch_names, show_names):
11851185
fig.canvas.draw()
11861186

11871187

1188-
def _close_event(event, fig):
1188+
def _close_event(event=None, fig=None):
11891189
"""Listen for sensor plotter close event."""
11901190
if getattr(fig, "lasso", None) is not None:
11911191
fig.lasso.disconnect()

tutorials/epochs/60_make_fixed_length_epochs.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
=================================================
66
77
This tutorial shows how to segment continuous data into a set of epochs spaced
8-
equidistantly in time. The epochs will not be created based on experimental
9-
events; instead, the continuous data will be "chunked" into consecutive epochs
10-
(which may be temporally overlapping, adjacent, or separated).
11-
We will also briefly demonstrate how to use these epochs in connectivity
12-
analysis.
8+
equidistantly in time. The epochs will not be created based on experimental events;
9+
instead, the continuous data will be "chunked" into consecutive epochs (which may be
10+
temporally overlapping, adjacent, or separated). We will also briefly demonstrate how
11+
to use these epochs in connectivity analysis.
1312
14-
First, we import necessary modules and read in a sample raw data set.
13+
First, we import the necessary modules and read in a sample raw data set.
1514
This data set contains brain activity that is event-related, i.e.,
1615
synchronized to the onset of auditory stimuli. However, rather than creating
1716
epochs by segmenting the data around the onset of each stimulus, we will

tutorials/evoked/10_evoked_overview.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
The Evoked data structure: evoked/averaged data
66
===============================================
77
8-
This tutorial covers the basics of creating and working with :term:`evoked`
9-
data. It introduces the :class:`~mne.Evoked` data structure in detail,
10-
including how to load, query, subset, export, and plot data from an
11-
:class:`~mne.Evoked` object. For details on creating an :class:`~mne.Evoked`
12-
object from (possibly simulated) data in a :class:`NumPy array
13-
<numpy.ndarray>`, see :ref:`tut-creating-data-structures`.
8+
This tutorial covers the basics of creating and working with :term:`evoked` data. It
9+
introduces the :class:`~mne.Evoked` data structure in detail, including how to load,
10+
query, subset, export, and plot data from an :class:`~mne.Evoked` object. For details
11+
on creating an :class:`~mne.Evoked` object from (possibly simulated) data in a
12+
:class:`NumPy array <numpy.ndarray>`, see :ref:`tut-creating-data-structures`.
1413
1514
As usual, we start by importing the modules we need:
1615
"""

0 commit comments

Comments
 (0)