Skip to content

Commit

Permalink
Merge branch 'main' into hed-annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
VisLab authored Jan 31, 2025
2 parents c31e837 + 715540a commit a593841
Show file tree
Hide file tree
Showing 184 changed files with 2,941 additions and 1,110 deletions.
9 changes: 8 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ jobs:
- restore_cache:
keys:
- data-cache-phantom-kit
- restore_cache:
keys:
- data-cache-ds004388
- run:
name: Get data
# This limit could be increased, but this is helpful for finding slow ones
Expand Down Expand Up @@ -252,7 +255,7 @@ jobs:
name: Check sphinx log for warnings (which are treated as errors)
when: always
command: |
! grep "^.* (WARNING|ERROR): .*$" sphinx_log.txt
! grep "^.*\(WARNING\|ERROR\): " sphinx_log.txt
- run:
name: Show profiling output
when: always
Expand Down Expand Up @@ -393,6 +396,10 @@ jobs:
key: data-cache-phantom-kit
paths:
- ~/mne_data/MNE-phantom-KIT-data # (1 G)
- save_cache:
key: data-cache-ds004388
paths:
- ~/mne_data/ds004388 # (1.8 G)


linkcheck:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
- run: pip install --upgrade towncrier pygithub gitpython numpy
- run: python ./.github/actions/rename_towncrier/rename_towncrier.py
- run: python ./tools/dev/ensure_headers.py
- uses: autofix-ci/action@ff86a557419858bb967097bfc916833f5647fa8c
- uses: autofix-ci/action@551dded8c6cc8a1054039c8bc0b8b48c51dfc6ef
3 changes: 3 additions & 0 deletions .github/workflows/check_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on: # yamllint disable-line rule:truthy
types: [opened, synchronize, labeled, unlabeled]
branches: ["main"]

permissions:
contents: read

jobs:
changelog_checker:
name: Check towncrier entry in doc/changes/devel/
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/circle_artifacts.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
on: [status] # yamllint disable-line rule:truthy
permissions:
contents: read
statuses: write
jobs:
circleci_artifacts_redirector_job:
if: "${{ startsWith(github.event.context, 'ci/circleci: build_docs') }}"
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
# Ruff mne
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
rev: v0.9.3
hooks:
- id: ruff
name: ruff lint mne
Expand All @@ -23,7 +23,7 @@ repos:

# Codespell
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.0
hooks:
- id: codespell
additional_dependencies:
Expand Down Expand Up @@ -82,7 +82,7 @@ repos:

# zizmor
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.0.0
rev: v1.2.2
hooks:
- id: zizmor

Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ stages:
- bash: |
set -e
python -m pip install --progress-bar off --upgrade pip
python -m pip install --progress-bar off "mne-qt-browser[opengl] @ git+https://github.com/mne-tools/mne-qt-browser.git@main" pyvista scikit-learn python-picard qtpy nibabel sphinx-gallery "PySide6!=6.8.0,!=6.8.0.1" pandas neo pymatreader antio defusedxml
python -m pip install --progress-bar off "mne-qt-browser[opengl] @ git+https://github.com/mne-tools/mne-qt-browser.git@main" 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
python -m pip uninstall -yq mne
python -m pip install --progress-bar off --upgrade -e .[test]
displayName: 'Install dependencies with pip'
Expand Down Expand Up @@ -243,7 +243,7 @@ stages:
PYTHONIOENCODING: 'utf-8'
AZURE_CI_WINDOWS: 'true'
PYTHON_ARCH: 'x64'
timeoutInMinutes: 75
timeoutInMinutes: 80
strategy:
maxParallel: 4
matrix:
Expand Down
1 change: 1 addition & 0 deletions doc/api/datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Datasets
brainstorm.bst_auditory.data_path
brainstorm.bst_resting.data_path
brainstorm.bst_raw.data_path
default_path
eegbci.load_data
eegbci.standardize
fetch_aparc_sub_parcellation
Expand Down
1 change: 1 addition & 0 deletions doc/api/preprocessing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Projections:
read_ica_eeglab
read_fine_calibration
write_fine_calibration
apply_pca_obs

:py:mod:`mne.preprocessing.nirs`:

Expand Down
2 changes: 2 additions & 0 deletions doc/api/time_frequency.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Functions that operate on mne-python objects:
.. autosummary::
:toctree: ../generated/

combine_spectrum
combine_tfr
csd_tfr
csd_fourier
csd_multitaper
Expand Down
1 change: 1 addition & 0 deletions doc/changes/devel/12071.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add new ``select`` parameter to :func:`mne.viz.plot_evoked_topo` and :meth:`mne.Evoked.plot_topo` to toggle lasso selection of sensors, by `Marijn van Vliet`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12656.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug where :func:`mne.export.export_raw` does not correct for recording start time (:attr:`raw.first_time <mne.io.Raw.first_time>`) when exporting Raw instances to EDF or EEGLAB formats, by `Qian Chu`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12910.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added the option to return taper weights from :func:`mne.time_frequency.tfr_array_multitaper`, and taper weights are now stored in the :class:`mne.time_frequency.BaseTFR` objects, by `Thomas Binns`_.
1 change: 1 addition & 0 deletions doc/changes/devel/13037.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add PCA-OBS preprocessing for the removal of heart-artefacts from EEG or ESG datasets via :func:`mne.preprocessing.apply_pca_obs`, by :newcontrib:`Emma Bailey` and :newcontrib:`Steinn Hauser Magnusson`.
1 change: 1 addition & 0 deletions doc/changes/devel/13054.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added :func:`mne.time_frequency.combine_tfr` to allow combining TFRs across tapers, by `Thomas Binns`_.
1 change: 1 addition & 0 deletions doc/changes/devel/13056.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug with saving of anonymized data when helium info is present in measurement info, by `Eric Larson`_.
1 change: 1 addition & 0 deletions doc/changes/devel/13058.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add the function :func:`mne.time_frequency.combine_spectrum` for combining data across :class:`mne.time_frequency.Spectrum` objects, and allow :func:`mne.grand_average` to operate on :class:`mne.time_frequency.Spectrum` objects, by `Thomas Binns`_.
1 change: 1 addition & 0 deletions doc/changes/devel/13062.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix computation of time intervals in :func:`mne.preprocessing.compute_fine_calibration` by `Eric Larson`_.
1 change: 1 addition & 0 deletions doc/changes/devel/13063.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug in the colorbars created by :func:`mne.viz.plot_evoked_topomap` by `Santeri Ruuskanen`_.
7 changes: 7 additions & 0 deletions doc/changes/devel/13065.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Improved sklearn class compatibility and compliance, which resulted in some parameters of classes having an underscore appended to their name during ``fit``, such as:

- :class:`mne.decoding.FilterEstimator` parameter ``picks`` passed to the initializer is set as ``est.picks_``
- :class:`mne.decoding.UnsupervisedSpatialFilter` parameter ``estimator`` passed to the initializer is set as ``est.estimator_``

Unused ``verbose`` class parameters (that had no effect) were removed from :class:`~mne.decoding.PSDEstimator`, :class:`~mne.decoding.TemporalFilter`, and :class:`~mne.decoding.FilterEstimator` as well.
Changes by `Eric Larson`_.
1 change: 1 addition & 0 deletions doc/changes/devel/13067.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug where taper weights were not correctly applied when computing multitaper power with :meth:`mne.Epochs.compute_tfr` and :func:`mne.time_frequency.tfr_array_multitaper`, by `Thomas Binns`_.
1 change: 1 addition & 0 deletions doc/changes/devel/13069.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug cause by unnecessary assertion when loading mixed frequency EDFs without preloading :func:`mne.io.read_raw_edf` by `Simon Kern`_.
1 change: 1 addition & 0 deletions doc/changes/devel/13070.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Return events when requested even when current matches the desired sfreq in :meth:`mne.io.Raw.resample` by :newcontrib:`Roy Eric Wieske`.
1 change: 1 addition & 0 deletions doc/changes/devel/13082.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug with automated Mesa 3D detection for proper 3D option setting on systems with software rendering, by `Eric Larson`_.
3 changes: 3 additions & 0 deletions doc/changes/names.inc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
.. _Eberhard Eich: https://github.com/ebeich
.. _Eduard Ort: https://github.com/eort
.. _Emily Stephen: https://github.com/emilyps14
.. _Emma Bailey: https://www.cbs.mpg.de/employees/bailey
.. _Enrico Varano: https://github.com/enricovara/
.. _Enzo Altamiranda: https://www.linkedin.com/in/enzoalt
.. _Eric Larson: https://larsoner.com
Expand Down Expand Up @@ -257,6 +258,7 @@
.. _Roman Goj: https://romanmne.blogspot.co.uk
.. _Ross Maddox: https://www.urmc.rochester.edu/labs/maddox-lab.aspx
.. _Rotem Falach: https://github.com/Falach
.. _Roy Eric Wieske: https://github.com/Randomidous
.. _Sammi Chekroud: https://github.com/schekroud
.. _Samu Taulu: https://phys.washington.edu/people/samu-taulu
.. _Samuel Deslauriers-Gauthier: https://github.com/sdeslauriers
Expand Down Expand Up @@ -284,6 +286,7 @@
.. _Stanislas Chambon: https://github.com/Slasnista
.. _Stefan Appelhoff: https://stefanappelhoff.com
.. _Stefan Repplinger: https://github.com/stfnrpplngr
.. _Steinn Hauser Magnusson: https://github.com/steinnhauser
.. _Steven Bethard: https://github.com/bethard
.. _Steven Bierer: https://github.com/neurolaunch
.. _Steven Gutstein: https://github.com/smgutstein
Expand Down
3 changes: 2 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@
"n_frequencies",
"n_tests",
"n_samples",
"n_peaks",
"n_permutations",
"nchan",
"n_points",
Expand Down Expand Up @@ -1289,7 +1290,7 @@ def fix_sklearn_inherited_docstrings(app, what, name, obj, options, lines):
rst_prolog += f"""
.. |{icon}| raw:: html
<i class="{' '.join(classes + (f'fa-{icon}',))}"></i>
<i class="{" ".join(classes + (f"fa-{icon}",))}"></i>
"""

rst_prolog += """
Expand Down
10 changes: 10 additions & 0 deletions doc/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,16 @@ @inproceedings{NdiayeEtAl2016
year = {2016}
}

@article{NiazyEtAl2005,
author = {Niazy, R. K. and Beckmann, C.F. and Iannetti, G.D. and Brady, J. M. and Smith, S. M.},
title = {Removal of FMRI environment artifacts from EEG data using optimal basis sets},
journal = {NeuroImage},
year = {2005},
volume = {28},
pages = {720-737},
doi = {10.1016/j.neuroimage.2005.06.067.}
}

@article{NicholsHolmes2002,
author = {Nichols, Thomas E. and Holmes, Andrew P.},
doi = {10.1002/hbm.1058},
Expand Down
8 changes: 4 additions & 4 deletions doc/sphinxext/credit_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def generate_credit_rst(app=None, *, verbose=False):
if author["e"] is not None:
if author["e"] not in name_map:
unknown_emails.add(
f'{author["e"].ljust(29)} '
f"{author['e'].ljust(29)} "
"https://github.com/mne-tools/mne-python/pull/"
f"{commit}/files"
)
Expand All @@ -178,9 +178,9 @@ def generate_credit_rst(app=None, *, verbose=False):
else:
name = author["n"]
if name in manual_renames:
assert _good_name(
manual_renames[name]
), f"Bad manual rename: {name}"
assert _good_name(manual_renames[name]), (
f"Bad manual rename: {name}"
)
name = manual_renames[name]
if " " in name:
first, last = name.rsplit(" ", maxsplit=1)
Expand Down
2 changes: 2 additions & 0 deletions doc/sphinxext/mne_doc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def reset_warnings(gallery_conf, fname):
r"numpy\.core is deprecated and has been renamed to numpy\._core",
# matplotlib
"__array_wrap__ must accept context and return_scalar.*",
# nibabel
"__array__ implementation doesn't accept.*",
):
warnings.filterwarnings( # deal with other modules having bad imports
"ignore", message=f".*{key}.*", category=DeprecationWarning
Expand Down
30 changes: 19 additions & 11 deletions doc/sphinxext/related_software.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,17 @@ def _get_packages() -> dict[str, str]:
assert not dups, f"Duplicates in MANUAL_PACKAGES and PYPI_PACKAGES: {sorted(dups)}"
# And the installer and PyPI-only should be disjoint:
dups = set(PYPI_PACKAGES) & set(packages)
assert (
not dups
), f"Duplicates in PYPI_PACKAGES and installer packages: {sorted(dups)}"
assert not dups, (
f"Duplicates in PYPI_PACKAGES and installer packages: {sorted(dups)}"
)
for name in PYPI_PACKAGES | set(MANUAL_PACKAGES):
if name not in packages:
packages.append(name)
# Simple alphabetical order
packages = sorted(packages, key=lambda x: x.lower())
packages = [RENAMES.get(package, package) for package in packages]
out = dict()
reasons = []
for package in status_iterator(
packages, f"Adding {len(packages)} related software packages: "
):
Expand All @@ -183,12 +184,17 @@ def _get_packages() -> dict[str, str]:
else:
md = importlib.metadata.metadata(package)
except importlib.metadata.PackageNotFoundError:
pass # raise a complete error later
reasons.append(f"{package}: not found, needs to be installed")
continue # raise a complete error later
else:
# Every project should really have this
do_continue = False
for key in ("Summary",):
if key not in md:
raise ExtensionError(f"Missing {repr(key)} for {package}")
reasons.extend(f"{package}: missing {repr(key)}")
do_continue = True
if do_continue:
continue
# It is annoying to find the home page
url = None
if "Home-page" in md:
Expand All @@ -204,15 +210,17 @@ def _get_packages() -> dict[str, str]:
if url is not None:
break
else:
raise RuntimeError(
f"Could not find Home-page for {package} in:\n"
f"{sorted(set(md))}\nwith Summary:\n{md['Summary']}"
reasons.append(
f"{package}: could not find Home-page in {sorted(md)}"
)
continue
out[package]["url"] = url
out[package]["description"] = md["Summary"].replace("\n", "")
bad = [package for package in packages if not out[package]]
if bad and REQUIRE_METADATA:
raise ExtensionError(f"Could not find metadata for:\n{' '.join(bad)}")
reason_str = "\n".join(reasons)
if reason_str and REQUIRE_METADATA:
raise ExtensionError(
f"Could not find suitable metadata for related software:\n{reason_str}"
)

return out

Expand Down
3 changes: 1 addition & 2 deletions doc/sphinxext/unit_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ def unit_role(name, rawtext, text, lineno, inliner, options={}, content=[]): #

def pass_error_to_sphinx(rawtext, text, lineno, inliner):
msg = inliner.reporter.error(
"The :unit: role requires a space-separated number and unit; "
f"got {text}",
f"The :unit: role requires a space-separated number and unit; got {text}",
line=lineno,
)
prb = inliner.problematic(rawtext, rawtext, msg)
Expand Down
2 changes: 1 addition & 1 deletion examples/decoding/linear_model_patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

# Extract and plot spatial filters and spatial patterns
for name, coef in (("patterns", model.patterns_), ("filters", model.filters_)):
# We fitted the linear model onto Z-scored data. To make the filters
# We fit the linear model on Z-scored data. To make the filters
# interpretable, we must reverse this normalization step
coef = scaler.inverse_transform([coef])[0]

Expand Down
2 changes: 1 addition & 1 deletion examples/inverse/vector_mne_solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
# inverse was computed with loose=0.2
print(
"Absolute cosine similarity between source normals and directions: "
f'{np.abs(np.sum(directions * inv["source_nn"][2::3], axis=-1)).mean()}'
f"{np.abs(np.sum(directions * inv['source_nn'][2::3], axis=-1)).mean()}"
)
brain_max = stc_max.plot(
initial_time=peak_time,
Expand Down
Loading

0 comments on commit a593841

Please sign in to comment.