<s> """<STR_LIT>""" <EOL> import numpy as np <EOL> import mne <EOL> from mne . datasets import sample <EOL> from mne . preprocessing import ICA <EOL> from mne . preprocessing import create_eog_epochs <EOL> data_path = sample . data_path ( ) <EOL> raw_fname = data_path + '<STR_LIT>' <EOL> raw = mne . io . read_raw_fif ( raw_fname , preload = True ) <EOL> raw . filter ( <NUM_LIT:1> , <NUM_LIT> , n_jobs = <NUM_LIT:2> ) <EOL> picks_meg = mne . pick_types ( raw . info , meg = True , eeg = False , eog = False , <EOL> stim = False , exclude = '<STR_LIT>' ) <EOL> n_components = <NUM_LIT> <EOL> method = '<STR_LIT>' <EOL> decim = <NUM_LIT:3> <EOL> ica = ICA ( n_components = n_components , method = method ) <EOL> print ( ica ) <EOL> reject = dict ( mag = <NUM_LIT> , grad = <NUM_LIT> ) <EOL> ica . fit ( raw , picks = picks_meg , decim = decim , reject = reject ) <EOL> print ( ica ) <EOL> ica . plot_components ( ) <EOL> eog_average = create_eog_epochs ( raw , reject = dict ( mag = <NUM_LIT> , grad = <NUM_LIT> ) , <EOL> picks = picks_meg ) . average ( ) <EOL> n_max_eog = <NUM_LIT:1> <EOL> eog_epochs = create_eog_epochs ( raw , reject = reject ) <EOL> eog_inds , scores = ica . find_bads_eog ( eog_epochs ) <EOL> ica . plot_scores ( scores , exclude = eog_inds ) <EOL> ica . plot_sources ( eog_average , exclude = eog_inds ) <EOL> print ( ica . labels_ ) <EOL> ica . plot_overlay ( eog_average , exclude = eog_inds , show = False ) <EOL> ica . exclude . extend ( eog_inds ) <EOL> from mne . preprocessing . ica import corrmap <EOL> start , stop = [ <NUM_LIT:0> , len ( raw . times ) - <NUM_LIT:1> ] <EOL> intervals = np . linspace ( start , stop , <NUM_LIT:4> , dtype = int ) <EOL> icas_from_other_data = list ( ) <EOL> raw . pick_types ( meg = True , eeg = False ) <EOL> for ii , start in enumerate ( intervals ) : <EOL> if ii + <NUM_LIT:1> < len ( intervals ) : <EOL> stop = intervals [ ii + <NUM_LIT:1> ] <EOL> print ( '<STR_LIT>' . format ( start , stop ) ) <EOL> this_ica = ICA ( n_components = n_components , method = method ) . fit ( <EOL> raw , start = start , stop = stop , reject = reject ) <EOL> icas_from_other_data . append ( this_ica ) <EOL> print ( icas_from_other_data ) <EOL> reference_ica = ica <EOL> reference_ica . plot_components ( ) <EOL> reference_ica . plot_sources ( eog_average , exclude = eog_inds ) <EOL> template = ( <NUM_LIT:0> , eog_inds [ <NUM_LIT:0> ] ) <EOL> fig_template , fig_detected = corrmap ( <EOL> icas_from_other_data , template = template , label = "<STR_LIT>" , show = True , <EOL> threshold = <NUM_LIT> , ch_type = '<STR_LIT>' ) </s>
