Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changes/dev/13618.notable.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Clarify average EEG reference behavior in documentation for add_reference_channels.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple things:

  • Now that the changes for this PR are a bit clearer, the changelog entry text should be updated.
  • You would need to add your name with the newcontrib tag to the end of the text.
  • The number in the file name must match the PR number.
  • This is not a notable change. other would be more appropriate.

Precise details for all of this are in the contribution guide. Please follow the instructions there.

10 changes: 10 additions & 0 deletions doc/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -2566,3 +2566,13 @@ @inproceedings{MellotEtAl2024
year = {2024},
address = {Lyon, France}
}

@article{AppelhoffSanderson2023,
author = {Appelhoff, Stefan and Sanderson, Nathan},
title = {The importance of adding a zero-filled channel for the reference electrode when re-referencing to average reference},
journal = {Frontiers in Signal Processing},
year = {2023},
doi = {10.3389/frsip.2023.1064138},
volume = {3},
pages = {1064138}
}
Comment on lines +2570 to +2578
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things:

  1. This author and title information is wrong. This needs to be corrected.
  2. The bibliography file isn't perfectly alphabetical, but please try to stick the citation in roughly the right place, not just at the end of the file.

2 changes: 2 additions & 0 deletions mne/channels/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,8 @@ def add_reference_channels(self, ref_channels):
-------
inst : same type as the input data
The modified instance.


Comment on lines +815 to +816
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove these blank lines.

"""
return add_reference_channels(self, ref_channels, copy=False)

Expand Down
8 changes: 7 additions & 1 deletion mne/utils/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4104,7 +4104,13 @@ def _reflow_param_docstring(docstring, has_first_line=True, width=75):
- Average reference:
A new virtual reference electrode is created by averaging the current
EEG signal by setting ``ref_channels='average'``. Bad EEG channels are
automatically excluded if they are properly set in ``info['bads']``.
automatically excluded if they are pproperly set in ``info['bads']``.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
automatically excluded if they are pproperly set in ``info['bads']``.
automatically excluded if they are properly set in ``info['bads']``.


"add_reference_channels_note": """.. note:: When performing average referencing in sensor-space analyses and the
original reference electrode is not present as a zero-filled channel,
this must first be added using :func:`~mne.add_reference_channels`
before calling :func:`~mne.set_eeg_reference` to avoid biasing the
reference :footcite:`AppelhoffSanderson2023`. """,
Comment on lines +4109 to +4113
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"add_reference_channels_note": """.. note:: When performing average referencing in sensor-space analyses and the
original reference electrode is not present as a zero-filled channel,
this must first be added using :func:`~mne.add_reference_channels`
before calling :func:`~mne.set_eeg_reference` to avoid biasing the
reference :footcite:`AppelhoffSanderson2023`. """,
.. note::
When performing average referencing in sensor-space analyses and the original
reference electrode is not present as a zero-filled channel, this must first be
added using :func:`~mne.add_reference_channels`, before calling
:func:`~mne.set_eeg_reference`. This is necessary to avoid biasing the reference
:footcite:`AppelhoffSanderson2023`.


- A single electrode:
Set ``ref_channels`` to a list containing the name of the channel that
Expand Down
7 changes: 7 additions & 0 deletions tutorials/preprocessing/55_setting_eeg_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@
#
# Creating the average reference as a projector
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

# .. note:: When performing average referencing in sensor-space analyses and
# the original reference electrode is not present as a zero-filled
# channel, this must first be added using
# :func:`~mne.add_reference_channels` before calling
# :func:`~mne.set_eeg_reference` to avoid biasing the reference
# :footcite:`AppelhoffSanderson2023`.
Comment on lines +149 to +155
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please copy the changes from the note in the docstring, including the proper formatting.

#
# If using an average reference, it is possible to create the reference as a
# :term:`projector` rather than subtracting the reference from the data
Expand Down
Loading