Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC] Add documentation for setting montage order #12160

Merged
merged 9 commits into from
Nov 3, 2023
2 changes: 1 addition & 1 deletion doc/changes/devel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Enhancements
- Add :class:`mne.viz.ui_events.UIEvent` linking for interactive colorbars, allowing users to link figures and change the colormap and limits interactively. This supports :func:`~mne.viz.plot_evoked_topomap`, :func:`~mne.viz.plot_ica_components`, :func:`~mne.viz.plot_tfr_topomap`, :func:`~mne.viz.plot_projs_topomap`, :meth:`~mne.Evoked.plot_image`, and :meth:`~mne.Epochs.plot_image` (:gh:`12057` by `Santeri Ruuskanen`_)
- :func:`~mne.epochs.make_metadata` now accepts ``tmin=None`` and ``tmax=None``, which will bound the time window used for metadata generation by event names (instead of a fixed time). That way, you can now for example generate metadata spanning from one cue or fixation cross to the next, even if trial durations vary throughout the recording (:gh:`12118` by `Richard Höchenberger`_)
- Add support for passing multiple labels to :func:`mne.minimum_norm.source_induced_power` (:gh:`12026` by `Erica Peterson`_, `Eric Larson`_, and `Daniel McCloy`_ )

- Added documentation to :meth:`mne.io.Raw.set_montage` and :func:`mne.add_reference_channels` to specify that montages should be set after adding reference channels (:gh:`12160` by `Jacob Woessner`_)

Bugs
~~~~
Expand Down
6 changes: 6 additions & 0 deletions mne/_fiff/meas_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,12 @@ def set_montage(
a montage. Other channel types (e.g., MEG channels) should have
their positions defined properly using their data reading
functions.
.. warning::
Applying a montage will only set locations of channels that exist
at the time it is applied. This means when
:ref:`re-referencing <tut-set-eeg-ref>`
make sure to apply the montage only after calling
:func:`mne.add_reference_channels`
"""
# How to set up a montage to old named fif file (walk through example)
# https://gist.github.com/massich/f6a9f4799f1fbeb8f5e8f8bc7b07d3df
Expand Down
12 changes: 11 additions & 1 deletion mne/_fiff/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ def add_reference_channels(inst, ref_channels, copy=True):
-------
inst : instance of Raw | Epochs | Evoked
Data with added EEG reference channels.

Notes
-----
.. warning::
When :ref:`re-referencing <tut-set-eeg-ref>`,
make sure to apply the montage using :meth:`mne.io.Raw.set_montage`
only after calling this function. Applying a montage will only set
locations of channels that exist at the time it is applied.
"""
from ..epochs import BaseEpochs
from ..evoked import Evoked
Expand Down Expand Up @@ -239,7 +247,9 @@ def add_reference_channels(inst, ref_channels, copy=True):
ref_dig_array = np.full(12, np.nan)
logger.info(
"Location for this channel is unknown; consider calling "
"set_montage() again if needed."
"set_montage() after adding new reference channels if needed. "
"Applying a montage will only set locations of channels that "
"exist at the time it is applied."
)

for ch in ref_channels:
Expand Down
Loading