Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
cosmit
  • Loading branch information
dengemann committed Nov 20, 2015
1 parent dfcb70d commit a4360b0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
3 changes: 1 addition & 2 deletions mne/preprocessing/ecg.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,10 @@ def create_ecg_epochs(raw, ch_name=None, event_id=999, picks=None,
ecg[None],
create_info(ch_names=['ECG-SYN'],
sfreq=raw.info['sfreq'], ch_types=['ecg']))
ignore = ['ch_names', 'chs', 'nchan']
ignore = ['ch_names', 'chs', 'nchan', 'bads']
for k, v in raw.info.items():
if k not in ignore:
ecg_raw.info[k] = v
raw.load_data()
raw.add_channels([ecg_raw])

if picks is None and not keep_ecg:
Expand Down
7 changes: 3 additions & 4 deletions mne/viz/ica.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ def plot_ica_scores(ica, scores,
If list, should match the outer shape of `scores`.
If 'ecg' or 'eog', the labels_ attributes will be looked up.
Note that '/' is used internally for sublabels specifying ECG and
EOG channels. Unless you want to lookup these labels don not use
'/'.
EOG channels.
axhline : float
Draw horizontal line to e.g. visualize rejection threshold.
title : str
Expand Down Expand Up @@ -370,9 +369,9 @@ def plot_ica_scores(ica, scores,
plt.suptitle(title)

if labels == 'ecg':
labels = [l for l in ica.labels_ if l.startswith('ecg|')]
labels = [l for l in ica.labels_ if l.startswith('ecg/')]
elif labels == 'eog':
labels = [l for l in ica.labels_ if l.startswith('eog|')]
labels = [l for l in ica.labels_ if l.startswith('eog/')]
labels.sort(key=lambda l: l.split('/')[1]) # sort by index
elif isinstance(labels, string_types):
if len(axes) > 1:
Expand Down
4 changes: 2 additions & 2 deletions tutorials/plot_ica_from_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
ecg_epochs = create_ecg_epochs(raw, tmin=-.5, tmax=.5, picks=picks)

ecg_inds, scores = ica.find_bads_ecg(ecg_epochs, method='ctps')
ica.plot_scores(scores, exclude=ecg_inds, title=title % 'ecg')
ica.plot_scores(scores, exclude=ecg_inds, title=title % 'ecg', label='ecg')

show_picks = np.abs(scores).argsort()[::-1][:5]

Expand All @@ -70,7 +70,7 @@
# detect EOG by correlation

eog_inds, scores = ica.find_bads_eog(raw)
ica.plot_scores(scores, exclude=eog_inds, title=title % 'eog')
ica.plot_scores(scores, exclude=eog_inds, title=title % 'eog', labels='eog')

show_picks = np.abs(scores).argsort()[::-1][:5]

Expand Down

0 comments on commit a4360b0

Please sign in to comment.