Пример #1
0
# As the subject did not constantly move her eyes, the movement artifacts
# may remain hidden when plotting single epochs.
# Plotting the identified source across epochs reveals
# considerable EOG artifacts.
title = 'Source most similar to EOG'
ica.plot_sources_epochs(epochs, eog_source_idx, title=title)

###############################################################################
# Reject artifact sources and compare results

# Add detected artifact sources to exclusion list
ica.exclude += [ecg_source_idx, eog_source_idx]

# Restore sensor space data
epochs_ica = ica.pick_sources_epochs(epochs)

# 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)')
Пример #2
0
# get sources
sources = ica.get_sources_epochs(epochs, concatenate=True)

pl.figure()
pl.title('Source most correlated with the EOG channel')
pl.plot(sources[eog_source_idx].T)
pl.show()

###############################################################################
# Reject artifact sources and compare results

# Add the detected artifact indices to ica.exclude
ica.exclude += [ecg_source_idx, eog_source_idx]

# Restore sensor space data
epochs_ica = ica.pick_sources_epochs(epochs, include=None)

# plot original epochs
pl.figure()
epochs.average().plot()
pl.show()

# plot cleaned epochs
pl.figure()
epochs_ica.average().plot()
pl.show()

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

# create ICA Epochs object.
Пример #3
0
# As the subject did not constantly move her eyes, the movement artifacts
# may remain hidden when plotting single epochs.
# Plotting the identified source across epochs reveals
# considerable EOG artifacts.
title = 'Source most similar to EOG'
ica.plot_sources_epochs(epochs, eog_source_idx, title=title)

###############################################################################
# Reject artifact sources and compare results

# Add detected artifact sources to exclusion list
ica.exclude += [ecg_source_idx, eog_source_idx]

# Restore sensor space data
epochs_ica = ica.pick_sources_epochs(epochs)


# 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':
Пример #4
0
# get sources
sources = ica.get_sources_epochs(epochs, concatenate=True)

pl.figure()
pl.title("Source most correlated with the EOG channel")
pl.plot(sources[eog_source_idx].T)
pl.show()

###############################################################################
# Reject artifact sources and compare results

# Add the detected artifact indices to ica.exclude
ica.exclude += [ecg_source_idx, eog_source_idx]

# Restore sensor space data
epochs_ica = ica.pick_sources_epochs(epochs, include=None)

# plot original epochs
pl.figure()
epochs.average().plot()
pl.show()

# plot cleaned epochs
pl.figure()
epochs_ica.average().plot()
pl.show()

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

# create ICA Epochs object.