Skip to content

Commit ed26706

Browse files
authored
FIX: DigMontage.rename_channels should return self (#13320)
1 parent 0c106bc commit ed26706

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

doc/changes/v1.10.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Bugfixes
5050
- Fix y-axis label in PSD plot when ``dB=True`` to show a more conventional label (i.e., dB/Hz or dB/√Hz), by `Clemens Brunner`_. (`#13298 <https://github.com/mne-tools/mne-python/pull/13298>`__)
5151
- Fix bug in :func:`mne.sys_info` where calling it in Windows could lead to a an error while trying to get the amount of available memory, by `Eric Larson`_. (`#13310 <https://github.com/mne-tools/mne-python/pull/13310>`__)
5252
- Change default pupil unit scalings from micrometrs to millimeters by `Scott Huberty`_ (`#13314 <https://github.com/mne-tools/mne-python/pull/13314>`__)
53+
- Fix :meth:`mne.channels.DigMontage.rename_channels` so that the changed montage is returned instead of ``None``, by `Stefan Appelhoff`_. (`#13320 <https://github.com/mne-tools/mne-python/pull/13320>`__)
5354

5455

5556
API changes by deprecation

mne/channels/montage.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ def rename_channels(self, mapping, allow_duplicates=False):
397397
temp_info = create_info(list(self._get_ch_pos()), 1000.0, "eeg")
398398
rename_channels(temp_info, mapping, allow_duplicates)
399399
self.ch_names = temp_info["ch_names"]
400+
return self
400401

401402
@verbose
402403
def save(self, fname, *, overwrite=False, verbose=None):
@@ -720,7 +721,7 @@ def transform_to_head(montage):
720721
Returns
721722
-------
722723
montage : instance of DigMontage
723-
The montage after transforming the points to head
724+
A copy of the montage after transforming the points to head
724725
coordinate system.
725726
726727
Notes

mne/channels/tests/test_montage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ def renamer(x):
14291429
except ValueError:
14301430
return x
14311431

1432-
mon.rename_channels(renamer)
1432+
mon = mon.rename_channels(renamer)
14331433
raw.set_montage(mon)
14341434

14351435
if mon is not None:

mne/utils/docs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2037,7 +2037,7 @@ def _reflow_param_docstring(docstring, has_first_line=True, width=75):
20372037
>>> mon = mne.channels.make_standard_montage('standard_1020')
20382038
>>> need = 'S1 D1 S2 D2 S3 D3 S4 D4 S5 D5 S6 D6 S7 D7 S8'.split()
20392039
>>> have = 'F3 FC3 C3 CP3 P3 F5 FC5 C5 CP5 P5 F7 FT7 T7 TP7 P7'.split()
2040-
>>> mon.rename_channels(dict(zip(have, need)))
2040+
>>> mon.rename_channels(dict(zip(have, need))) # doctest: +SKIP
20412041
>>> raw.set_montage(mon) # doctest: +SKIP
20422042
20432043
The 3x3 (ETG-100) is laid out as two separate layouts::

0 commit comments

Comments
 (0)