Пример #1
0
# plot the component that correlates most with the EOG
pl.figure()
pl.plot(times, sources[eog_source_idx])
pl.title('ICA source matching EOG')
pl.show()

###############################################################################
# Show MEG data before and after ICA cleaning.

# Join the detected artifact indices.
exclude = np.r_[ecg_source_idx, eog_source_idx]

# Restore sources, use 64 PCA components which include the ICA cleaned sources
# plus additional PCA components not supplied to ICA (up to rank 64).
# This allows to control the trade-off between denoising and preserving data.
raw_ica = ica.pick_sources_raw(raw, include=None, exclude=exclude,
                               n_pca_components=64, copy=True)

start_compare, stop_compare = raw.time_as_index([100, 106])

data, times = raw[picks, start_compare:stop_compare]
ica_data, _ = raw_ica[picks, start_compare:stop_compare]

pl.figure()
pl.plot(times, data.T)
pl.xlabel('time (s)')
pl.xlim(100, 106)
pl.ylabel('Raw MEG data (T)')
y0, y1 = pl.ylim()

pl.figure()
pl.plot(times, ica_data.T)