affected_idx = raw.ch_names.index('MEG 1531') # plot the component that correlates most with the ECG pl.figure() pl.plot(times, data[affected_idx]) pl.title('Affected channel MEG 1531 before cleaning.') y0, y1 = pl.ylim() # plot the component that correlates most with the ECG pl.figure() pl.plot(times, ica_data[affected_idx]) pl.title('Affected channel MEG 1531 after cleaning.') pl.ylim(y0, y1) pl.show() ############################################################################### # Export ICA as raw for subsequent processing steps in ICA space. from mne.layouts import make_grid_layout ica_raw = ica.export_sources(raw, start=start, stop=stop, picks=None) print ica_raw.ch_names ica_lout = make_grid_layout(ica_raw.info) # Uncomment the following two lines to save sources and layout. # ica_raw.save('ica_raw.fif') # ica_lout.save(os.path.join(os.environ['HOME'], '.mne/lout/ica.lout'))