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

Fix alphabetical order in overview/people.rst, fix sphinx formatting in docstrings and set verbose to keyword-only #11745

Merged
merged 4 commits into from
Jun 20, 2023
Merged
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
2 changes: 1 addition & 1 deletion doc/overview/people.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Steering Council
* `Guillaume Favelier`_
* `Luke Bloy`_
* `Mainak Jas`_
* `Mathieu Scheltienne`_
* `Marijn van Vliet`_
* `Mathieu Scheltienne`_
* `Mikołaj Magnuski`_
* `Richard Höchenberger`_
* `Robert Luke`_
Expand Down
15 changes: 8 additions & 7 deletions mne/channels/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def set_channel_types(self, mapping, *, on_unit_change="warn", verbose=None):
mapping : dict
A dictionary mapping channel names to sensor types, e.g.,
``{'EEG061': 'eog'}``.
on_unit_change : 'raise' | 'warn' | 'ignore'
on_unit_change : ``'raise'`` | ``'warn'`` | ``'ignore'``
Copy link
Member

Choose a reason for hiding this comment

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

is this how we do it elsewhere? I know we're not 100% consistent, but I have a vague memory that we're actually supposed to omit the double-backticks in cases like this 🤔 This is not definitive, but:

$ git grep " : '" | wc -l
117
$ git grep " : \`\`'" | wc -l
26

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we've decided and I looked at numpydoc but it doesn't seem to say

https://numpydoc.readthedocs.io/en/latest/format.html#parameters

In the meantime I think this should render more nicely. In principle maybe numpydoc should autodetect such strings and literal-ify them but I wonder if it would befragile. So maybe we should turn them to literals for now and someday if someone wants to make numpydoc smarter they can, and it's easy enough to replace our instances at that point.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. I've definitely seen it elsewhere in the codebase, and IMO it renders better. But actually in numpydoc:

When a parameter can only assume one of a fixed set of values, 
those values can be listed in braces, with the default appearing first:

order : {'C', 'F', 'A'}
    Description of `order`.

Not sure how it renders

What to do if the measurement unit of a channel is changed
automatically to match the new sensor type.

Expand Down Expand Up @@ -476,7 +476,7 @@ def set_channel_types(self, mapping, *, on_unit_change="warn", verbose=None):
return self

@verbose
def rename_channels(self, mapping, allow_duplicates=False, verbose=None):
def rename_channels(self, mapping, allow_duplicates=False, *, verbose=None):
"""Rename channels.

Parameters
Expand Down Expand Up @@ -527,6 +527,7 @@ def plot_sensors(
block=False,
show=True,
sphere=None,
*,
verbose=None,
):
"""Plot sensor positions.
Expand All @@ -541,9 +542,9 @@ def plot_sensors(
control key. The selected channels are returned along with the
figure instance. Defaults to 'topomap'.
ch_type : None | str
The channel type to plot. Available options 'mag', 'grad', 'eeg',
'seeg', 'dbs', 'ecog', 'all'. If ``'all'``, all the available mag,
grad, eeg, seeg, dbs, and ecog channels are plotted. If
The channel type to plot. Available options ``'mag'``, ``'grad'``,
``'eeg'``, ``'seeg'``, ``'dbs'``, ``'ecog'``, ``'all'``. If ``'all'``, all
the available mag, grad, eeg, seeg, dbs, and ecog channels are plotted. If
None (default), then channels are chosen in the order given above.
title : str | None
Title for the figure. If None (default), equals to ``'Sensor
Expand Down Expand Up @@ -1244,7 +1245,7 @@ def interpolate_bads(


@verbose
def rename_channels(info, mapping, allow_duplicates=False, verbose=None):
def rename_channels(info, mapping, allow_duplicates=False, *, verbose=None):
"""Rename channels.

Parameters
Expand Down Expand Up @@ -1896,7 +1897,7 @@ def _compute_ch_adjacency(info, ch_type):
%(info_not_none)s
ch_type : str
The channel type for computing the adjacency matrix. Currently
supports 'mag', 'grad' and 'eeg'.
supports ``'mag'``, ``'grad'`` and ``'eeg'``.

Returns
-------
Expand Down
2 changes: 1 addition & 1 deletion mne/utils/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2341,7 +2341,7 @@ def _reflow_param_docstring(docstring, has_first_line=True, width=75):
] = """
mapping : dict | callable
A dictionary mapping the old channel to a new channel name
e.g. {'EEG061' : 'EEG161'}. Can also be a callable function
e.g. ``{'EEG061' : 'EEG161'}``. Can also be a callable function
that takes and returns a string.

.. versionchanged:: 0.10.0
Expand Down