Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into feature/TD-nirs_snirf
Browse files Browse the repository at this point in the history
* upstream/main:
  eegbci api: allow downloading multiple subjects (#12918)
  DOC: Document Linux desktop workaround (#12900)
  Allow exporting edf where a channel contains only constant values (#12911)
  Autogenerate environment.yml file from pyproject.toml (#12914)
  • Loading branch information
larsoner committed Oct 28, 2024
2 parents b3b3f2e + e15292f commit 9723621
Show file tree
Hide file tree
Showing 24 changed files with 329 additions and 136 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ jobs:
create-args: >-
python=${{ env.PYTHON_VERSION }}
mamba
nomkl
if: ${{ !startswith(matrix.kind, 'pip') }}
# Make sure we have the right Python
- run: python -c "import platform; assert platform.machine() == 'arm64', platform.machine()"
Expand Down
9 changes: 8 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,17 @@ repos:
files: pyproject.toml

# dependencies
- repo: local
hooks:
- id: update-env-file
name: Copy dependency changes from pyproject.toml to environment.yml
language: python
entry: ./tools/hooks/update_environment_file.py
files: pyproject.toml
- repo: local
hooks:
- id: dependency-sync
name: Sync dependency list between pyproject.toml and README.rst
name: Copy core dependencies from pyproject.toml to README.rst
language: python
entry: ./tools/hooks/sync_dependencies.py
files: pyproject.toml
Expand Down
Binary file added doc/_static/default_linux_dock_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/_static/mne_python_dock_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions doc/changes/devel/12911.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow exporting edf where a channel contains only constant values, by `Florian Hofer`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12918.apichange.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deprecate ``subject`` parameter in favor of ``subjects`` in :func:`mne.datasets.eegbci.load_data`, by `Stefan Appelhoff`_.
18 changes: 12 additions & 6 deletions doc/documentation/datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,23 @@ EEGBCI motor imagery
====================
:func:`mne.datasets.eegbci.load_data`

The EEGBCI dataset is documented in :footcite:`SchalkEtAl2004`. The data set is
available at PhysioNet :footcite:`GoldbergerEtAl2000`. The dataset contains
64-channel EEG recordings from 109 subjects and 14 runs on each subject in EDF+
format. The recordings were made using the BCI2000 system. To load a subject,
do::
The EEGBCI dataset is documented in :footcite:`SchalkEtAl2004` and on the
`PhysioNet documentation page <https://physionet.org/content/eegmmidb/1.0.0/>`_.
The data set is available at PhysioNet :footcite:`GoldbergerEtAl2000`.
It contains 64-channel EEG recordings from 109 subjects and 14 runs on each
subject in EDF+ format. The recordings were made using the BCI2000 system.
To load a subject, do::

from mne.io import concatenate_raws, read_raw_edf
from mne.datasets import eegbci
raw_fnames = eegbci.load_data(subject, runs)
subjects = [1] # may vary
runs = [4, 8, 12] # may vary
raw_fnames = eegbci.load_data(subjects, runs)
raws = [read_raw_edf(f, preload=True) for f in raw_fnames]
# concatenate runs from subject
raw = concatenate_raws(raws)
# make channel names follow standard conventions
eegbci.standardize(raw)

.. topic:: Examples

Expand Down
31 changes: 31 additions & 0 deletions doc/install/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,37 @@ use a different binding, you can instead install MNE-Python via ``pip``:
.. _CUDA:

Fixing dock icons on Linux
^^^^^^^^^^^^^^^^^^^^^^^^^^

On newer versions of Ubuntu (e.g., 24.04), applications must supply a ``.desktop``
file associated with them, otherwise a generic icon will be used like:

.. image:: ../_static/default_linux_dock_icon.png
:alt: Default Linux dock icon

To fix this, you can create a ``.desktop`` file for MNE-Python. Here is an example
file that you can save as ``~/.local/share/applications/mne-python.desktop`` after
fixing the path to the MNE-Python icon, which you can download
`here <https://github.com/mne-tools/mne-python/blob/922a7801a0ca6af225c7b861fe6bd97b1518af3a/mne/icons/mne_default_icon.png>`__
if needed:

.. code-block:: ini
[Desktop Entry]
Type=Application
Version=1.5
Name=MNE-Python
StartupWMClass=MNE-Python
Icon=/path/to/mne-python/mne/icons/mne_default_icon.png
SingleMainWindow=true
NoDisplay=true
It should make the icon appear correctly in the dock:

.. image:: ../_static/mne_python_dock_icon.png
:alt: MNE-Python dock icon

GPU acceleration with CUDA
^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
96 changes: 45 additions & 51 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,61 @@
# THIS FILE IS AUTO-GENERATED BY tools/hooks/update_environment_file.py AND WILL BE OVERWRITTEN
name: mne
channels:
- conda-forge
dependencies:
- python >=3.10
- pip
- numpy
- scipy
- openblas
- matplotlib
- tqdm
- pooch>=1.5
- antio >=0.4.0
- darkdetect
- decorator
- h5io
- packaging
- numba
- pandas
- pyarrow
- xlrd
- scikit-learn
- defusedxml
- dipy
- edfio >=0.2.1
- eeglabio
- h5io >=0.2.4
- h5py
- jinja2
- pillow
- statsmodels
- jupyter
- ipython !=8.7.0
- joblib
- psutil
- numexpr
- imageio
- spyder-kernels >=1.10.0
- imageio >=2.6.1
- imageio-ffmpeg >=0.4.1
- vtk >=9.2
- traitlets
- pyvista >=0.32,!=0.35.2,!=0.38.0,!=0.38.1,!=0.38.2,!=0.38.3,!=0.38.4,!=0.38.5,!=0.38.6,!=0.42.0
- pyvistaqt >=0.4
- qdarkstyle !=3.2.2
- darkdetect
- dipy
- ipyevents
- ipympl
- ipython !=8.7.0
- ipywidgets
- jinja2
- joblib
- jupyter
- lazy_loader >=0.3
- matplotlib >=3.6
- mffpy >=0.5.7
- mne-qt-browser
- nibabel
- openmeeg >=2.5.5
- nilearn
- numba
- numpy >=1.23,<3
- openmeeg >=2.5.5
- packaging
- pandas
- pillow
- pip
- pooch >=1.5
- pyarrow
- pybv
- pymatreader
- PySide6 !=6.8.0,!=6.8.0.1
- python-neo
- python-picard
- pyvista >=0.32,!=0.35.2,!=0.38.0,!=0.38.1,!=0.38.2,!=0.38.3,!=0.38.4,!=0.38.5,!=0.38.6,!=0.42.0
- pyvistaqt >=0.4
- qdarkstyle !=3.2.2
- qtpy
- pyside6 !=6.8.0,!=6.8.0.1
- mne-base
- seaborn-base
- mffpy >=0.5.7
- ipyevents
- ipywidgets
- ipympl
- scikit-learn
- scipy >=1.9
- sip
- snirf
- statsmodels
- threadpoolctl
- tqdm
- traitlets
- trame
- trame-vtk
- trame-vuetify
- jupyter_client
- nbformat
- nbclient
- mne-qt-browser
- pymatreader
- eeglabio
- edfio >=0.2.1
- pybv
- mamba
- lazy_loader
- defusedxml
- python-neo
- vtk >=9.2
- xlrd
11 changes: 6 additions & 5 deletions examples/decoding/decoding_csp_eeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
See https://en.wikipedia.org/wiki/Common_spatial_pattern and
:footcite:`Koles1991`. The EEGBCI dataset is documented in
:footcite:`SchalkEtAl2004` and is available at PhysioNet
:footcite:`GoldbergerEtAl2000`.
:footcite:`SchalkEtAl2004` and on the
`PhysioNet documentation page <https://physionet.org/content/eegmmidb/1.0.0/>`_.
The dataset is available at PhysioNet :footcite:`GoldbergerEtAl2000`.
"""
# Authors: Martin Billinger <[email protected]>
#
Expand Down Expand Up @@ -40,15 +41,15 @@
# avoid classification of evoked responses by using epochs that start 1s after
# cue onset.
tmin, tmax = -1.0, 4.0
subject = 1
subjects = 1
runs = [6, 10, 14] # motor imagery: hands vs feet

raw_fnames = eegbci.load_data(subject, runs)
raw_fnames = eegbci.load_data(subjects, runs)
raw = concatenate_raws([read_raw_edf(f, preload=True) for f in raw_fnames])
eegbci.standardize(raw) # set channel names
montage = make_standard_montage("standard_1005")
raw.set_montage(montage)
raw.annotations.rename(dict(T1="hands", T2="feet"))
raw.annotations.rename(dict(T1="hands", T2="feet")) # as documented on PhysioNet
raw.set_eeg_reference(projection=True)

# Apply band-pass filter
Expand Down
2 changes: 1 addition & 1 deletion examples/preprocessing/eeg_bridging.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
raw_data = dict() # store infos for electrode positions
for sub in range(1, 11):
print(f"Computing electrode bridges for subject {sub}")
raw_fname = mne.datasets.eegbci.load_data(subject=sub, runs=(1,))[0]
raw_fname = mne.datasets.eegbci.load_data(subjects=sub, runs=(1,))[0]
raw = mne.io.read_raw(raw_fname, preload=True, verbose=False)
mne.datasets.eegbci.standardize(raw) # set channel names
raw.set_montage(montage, verbose=False)
Expand Down
2 changes: 1 addition & 1 deletion examples/preprocessing/muscle_ica.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@

for sub in (1, 2):
raw = mne.io.read_raw_edf(
mne.datasets.eegbci.load_data(subject=sub, runs=(1,))[0], preload=True
mne.datasets.eegbci.load_data(subjects=sub, runs=(1,))[0], preload=True
)
mne.datasets.eegbci.standardize(raw) # set channel names
montage = mne.channels.make_standard_montage("standard_1005")
Expand Down
2 changes: 1 addition & 1 deletion examples/time_frequency/time_frequency_erds.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
# First, we load and preprocess the data. We use runs 6, 10, and 14 from
# subject 1 (these runs contains hand and feet motor imagery).

fnames = eegbci.load_data(subject=1, runs=(6, 10, 14))
fnames = eegbci.load_data(subjects=1, runs=(6, 10, 14))
raw = concatenate_raws([read_raw_edf(f, preload=True) for f in fnames])

raw.rename_channels(lambda x: x.strip(".")) # remove dots from channel names
Expand Down
Loading

0 comments on commit 9723621

Please sign in to comment.