Пример #1
0
raw, stc_signal = simulate_raw(info=info,
                               fwd_disc_true=fwd_disc_true,
                               signal_vertex=config.vertex,
                               signal_freq=config.signal_freq,
                               n_trials=config.n_trials,
                               noise_multiplier=config.noise,
                               random_state=config.random,
                               n_noise_dipoles=config.n_noise_dipoles_vol,
                               er_raw=er_raw)

true_ori = fwd_disc_true['src'][0]['nn'][config.vertex]

# del info, fwd_disc_true, er_raw

epochs = create_epochs(raw)

###############################################################################
# Sensor-level analysis
###############################################################################

epochs_grad = epochs.copy().pick_types(meg='grad')
epochs_mag = epochs.copy().pick_types(meg='mag')
epochs_joint = epochs.copy().pick_types(meg=True)

# Make cov matrices
cov = mne.compute_covariance(epochs, tmin=0, tmax=1, method='empirical')
noise_cov = mne.compute_covariance(epochs, tmin=-1, tmax=0, method='empirical')

# Compute evokeds
evoked_grad = epochs_grad.average()
    raw2, stc_signal2 = add_source_to_raw(raw,
                                          fwd_disc_true=fwd_disc_true,
                                          signal_vertex=nb_vertex,
                                          signal_freq=config.signal_freq2,
                                          trial_length=config.trial_length,
                                          n_trials=config.n_trials,
                                          source_type='chirp')

    ###############################################################################
    # Create epochs
    ###############################################################################

    title = 'Simulated evoked for two signal vertices'
    epochs = create_epochs(raw2,
                           title=title,
                           fn_simulated_epochs=None,
                           fn_report_h5=fn_report_h5)

    epochs_grad = epochs.copy().pick_types(meg='grad')
    epochs_mag = epochs.copy().pick_types(meg='mag')
    epochs_joint = epochs.copy().pick_types(meg=True)

    # Make CSDs
    csd = csd_morlet(epochs, [config.signal_freq, config.signal_freq2],
                     tmin=0,
                     tmax=1,
                     decim=5)
    noise_csd = csd_morlet(epochs, [config.signal_freq, config.signal_freq2],
                           tmin=-1,
                           tmax=0,
                           decim=5)