-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Deprecate meg=True in pick_types #7823
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
Conversation
|
@larsoner can you check if the logic when to warn is OK like this? |
|
Now do I catch all deprecation warnings individually or do I just disable this specific |
|
You will probably need to update all tests that currently fail to now explicitly use meg=True to ensure they work the same way now and once we switch to meg=False as the default |
|
Also you should push a commit with |
Looks like that's 93 examples to change :( |
Yep, I'm on it. |
Yes I think we should. I imagine this is used much more often internally than it is by users, so this won't inflict nearly as much pain for people than the primary
|
|
Except for my question about |
|
Last question solved, ready from my side! |
|
needs rebase/merge, conflict |
doc/changes/latest.inc
Outdated
|
|
||
| - The function ``mne.channels.read_dig_captrack`` will be deprecated in version 0.22 in favor of :func:`mne.channels.read_dig_captrak` to correct the spelling error: "captraCK" -> "captraK", by `Stefan Appelhoff`_ | ||
|
|
||
| - The default argument ``meg=True`` in func:`mne.io.pick_types` will change to ``meg=False`` in version 0.22 by `Clemens Brunner`_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is documented at the root level so this will be an error
https://mne.tools/stable/generated/mne.pick_types.html
| - The default argument ``meg=True`` in func:`mne.io.pick_types` will change to ``meg=False`` in version 0.22 by `Clemens Brunner`_ | |
| - The default argument ``meg=True`` in func:`mne.pick_types` and related methods like :meth:`mne.io.Raw.pick_types` and :meth:`mne.Evoked.pick_types` will change to ``meg=False`` in version 0.22 by `Clemens Brunner`_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just so I understand, where will this be an error (if the doc contains func:mne.io.pick_types)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where will this be an error
CircleCI will say something about not being able to link to the ref properly, and the build will fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(alternatively, locally you can do make html_dev-noplot in the doc/ directory then echo $? afterward it should not be zero, and if you look up you should see a warning about not being able to link properly)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... though I seem to remember your previous build being green, so maybe it figures out to go up to mne.pick_types when the mne.io.pick_types link is requested somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous CircleCI build was all green with exit code 0, yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it was indeed green but shouldn't have been because the link did not get created correctly, maybe some latest Sphinx change made this fail to link without raising an error, not sure...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the linking failure is due to lack of a colon at the beginning of func
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grrr... thanks @drammock . I'll see if changing our default_role to something other than "autolink" linke "py:obj" would have made this error show up, in which case we should change it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've inserted the missing colon and now use mne.pick_types.
| If True include MEG channels. If string it can be 'mag', 'grad', | ||
| 'planar1' or 'planar2' to select only magnetometers, all | ||
| gradiometers, or a specific type of gradiometer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| If True include MEG channels. If string it can be 'mag', 'grad', | |
| 'planar1' or 'planar2' to select only magnetometers, all | |
| gradiometers, or a specific type of gradiometer. | |
| If ``True``, include MEG channels. If string, it can be ``'mag'``, | |
| ``'grad``', ``'planar1'`` or ``'planar2'`` to select only magnetometers | |
| all gradiometers, or a specific type of gradiometer. |
hoechenberger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just added a few suggestions
| If True include CTF / 4D reference channels. If 'auto', reference | ||
| channels are included if compensations are present and ``meg`` is | ||
| not False. Can also be the string options for the ``meg`` | ||
| parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| If True include CTF / 4D reference channels. If 'auto', reference | |
| channels are included if compensations are present and ``meg`` is | |
| not False. Can also be the string options for the ``meg`` | |
| parameter. | |
| If ``True``, include CTF / 4D reference channels. If ``'auto'``, reference | |
| channels are included if compensations are present and ``meg`` is | |
| not ``False``. Can also be the string options for the ``meg`` | |
| parameter. |
| If True include MEG channels. If string it can be 'mag', 'grad', | ||
| 'planar1' or 'planar2' to select only magnetometers, all gradiometers, | ||
| or a specific type of gradiometer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| If True include MEG channels. If string it can be 'mag', 'grad', | |
| 'planar1' or 'planar2' to select only magnetometers, all gradiometers, | |
| or a specific type of gradiometer. | |
| If ``True``, include MEG channels. If string, it can be ``'mag'`` | |
| ``'grad'``, ``'planar1'`` or ``'planar2'`` to select only | |
| magnetometers, all gradiometers, or a specific type of gradiometer. |
| If True include CTF / 4D reference channels. If 'auto', reference | ||
| channels are included if compensations are present and ``meg`` is not | ||
| False. Can also be the string options for the ``meg`` parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| If True include CTF / 4D reference channels. If 'auto', reference | |
| channels are included if compensations are present and ``meg`` is not | |
| False. Can also be the string options for the ``meg`` parameter. | |
| If ``True``, include CTF / 4D reference channels. If ``'auto'``, reference | |
| channels are included if compensations are present and ``meg`` is not | |
| ``False``. Can also be the string options for the ``meg`` parameter. |
| If True include MEG channels. If string it can be 'mag', 'grad', | ||
| 'planar1' or 'planar2' to select only magnetometers, all gradiometers, | ||
| or a specific type of gradiometer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| If True include MEG channels. If string it can be 'mag', 'grad', | |
| 'planar1' or 'planar2' to select only magnetometers, all gradiometers, | |
| or a specific type of gradiometer. | |
| If ``True``, include MEG channels. If string, it can be ``'mag'``, | |
| ``'grad'``, ``'planar1'`` or ``'planar2'`` to select only | |
| magnetometers, all gradiometers, or a specific type of gradiometer. |
|
@hoechenberger do we really always have to double-backtick literals in docstrings? I know that this makes it show up as |
I don't understand the reasoning. We're not charged per-character, and the effort is about as minimal as it gets (press the key your finger is already on, twice instead of once). I'll concede that the changelog is probably the least important place to get this right (much more important in tutorials and docstrings), but remembering / enforcing to do it correctly here is a good way to reinforce the behavior so that it also happens everywhere else. |
|
+100 @drammock |
|
It's harder to read in plain text when I see everything surrounded by double backticks. But whatever, if we now do that I will change it. |
meg : bool | str
If ``True` include MEG channels. If string it can be ``'mag'``,
``'grad'``, ``'planar1'`` or ``'planar2'`` to select only
magnetometers, all gradiometers, or a specific type of gradiometer.You don't think this is harder to read (in plain text) (especially the literal strings)? Also, why change this only in a few selected parameter descriptions and not all? I don't want to do it here, if you think this is important please do it in a new PR. |
I find it a little bit harder, but not too much. And to me the RST rendering gain is worth the plain-text rendering loss. I'm fine with someone else working on this in another PR, though |
larsoner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, the changeset is actually smaller than I expected!
I think it's not easy to read without syntax highlighting that helps with this. That being said, our users view the rendered output, and many IDEs provide rendered docstrings as well. So unless you're actually working on the docstrings, this shouldn't really affect you, no?
Because we're already inconsistent anyway and changing some bits "as we go" in PRs that change some lines of docstrings brings us a little closer to overall more consistently rendered docs.
There's no need to, it was merely suggestions, no blockers from my end. Sorry if it came across otherwise! |
|
FWIW, I'm using VS Code with the Highlight extension and the following setting: "highlight.regexes": {
"(``)(.+?)(``)": [
{"color": "#d88e73"},
{"color": "#3c9ddb"},
{"color": "#d88e73"}
]
}Maybe some of you may find this useful. |
|
That's pretty neat! Is there anything similar for PyCharm? |
I'm afraid not, at least I haven't found anything so far :( There is a related support request from ~2 years ago: |
|
OK, that's a pity. Though it wouldn't really solve the issue, because users (as opposed to devs) will read docstrings mostly in their REPL (e.g. IPython), which means they will see just plain text without any fancy rST highlighting. I think enclosing every literal in double backticks is just overkill. Also, it violates the numpydoc style recommendation that variables should be enclosed in single backticks: https://numpydoc.readthedocs.io/en/latest/format.html. |
@cbrnr Do we actually have evidence for this one way or the other? Anyone who uses Spyder will typically see HTML-rendered docs, for example.
@hoechenberger our sphinx config was recently changed so that anything surrounded by single ticks (which previously rendered as italics, redundant with single asterisks for yielding italics) will now always be treated as an attempted link or cross-reference by the build system. This allows Sphinx to catch errors like the recently seen where |
I only have anecdotal evidence from coworkers and students in my Python course, where the majority seems to be using plain-text docstrings (mostly via the IPython shortcut 👍 for the simplification! Regarding the use of double backticks, do we have docstring guidelines somewhere? If not I think it would be a good addition to have such a document in the contributing section. |
|
@drammock @hoechenberger do you have any additional comments (let's do docstring formatting changes in another PR though)? |
|
@cbrnr LGTM! |
|
@drammock I think you can merge this if you're happy |
added to #6266 |
|
thanks @cbrnr ! |
* upstream/master: DOC: Order added reference FIX: Working working version ENH: More efficient actually working csd, needs review MAINT: Update dataset and add constant test (mne-tools#7866) DOC: update link to glasser supplementary info; convert to footbib (mne-tools#7864) FIX: Fix subtract_evoked with decim (mne-tools#7855) FIX: Fix reading of old TFRs (mne-tools#7851) DOC: Add evoked movecomp to example (mne-tools#7852) Deprecate meg=True in pick_types (mne-tools#7823) ENH: Allow reading broken file (mne-tools#7846) MRG, ENH: Add mixed source estimate support to compute_source_morph (mne-tools#7734) FIX: Fix bug with metadata and event_repeated (mne-tools#7733) MRG, ENH: Add axes to plot_evoked_white (mne-tools#7831) MRG, ENH: Add example of projection to source space (mne-tools#7705)

Fixes #7710 (change the default
meg=Truetomeg=Falsein a deprecation cycle.pick_types_forward?Any additional MEG bias we should remove in this PR?Make arguments kw-only?