Skip to content

Commit

Permalink
Merge branch 'neuroread' of https://github.com/withmywoessner/mne-python
Browse files Browse the repository at this point in the history
 into neuroread
  • Loading branch information
withmywoessner committed Mar 13, 2024
2 parents 1104448 + 5ca481a commit 51aad93
Show file tree
Hide file tree
Showing 171 changed files with 2,724 additions and 743 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,8 @@ jobs:


deploy:
machine:
image: ubuntu-2004:202111-01
docker:
- image: cimg/base:current-22.04
steps:
- attach_workspace:
at: /tmp/build
Expand Down
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ This project and everyone participating in it is governed by the [MNE-Python's C

## How to contribute

Before contributing make sure you are familiar with [our contributing guide](https://mne.tools/dev/install/contributing.html).
Before contributing make sure you are familiar with [our contributing guide](https://mne.tools/dev/development/contributing.html).
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Thanks for contributing a pull request! Please make sure you have read the
[contribution guidelines](https://mne.tools/dev/install/contributing.html)
[contribution guidelines](https://mne.tools/dev/development/contributing.html)
before submitting.

Please be aware that we are a loose team of volunteers so patience is
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: pre-commit/[email protected].0
- uses: pre-commit/[email protected].1

bandit:
name: Bandit
needs: style
runs-on: ubuntu-latest
steps:
- uses: davidslusser/[email protected].0
- uses: davidslusser/[email protected].1
with:
src: "mne"
options: "-c pyproject.toml -ll -r"
Expand Down Expand Up @@ -129,5 +129,7 @@ jobs:
path: ~/mne_data
- run: ./tools/github_actions_download.sh
- run: ./tools/github_actions_test.sh
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
if: success()
14 changes: 5 additions & 9 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.1.14
rev: v0.3.0
hooks:
- id: ruff
name: ruff lint mne
Expand All @@ -11,18 +11,14 @@ repos:
name: ruff lint mne preview
args: ["--fix", "--preview", "--select=NPY201"]
files: ^mne/
- id: ruff-format
name: ruff format mne
files: ^mne/
- id: ruff
name: ruff lint tutorials and examples
name: ruff lint doc, tutorials, and examples
# D103: missing docstring in public function
# D400: docstring first line must end with period
args: ["--ignore=D103,D400", "--fix"]
files: ^tutorials/|^examples/
files: ^doc/|^tutorials/|^examples/
- id: ruff-format
name: ruff format tutorials and examples
files: ^tutorials/|^examples/
files: ^mne/|^doc/|^tutorials/|^examples/

# Codespell
- repo: https://github.com/codespell-project/codespell
Expand All @@ -36,7 +32,7 @@ repos:

# yamllint
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.33.0
rev: v1.35.1
hooks:
- id: yamllint
args: [--strict, -c, .yamllint.yml]
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ For full functionality, some functions require:
- `scikit-learn <https://scikit-learn.org/stable/>`__ ≥ 1.0
- `Joblib <https://joblib.readthedocs.io/en/latest/index.html>`__ ≥ 0.15 (for parallelization)
- `mne-qt-browser <https://github.com/mne-tools/mne-qt-browser>`__ ≥ 0.1 (for fast raw data visualization)
- `Qt <https://www.qt.io>`__ ≥ 5.12 via one of the following bindings (for fast raw data visualization and interactive 3D visualization):
- `Qt <https://www.qt.io>`__ ≥ 5.15 via one of the following bindings (for fast raw data visualization and interactive 3D visualization):

- `PyQt6 <https://www.riverbankcomputing.com/software/pyqt/>`__ ≥ 6.0
- `PySide6 <https://doc.qt.io/qtforpython-6/>`__ ≥ 6.0
- `PyQt5 <https://www.riverbankcomputing.com/software/pyqt/>`__ ≥ 5.12
- `PySide2 <https://doc.qt.io/qtforpython-6/gettingstarted/porting_from2.html>`__ ≥ 5.12
- `PyQt5 <https://www.riverbankcomputing.com/software/pyqt/>`__ ≥ 5.15
- `PySide2 <https://doc.qt.io/qtforpython-6/gettingstarted/porting_from2.html>`__ ≥ 5.15

- `Numba <https://numba.pydata.org>`__ ≥ 0.54.0
- `NiBabel <https://nipy.org/nibabel/>`__ ≥ 3.2.1
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,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 pytest-error-for-skips python-picard "PyQt6!=6.5.1,!=6.6.1" "PyQt6-Qt6!=6.6.1" qtpy nibabel sphinx-gallery
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 pytest-error-for-skips python-picard "PyQt6!=6.5.1,!=6.6.1,!=6.6.2" "PyQt6-Qt6!=6.6.1,!=6.6.2" qtpy nibabel sphinx-gallery
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 @@ -183,7 +183,7 @@ stages:
displayName: 'Get test data'
- bash: |
set -e
python -m pip install "PyQt6!=6.6.1" "PyQt6-Qt6!=6.6.1"
python -m pip install "PyQt6!=6.6.1,!=6.6.2" "PyQt6-Qt6!=6.6.1,!=6.6.2"
LD_DEBUG=libs python -c "from PyQt6.QtWidgets import QApplication, QWidget; app = QApplication([]); import matplotlib; matplotlib.use('QtAgg'); import matplotlib.pyplot as plt; plt.figure()"
- bash: |
mne sys_info -pd
Expand Down
4 changes: 2 additions & 2 deletions doc/_includes/channel_interpolation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ where :math:`G_{ds} \in R^{M \times N}` computes :math:`g_{m}(\boldsymbol{r_i},

To interpolate bad channels, one can simply do:

>>> evoked.interpolate_bads(reset_bads=False) # doctest: +SKIP
>>> evoked.interpolate_bads(reset_bads=False) # doctest: +SKIP

and the bad channel will be fixed.

.. target for :end-before: channel-interpolation-end-content
.. topic:: Examples:

* :ref:`ex-interpolate-bad-channels`
* :ref:`ex-interpolate-bad-channels`
70 changes: 35 additions & 35 deletions doc/_includes/forward.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,26 +130,26 @@ transformation symbols (:math:`T_x`) indicate the transformations actually
present in the FreeSurfer files. Generally,

.. math:: \begin{bmatrix}
x_2 \\
y_2 \\
z_2 \\
1
\end{bmatrix} = T_{12} \begin{bmatrix}
x_1 \\
y_1 \\
z_1 \\
1
\end{bmatrix} = \begin{bmatrix}
R_{11} & R_{12} & R_{13} & x_0 \\
R_{21} & R_{22} & R_{23} & y_0 \\
R_{31} & R_{32} & R_{33} & z_0 \\
0 & 0 & 0 & 1
\end{bmatrix} \begin{bmatrix}
x_1 \\
y_1 \\
z_1 \\
1
\end{bmatrix}\ ,
x_2 \\
y_2 \\
z_2 \\
1
\end{bmatrix} = T_{12} \begin{bmatrix}
x_1 \\
y_1 \\
z_1 \\
1
\end{bmatrix} = \begin{bmatrix}
R_{11} & R_{12} & R_{13} & x_0 \\
R_{21} & R_{22} & R_{23} & y_0 \\
R_{31} & R_{32} & R_{33} & z_0 \\
0 & 0 & 0 & 1
\end{bmatrix} \begin{bmatrix}
x_1 \\
y_1 \\
z_1 \\
1
\end{bmatrix}\ ,

where :math:`x_k`, :math:`y_k`,and :math:`z_k` are the location coordinates in
two coordinate systems, :math:`T_{12}` is the coordinate transformation from
Expand All @@ -161,20 +161,20 @@ files produced by FreeSurfer and MNE.
The fixed transformations :math:`T_-` and :math:`T_+` are:

.. math:: T_{-} = \begin{bmatrix}
0.99 & 0 & 0 & 0 \\
0 & 0.9688 & 0.042 & 0 \\
0 & -0.0485 & 0.839 & 0 \\
0 & 0 & 0 & 1
\end{bmatrix}
0.99 & 0 & 0 & 0 \\
0 & 0.9688 & 0.042 & 0 \\
0 & -0.0485 & 0.839 & 0 \\
0 & 0 & 0 & 1
\end{bmatrix}

and

.. math:: T_{+} = \begin{bmatrix}
0.99 & 0 & 0 & 0 \\
0 & 0.9688 & 0.046 & 0 \\
0 & -0.0485 & 0.9189 & 0 \\
0 & 0 & 0 & 1
\end{bmatrix}
0.99 & 0 & 0 & 0 \\
0 & 0.9688 & 0.046 & 0 \\
0 & -0.0485 & 0.9189 & 0 \\
0 & 0 & 0 & 1
\end{bmatrix}

.. note::
This section does not discuss the transformation between the MRI voxel
Expand Down Expand Up @@ -352,11 +352,11 @@ coordinates (:math:`r_D`) by
where

.. math:: T = \begin{bmatrix}
e_x & 0 \\
e_y & 0 \\
e_z & 0 \\
r_{0D} & 1
\end{bmatrix}\ .
e_x & 0 \\
e_y & 0 \\
e_z & 0 \\
r_{0D} & 1
\end{bmatrix}\ .

Calculation of the magnetic field
---------------------------------
Expand Down
4 changes: 2 additions & 2 deletions doc/_includes/ssp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ The EEG average reference is the mean signal over all the sensors. It is
typical in EEG analysis to subtract the average reference from all the sensor
signals :math:`b^{1}(t), ..., b^{n}(t)`. That is:

.. math:: {b}^{j}_{s}(t) = b^{j}(t) - \frac{1}{n}\sum_{k}{b^k(t)}
.. math:: {b}^{j}_{s}(t) = b^{j}(t) - \frac{1}{n}\sum_{k}{b^k(t)}
:name: eeg_proj

where the noise term :math:`b_{n}^{j}(t)` is given by

.. math:: b_{n}^{j}(t) = \frac{1}{n}\sum_{k}{b^k(t)}
.. math:: b_{n}^{j}(t) = \frac{1}{n}\sum_{k}{b^k(t)}
:name: noise_term

Thus, the projector vector :math:`P_{\perp}` will be given by
Expand Down
2 changes: 1 addition & 1 deletion doc/api/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ Events
average_movements
combine_event_ids
equalize_epoch_counts
make_metadata
make_metadata
2 changes: 1 addition & 1 deletion doc/api/file_io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ Base class:
:toctree: ../generated/
:template: autosummary/class_no_members.rst

BaseEpochs
BaseEpochs
3 changes: 3 additions & 0 deletions doc/api/preprocessing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Projections:
cortical_signal_suppression
create_ecg_epochs
create_eog_epochs
find_bad_channels_lof
find_bad_channels_maxwell
find_ecg_events
find_eog_events
Expand Down Expand Up @@ -162,6 +163,8 @@ Projections:
Calibration
read_eyelink_calibration
set_channel_types_eyetrack
convert_units
get_screen_visual_angle
interpolate_blinks

EEG referencing:
Expand Down
1 change: 1 addition & 0 deletions doc/changes/devel/11234.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Detecting Bad EEG/MEG channels using the local outlier factor (LOF) algorithm in :func:`mne.preprocessing.find_bad_channels_lof`, by :newcontrib:`Velu Prabhakar Kumaravel`.
1 change: 1 addition & 0 deletions doc/changes/devel/12206.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug in :meth:`mne.Epochs.apply_function` where data was handed down incorrectly in parallel processing, by `Dominik Welke`_.
3 changes: 3 additions & 0 deletions doc/changes/devel/12206.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Custom functions applied via :meth:`mne.io.Raw.apply_function`, :meth:`mne.Epochs.apply_function` or :meth:`mne.Evoked.apply_function` can now use ``ch_idx`` or ``ch_name`` to get access to the currently processed channel during channel wise processing.

:meth:`mne.Evoked.apply_function` can now also work on full data array instead of just channel wise, analogous to :meth:`mne.io.Raw.apply_function` and :meth:`mne.Epochs.apply_function`, by `Dominik Welke`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12207.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow :class:`mne.time_frequency.EpochsTFR` as input to :func:`mne.epochs.equalize_epoch_counts`, by `Carina Forster`_.
2 changes: 2 additions & 0 deletions doc/changes/devel/12237.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Added a helper function :func:`mne.preprocessing.eyetracking.convert_units` to convert eyegaze data from pixel-on-screen values to radians of visual angle. Also added a helper function :func:`mne.preprocessing.eyetracking.get_screen_visual_angle` to get the visual angle that the participant screen subtends, by `Scott Huberty`_.

1 change: 1 addition & 0 deletions doc/changes/devel/12323.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add :meth:`~mne.SourceEstimate.savgol_filter`, :meth:`~mne.SourceEstimate.filter`, :meth:`~mne.SourceEstimate.apply_hilbert`, and :meth:`~mne.SourceEstimate.apply_function` methods to :class:`mne.SourceEstimate` and related classes, by `Hamza Abdelhedi`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12324.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add ``tol`` parameter to :meth:`mne.events_from_annotations` so that the user can specify the tolerance to ignore rounding errors of event onsets when using ``chunk_duration`` is not None (default is 1e-8), by `Michiru Kaneda`_
1 change: 1 addition & 0 deletions doc/changes/devel/12382.apichange.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change :func:`mne.stc_near_sensors` ``surface`` default from the ``'pial'`` surface to the surface in ``src`` if ``src`` is not ``None`` in version 1.8, by `Alex Rockhill`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12382.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bad channels not handled properly in :func:`mne.stc_near_sensors` by `Alex Rockhill`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12393.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change how samples are read when using ``data_format='auto'`` in :func:`mne.io.read_raw_cnt`, by `Jacob Woessner`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12420.other.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Clarify in the :ref:`EEG referencing tutorial <tut-set-eeg-ref>` that an average reference projector ready is required for inverse modeling, by :newcontrib:`Nabil Alibou`
1 change: 1 addition & 0 deletions doc/changes/devel/12430.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reformats channel and detector lookup in :func:`mne.io.read_raw_snirf` from array based to dictionary based. Removes incorrect assertions that every detector and source must have data associated with every registered optode position, by :newcontrib:`Alex Kiefer`.
1 change: 1 addition & 0 deletions doc/changes/devel/12436.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix :ref:`tut-working-with-seeg` use of :func:`mne.stc_near_sensors` to use the :class:`mne.VolSourceEstimate` positions and not the pial surface, by `Alex Rockhill`_
1 change: 1 addition & 0 deletions doc/changes/devel/12443.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add option to pass ``image_kwargs`` to :class:`mne.Report.add_epochs` to allow adjusting e.g. ``vmin`` and ``vmax`` of the epochs image in the report, by `Sophie Herbst`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12444.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix validation of ``ch_type`` in :func:`mne.preprocessing.annotate_muscle_zscore`, by `Mathieu Scheltienne`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12445.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for multiple raw instances in :func:`mne.preprocessing.compute_average_dev_head_t` by `Eric Larson`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12446.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support partial pathlength factors for each wavelength in :func:`mne.preprocessing.nirs.beer_lambert_law`, by :newcontrib:`Richard Scholz`.
1 change: 1 addition & 0 deletions doc/changes/devel/12450.other.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Move private data preparation functions for BrainVision export from ``pybv`` to ``mne``, by `Clemens Brunner`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12451.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix errant redundant use of ``BIDSPath.split`` when writing split raw and epochs data, by `Eric Larson`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12451.dependency.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
``pytest-harvest`` is no longer used as a test dependency, by `Eric Larson`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12454.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Completing PR 12453. Add option to pass ``image_kwargs`` per channel type to :class:`mne.Report.add_epochs`.
1 change: 1 addition & 0 deletions doc/changes/devel/12456.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Disable config parser interpolation when reading BrainVision files, which allows using the percent sign as a regular character in channel units, by `Clemens Brunner`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12461.other.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix dead links in ``README.rst`` documentation by :newcontrib:`Will Turner`.
1 change: 1 addition & 0 deletions doc/changes/devel/12462.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:func:`mne.epochs.make_metadata` now accepts strings as ``tmin`` and ``tmax`` parameter values, simplifying metadata creation based on time-varying events such as responses to a stimulus, by `Richard Höchenberger`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12463.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Include date of acquisition and filter parameters in ``raw.info`` for :func:`mne.io.read_raw_neuralynx` by `Kristijan Armeni`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12470.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix the default color of :meth:`mne.viz.Brain.add_text` to properly contrast with the figure background color, by `Marijn van Vliet`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12474.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Changed default ECoG and sEEG electrode sizes in brain plots to better reflect real world sizes, by `Liberty Hamilton`_
1 change: 1 addition & 0 deletions doc/changes/devel/12481.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix reading segmented recordings with :func:`mne.io.read_raw_eyelink` by `Dominik Welke`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12483.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve compatibility with other Qt-based GUIs by handling theme icons better, by `Eric Larson`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12489.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix cleaning of channel names for non vectorview or CTF dataset including whitespaces or dash in their channel names, by `Mathieu Scheltienne`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12491.dependency.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The minimum supported version of Qt bindings is 5.15, by `Eric Larson`_.
Loading

0 comments on commit 51aad93

Please sign in to comment.