Skip to content

Commit 440215e

Browse files
authored
Merge branch 'main' into fix-issue-11267
2 parents d4f57d7 + 4033b3a commit 440215e

File tree

15 files changed

+70
-65
lines changed

15 files changed

+70
-65
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
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.11.11
4+
rev: v0.11.12
55
hooks:
66
- id: ruff
77
name: ruff lint mne
@@ -40,7 +40,7 @@ repos:
4040

4141
# rstcheck
4242
- repo: https://github.com/rstcheck/rstcheck.git
43-
rev: v6.2.4
43+
rev: v6.2.5
4444
hooks:
4545
- id: rstcheck
4646
additional_dependencies:
@@ -82,7 +82,7 @@ repos:
8282

8383
# zizmor
8484
- repo: https://github.com/woodruffw/zizmor-pre-commit
85-
rev: v1.8.0
85+
rev: v1.9.0
8686
hooks:
8787
- id: zizmor
8888

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ stages:
113113
- bash: |
114114
set -e
115115
python -m pip install --progress-bar off --upgrade pip
116-
python -m pip install --progress-bar off "mne-qt-browser[opengl] @ git+https://github.com/mne-tools/mne-qt-browser.git" pyvista scikit-learn python-picard qtpy nibabel sphinx-gallery "PySide6!=6.8.0,!=6.8.0.1,!=6.8.1.1" pandas neo pymatreader antio defusedxml
116+
python -m pip install --progress-bar off "mne-qt-browser[opengl] @ git+https://github.com/mne-tools/mne-qt-browser.git" pyvista scikit-learn python-picard qtpy nibabel sphinx-gallery "PySide6!=6.8.0,!=6.8.0.1,!=6.8.1.1,!=6.9.1" pandas neo pymatreader antio defusedxml
117117
python -m pip uninstall -yq mne
118118
python -m pip install --progress-bar off --upgrade -e .[test]
119119
displayName: 'Install dependencies with pip'
@@ -203,7 +203,7 @@ stages:
203203
displayName: 'PyQt6'
204204
- bash: |
205205
set -eo pipefail
206-
python -m pip install "PySide6!=6.8.0,!=6.8.0.1"
206+
python -m pip install "PySide6!=6.8.0,!=6.8.0.1,!=6.9.1"
207207
mne sys_info -pd
208208
mne sys_info -pd | grep "qtpy .* (PySide6=.*)$"
209209
PYTEST_QT_API=PySide6 pytest ${TEST_OPTIONS}

doc/changes/devel/13276.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix bug with :func:`mne.simulation.simulate_raw` and :class:`mne.simulation.SourceSimulator` where using different head positions with ``head_pos`` and a BEM would raise an error, by `Eric Larson`_.

doc/changes/devel/13277.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update :func:`mne.viz.plot_alignment` and related functions to support PyVista deprecation of positional arguments by :newcontrib:`user27182`.

doc/changes/names.inc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
.. _Andrew Quinn: https://github.com/ajquinn
2323
.. _Aniket Pradhan: https://github.com/Aniket-Pradhan
2424
.. _Anna Padee: https://github.com/apadee/
25-
.. _Annalisa Pascarella: https://www.iac.cnr.it/personale/annalisa-pascarella
25+
.. _Annalisa Pascarella: https://github.com/annapasca
2626
.. _Anne-Sophie Dubarry: https://github.com/annesodub
2727
.. _Antoine Collas: https://www.antoinecollas.fr
2828
.. _Antoine Gauthier: https://github.com/Okamille
@@ -54,7 +54,7 @@
5454
.. _Cora Kim: https://github.com/kimcoco
5555
.. _Cristóbal Moënne-Loccoz: https://github.com/cmmoenne
5656
.. _Dan Wakeman: https://github.com/dgwakeman
57-
.. _Daniel Carlström Schad: https://github.com/Dod12
57+
.. _Daniel Carlström Schad: https://github.com/DanielCSchad
5858
.. _Daniel Hasegan: https://daniel.hasegan.com
5959
.. _Daniel McCloy: https://dan.mccloy.info
6060
.. _Daniel Strohmeier: https://github.com/joewalter
@@ -318,6 +318,7 @@
318318
.. _Toomas Erik Anijärv: https://www.toomaserikanijarv.com/
319319
.. _Tristan Stenner: https://github.com/tstenner/
320320
.. _Tziona NessAiver: https://github.com/TzionaN
321+
.. _user27182: https://github.com/user27182
321322
.. _Valerii Chirkov: https://github.com/vagechirkov
322323
.. _Velu Prabhakar Kumaravel: https://github.com/vpKumaravel
323324
.. _Victor Ferat: https://github.com/vferat

doc/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,8 @@ def fix_sklearn_inherited_docstrings(app, what, name, obj, options, lines):
664664
"https://doi.org/10.1167/", # jov.arvojournals.org
665665
"https://doi.org/10.1177/", # journals.sagepub.com
666666
"https://doi.org/10.3109/", # www.tandfonline.com
667+
"https://hms.harvard.edu/", # doc/funding.rst
668+
"https://stackoverflow.com/questions/21752259/python-why-pickle", # doc/help/faq
667669
"https://www.biorxiv.org/content/10.1101/", # biorxiv.org
668670
"https://www.researchgate.net/profile/",
669671
"https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html",
@@ -675,6 +677,8 @@ def fix_sklearn_inherited_docstrings(app, what, name, obj, options, lines):
675677
"https://sourceforge.net/projects/ezwinports/files/",
676678
"https://www.mathworks.com/products/compiler/matlab-runtime.html",
677679
"https://medicine.umich.edu/dept/khri/ross-maddox-phd",
680+
# TODO https://github.com/mne-tools/curry-python-reader/issues/5
681+
"https://github.com/mne-tools/curry-python-reader/README.md",
678682
# 500 server error
679683
"https://openwetware.org/wiki/Beauchamp:FreeSurfer",
680684
# 503 Server error

doc/martinos.rst

Lines changed: 0 additions & 37 deletions
This file was deleted.

mne/chpi.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ def read_head_pos(fname):
9999
100100
Returns
101101
-------
102-
pos : array, shape (N, 10)
102+
quats : array, shape (n_pos, 10)
103103
The position and quaternion parameters from cHPI fitting.
104+
See :func:`mne.chpi.compute_head_pos` for details on the columns.
104105
105106
See Also
106107
--------
@@ -126,8 +127,9 @@ def write_head_pos(fname, pos):
126127
----------
127128
fname : path-like
128129
The filename to write.
129-
pos : array, shape (N, 10)
130+
pos : array, shape (n_pos, 10)
130131
The position and quaternion parameters from cHPI fitting.
132+
See :func:`mne.chpi.compute_head_pos` for details on the columns.
131133
132134
See Also
133135
--------
@@ -141,7 +143,9 @@ def write_head_pos(fname, pos):
141143
_check_fname(fname, overwrite=True)
142144
pos = np.array(pos, np.float64)
143145
if pos.ndim != 2 or pos.shape[1] != 10:
144-
raise ValueError("pos must be a 2D array of shape (N, 10)")
146+
raise ValueError(
147+
f"pos must be a 2D array of shape (N, 10), got shape {pos.shape}"
148+
)
145149
with open(fname, "wb") as fid:
146150
fid.write(
147151
" Time q1 q2 q3 q4 q5 "
@@ -157,16 +161,17 @@ def head_pos_to_trans_rot_t(quats):
157161
158162
Parameters
159163
----------
160-
quats : ndarray, shape (N, 10)
164+
quats : ndarray, shape (n_pos, 10)
161165
MaxFilter-formatted position and quaternion parameters.
166+
See :func:`mne.chpi.read_head_pos` for details on the columns.
162167
163168
Returns
164169
-------
165-
translation : ndarray, shape (N, 3)
170+
translation : ndarray, shape (n_pos, 3)
166171
Translations at each time point.
167-
rotation : ndarray, shape (N, 3, 3)
172+
rotation : ndarray, shape (n_pos, 3, 3)
168173
Rotations at each time point.
169-
t : ndarray, shape (N,)
174+
t : ndarray, shape (n_pos,)
170175
The time points.
171176
172177
See Also
@@ -929,7 +934,8 @@ def compute_head_pos(
929934
Returns
930935
-------
931936
quats : ndarray, shape (n_pos, 10)
932-
The ``[t, q1, q2, q3, x, y, z, gof, err, v]`` for each fit.
937+
MaxFilter-formatted head position parameters. The columns correspond to
938+
``[t, q1, q2, q3, x, y, z, gof, err, v]`` for each time point.
933939
934940
See Also
935941
--------

mne/commands/tests/test_commands.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import glob
66
import os
7+
import platform
78
import shutil
89
from os import path as op
910
from pathlib import Path
@@ -102,8 +103,12 @@ def test_compare_fiff():
102103
check_usage(mne_compare_fiff)
103104

104105

106+
# should match ".*valid tag.*" but conda-linux intermittently fails for some reason
107+
@pytest.mark.filterwarnings("ignore:Invalid tag.*:RuntimeWarning")
105108
def test_show_fiff(tmp_path):
106109
"""Test mne compare_fiff."""
110+
if os.getenv("MNE_CI_KIND", "") == "conda" and platform.system() == "Linux":
111+
pytest.skip("Skipping test on conda-linux due to intermittent failures")
107112
check_usage(mne_show_fiff)
108113
with ArgvSetter((raw_fname,)):
109114
mne_show_fiff.run()
@@ -112,9 +117,7 @@ def test_show_fiff(tmp_path):
112117
bad_fname = tmp_path / "test_bad_raw.fif"
113118
with open(bad_fname, "wb") as fout, open(raw_fname, "rb") as fin:
114119
fout.write(fin.read(100000))
115-
# should match ".*valid tag.*" but conda-linux intermittently fails for some reason
116-
with _record_warnings():
117-
lines = show_fiff(bad_fname, output=list)
120+
lines = show_fiff(bad_fname, output=list)
118121
last_line = lines[-1]
119122
assert last_line.endswith(">>>>BAD @9015")
120123
assert "302 = FIFF_EPOCH (734412b >f4)" in last_line

mne/forward/_compute_forward.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def _dup_coil_set(coils, coord_frame, t):
3535
if t is not None:
3636
coord_frame = t["to"]
3737
for coil in coils:
38+
assert isinstance(coil, dict), f"Coil must be a dict, got {type(coil)}"
3839
for key in ("ex", "ey", "ez"):
3940
if key in coil:
4041
coil[key] = apply_trans(t["trans"], coil[key], False)
@@ -794,6 +795,7 @@ def _compute_forwards_meeg(rr, *, sensors, fwd_data, n_jobs, silent=False):
794795
mri_Q, bem_rr, fun = fwd_data["mri_Q"], fwd_data["bem_rr"], fwd_data["fun"]
795796
solutions = fwd_data["solutions"]
796797
del fwd_data
798+
rr = np.ascontiguousarray(rr) # usually true but not guaranteed, e.g. in dipole.py
797799
for coil_type, sens in sensors.items():
798800
coils = sens["defs"]
799801
compensator = sens.get("compensator", None)
@@ -835,6 +837,9 @@ def _compute_forwards(rr, *, bem, sensors, n_jobs, verbose=None):
835837
solver = bem.get("solver", "mne")
836838
_check_option("solver", solver, ("mne", "openmeeg"))
837839
if bem["is_sphere"] or solver == "mne":
840+
# This modifies "sensors" in place, so let's copy it in case the calling
841+
# function needs to reuse it (e.g., in simulate_raw.py)
842+
sensors = deepcopy(sensors)
838843
fwd_data = _prep_field_computation(rr, sensors=sensors, bem=bem, n_jobs=n_jobs)
839844
Bs = _compute_forwards_meeg(
840845
rr, sensors=sensors, fwd_data=fwd_data, n_jobs=n_jobs

0 commit comments

Comments
 (0)