Пример #1
0
# First show unprocessed, then cleaned epochs
mags = mne.pick_types(epochs.info, meg='mag', exclude=[])
fig, axes = plt.subplots(2, 2, sharex=True, sharey=True)
times = epochs.times * 1e3
scale = 1e15
titles = ['raw - ', 'cleaned - ']
ecg_ch = epochs.ch_names.index(ecg_ch_name)
for e, (ax1, ax2), title in zip([epochs, epochs_ica], axes.T, titles):
    ax1.plot(times, e.average(mags).data.T * scale, color='k')
    ax1.set_title(title + 'evoked')
    ax2.plot(times, e._data[some_trial, ecg_ch].T * scale, color='r')
    ax2.set_title(title + 'single trial')
    if title == 'raw':
        ax1.set_ylabel('data (fT)')
    else:
        ax2.set_xlabel('Time (ms)')

###############################################################################
# Inspect evoked ICA sources

# create ICA Epochs object.
ica_epochs = ica.sources_as_epochs(epochs)

# don't exclude bad sources by passing an empty list.
ica_picks = mne.pick_types(ica_epochs.info, misc=True, exclude=[])
ica_evoked = ica_epochs.average(ica_picks)
ica_evoked.plot(titles=dict(misc='ICA sources'))

# Tip: use this for epochs constructed around ECG r-peaks to check whether all
# ECG components were identified.
Пример #2
0
# First show unprocessed, then cleaned epochs
mags = mne.fiff.pick_types(epochs.info, meg='mag', exclude=[])
fig, axes = plt.subplots(2, 2, sharex=True, sharey=True)
times = epochs.times * 1e3
scale = 1e15
titles = ['raw - ', 'cleaned - ']
ecg_ch = epochs.ch_names.index(ecg_ch_name)
for e, (ax1, ax2), title in zip([epochs, epochs_ica], axes.T, titles):
    ax1.plot(times, e.average(mags).data.T * scale, color='k')
    ax1.set_title(title + 'evoked')
    ax2.plot(times, e._data[some_trial, ecg_ch].T * scale, color='r')
    ax2.set_title(title + 'single trial')
    if title == 'raw':
        ax1.set_ylabel('data (fT)')
    else:
        ax2.set_xlabel('Time (ms)')

###############################################################################
# Inspect evoked ICA sources

# create ICA Epochs object.
ica_epochs = ica.sources_as_epochs(epochs)

# don't exclude bad sources by passing an empty list.
ica_picks = mne.fiff.pick_types(ica_epochs.info, misc=True, exclude=[])
ica_evoked = ica_epochs.average(ica_picks)
ica_evoked.plot(titles=dict(misc='ICA sources'))

# Tip: use this for epochs constructed around ECG r-peaks to check whether all
# ECG components were identified.