Skip to content

[MRG] Do not exclude bads if channel indices are supplied#6678

Merged
agramfort merged 1 commit intomne-tools:masterfrom
cbrnr:plot_psd_bads
Aug 20, 2019
Merged

[MRG] Do not exclude bads if channel indices are supplied#6678
agramfort merged 1 commit intomne-tools:masterfrom
cbrnr:plot_psd_bads

Conversation

@cbrnr
Copy link
Copy Markdown
Contributor

@cbrnr cbrnr commented Aug 20, 2019

Fixes #6637. The following example correctly produces the PSD for all channels supplied in picks:

import mne
from mne.datasets import sample


data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_audvis_raw.fif'
raw = mne.io.read_raw_fif(raw_fname, preload=True)

raw.drop_channels(raw.info["ch_names"][:315])
raw.drop_channels(raw.info["ch_names"][4:])
raw.info["bads"] = ['EEG 003', 'EEG 004']

raw.plot_psd(spatial_colors=False, picks=range(4))  # plot all 4 channels

The default behavior is still to exclude bad channels, that is

raw.plot_psd(spatial_colors=False)
raw.plot_psd(spatial_colors=False, picks="all")

generate PSDs only for the 2 good channels just like before.

However, I don't know what's the deal with spatial_colors=True, which only plots 3 channels ("EEG 001", "EEG 002", and "EEG 004"). But maybe this should be fixed in a different PR.

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 20, 2019

Codecov Report

Merging #6678 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #6678   +/-   ##
=======================================
  Coverage   89.39%   89.39%           
=======================================
  Files         415      415           
  Lines       75230    75230           
  Branches    12366    12366           
=======================================
  Hits        67249    67249           
  Misses       5149     5149           
  Partials     2832     2832

@cbrnr cbrnr changed the title Do not exclude bads if channel indices are supplied [MRG] Do not exclude bads if channel indices are supplied Aug 20, 2019
@cbrnr
Copy link
Copy Markdown
Contributor Author

cbrnr commented Aug 20, 2019

Regarding spatial_colors=True, actually all 4 channels are plotted, but one of them in light light almost white gray so that I was not able to see it.
Figure_1
Not sure if this is intended or should be changed, but not in this PR. So I guess the original issue has been resolved and this is ready for merge.

@agramfort
Copy link
Copy Markdown
Member

it's because colors are coming from relative position on the topo (not absolute)

can you open a dedicated issue?

@agramfort agramfort merged commit 86ab291 into mne-tools:master Aug 20, 2019
@cbrnr cbrnr deleted the plot_psd_bads branch August 21, 2019 06:43
alexrockhill pushed a commit to alexrockhill/mne-python that referenced this pull request Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ignoring bads in raw.plot_psd doesn't work

3 participants