<s> """<STR_LIT>""" <EOL> import numpy as np <EOL> import matplotlib . pyplot as plt <EOL> import mne <EOL> from mne . datasets import sample <EOL> from mne . minimum_norm import read_inverse_operator , compute_source_psd_epochs <EOL> print ( __doc__ ) <EOL> data_path = sample . data_path ( ) <EOL> fname_inv = data_path + '<STR_LIT>' <EOL> fname_raw = data_path + '<STR_LIT>' <EOL> fname_event = data_path + '<STR_LIT>' <EOL> label_name = '<STR_LIT>' <EOL> fname_label = data_path + '<STR_LIT>' % label_name <EOL> event_id , tmin , tmax = <NUM_LIT:1> , - <NUM_LIT> , <NUM_LIT:0.5> <EOL> snr = <NUM_LIT:1.0> <EOL> lambda2 = <NUM_LIT:1.0> / snr ** <NUM_LIT:2> <EOL> method = "<STR_LIT>" <EOL> inverse_operator = read_inverse_operator ( fname_inv ) <EOL> label = mne . read_label ( fname_label ) <EOL> raw = mne . io . read_raw_fif ( fname_raw ) <EOL> events = mne . read_events ( fname_event ) <EOL> include = [ ] <EOL> raw . info [ '<STR_LIT>' ] += [ '<STR_LIT>' ] <EOL> picks = mne . pick_types ( raw . info , meg = True , eeg = False , stim = False , eog = True , <EOL> include = include , exclude = '<STR_LIT>' ) <EOL> epochs = mne . Epochs ( raw , events , event_id , tmin , tmax , picks = picks , <EOL> baseline = ( None , <NUM_LIT:0> ) , reject = dict ( mag = <NUM_LIT> , grad = <NUM_LIT> , <EOL> eog = <NUM_LIT> ) ) <EOL> fmin , fmax = <NUM_LIT:0.> , <NUM_LIT> <EOL> bandwidth = <NUM_LIT> <EOL> stcs = compute_source_psd_epochs ( epochs , inverse_operator , lambda2 = lambda2 , <EOL> method = method , fmin = fmin , fmax = fmax , <EOL> bandwidth = bandwidth , label = label , <EOL> return_generator = True ) <EOL> n_epochs = <NUM_LIT:10> <EOL> for i , stc in enumerate ( stcs ) : <EOL> if i >= n_epochs : <EOL> break <EOL> if i == <NUM_LIT:0> : <EOL> psd_avg = np . mean ( stc . data , axis = <NUM_LIT:0> ) <EOL> else : <EOL> psd_avg += np . mean ( stc . data , axis = <NUM_LIT:0> ) <EOL> psd_avg /= n_epochs <EOL> freqs = stc . times <EOL> plt . figure ( ) <EOL> plt . plot ( freqs , psd_avg ) <EOL> plt . xlabel ( '<STR_LIT>' ) <EOL> plt . ylabel ( '<STR_LIT>' ) <EOL> plt . show ( ) </s>
