sample_data_folder = mne.datasets.sample.data_path() sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample', 'sample_audvis_filt-0-40_raw.fif') raw = mne.io.read_raw_fif(sample_data_raw_file) Opening raw data file /home/zhkgo/mne_data/MNE-sample-data/MEG/sample/sample_audvis_filt-0-40_raw.fif... Read a total of 4 projection items: PCA-v1 (1 x 102) idle PCA-v2 (1 x 102) idle PCA-v3 (1 x 102) idle Average EEG reference (1 x 60) idle Range : 6450 ... 48149 = 42.956 ... 320.665 secs Ready.
raw.plot_psd(fmax=50) _=raw.plot(duration=5, n_channels=30) Effective window size : 13.639 (s) Effective window size : 13.639 (s) Effective window size : 13.639 (s)
findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans. findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans. findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans. findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans.
# set up and fit the ICA ica = mne.preprocessing.ICA(n_components=20, random_state=97, max_iter=800) ica.fit(raw) ica.exclude = [1, 2] #这边就是跳过的步骤,关于为什么选择1,2两个成分 ica.plot_properties(raw, picks=ica.exclude) Fitting ICA to data using 364 channels (please be patient, this may take a while) Inferring max_pca_components from picks Selecting by number: 20 components Fitting ICA took 2.3s. Using multitaper spectrum estimation with 7 DPSS windows Not setting metadata Not setting metadata 138 matching events found No baseline correction applied 0 projection items activated 0 bad epochs dropped Not setting metadata Not setting metadata 138 matching events found No baseline correction applied 0 projection items activated 0 bad epochs dropped
findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans. [<Figure size 2100x1800 with 6 Axes>, <Figure size 2100x1800 with 6 Axes>]
fig = mne.viz.plot_events(events, event_id=event_dict, sfreq=raw.info['sfreq'], first_samp=raw.first_samp) findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans.
epochs = mne.Epochs(raw, events, event_id=event_dict, tmin=-0.2, tmax=0.5, reject=reject_criteria, preload=True) Not setting metadata Not setting metadata 319 matching events found Applying baseline correction (mode: mean) Created an SSP operator (subspace dimension = 4) 4 projection items activated Loading data for 319 events and 106 original time points ... Rejecting epoch based on EOG : ['EOG 061'] Rejecting epoch based on EOG : ['EOG 061'] Rejecting epoch based on MAG : ['MEG 1711'] Rejecting epoch based on EOG : ['EOG 061'] Rejecting epoch based on EOG : ['EOG 061'] Rejecting epoch based on MAG : ['MEG 1711'] Rejecting epoch based on EEG : ['EEG 008'] Rejecting epoch based on EOG : ['EOG 061'] Rejecting epoch based on EOG : ['EOG 061'] Rejecting epoch based on EOG : ['EOG 061'] 10 bad epochs dropped
aud_epochs.plot_image(picks=['MEG 1332', 'EEG 021']) Not setting metadata Not setting metadata 136 matching events found No baseline correction applied 0 projection items activated 0 bad epochs dropped Not setting metadata Not setting metadata 136 matching events found No baseline correction applied 0 projection items activated 0 bad epochs dropped [<Figure size 1800x1200 with 4 Axes>, <Figure size 1800x1200 with 4 Axes>]