def test_epoch_eq(): """Test epoch count equalization""" epochs_1 = Epochs(raw, events, event_id, tmin, tmax, picks=picks) epochs_2 = Epochs(raw, events, event_id_2, tmin, tmax, picks=picks) assert_true(epochs_1.events.shape[0] != epochs_2.events.shape[0]) equalize_epoch_counts(epochs_1, epochs_2) assert_true(epochs_1.events.shape[0] == epochs_2.events.shape[0])
preload=True) event_id = 3 # L visual epochs2 = mne.Epochs(raw, events, event_id, tmin, tmax, picks=picks, baseline=(None, 0), reject=reject, preload=True) # Equalize trial counts to eliminate bias (which would otherwise be # introduced by the abs() performed below) equalize_epoch_counts(epochs1, epochs2) ############################################################################### # Transform to source space fname_inv = data_path + '/MEG/sample/sample_audvis-meg-oct-6-meg-inv.fif' snr = 3.0 lambda2 = 1.0 / snr**2 method = "dSPM" # use dSPM method (could also be MNE or sLORETA) inverse_operator = read_inverse_operator(fname_inv) sample_vertices = [s['vertno'] for s in inverse_operator['src']] # Let's average and compute inverse, resampling to speed things up evoked1 = epochs1.average() evoked1.resample(50) condition1 = apply_inverse(evoked1, inverse_operator, lambda2, method)
############################################################################### # Read epochs for all channels, removing a bad one exclude = ['MEG 2443'] picks = fiff.pick_types(raw.info, meg=True, eog=True, exclude=exclude) event_id = 1 # L auditory reject = dict(grad=1000e-13, mag=4000e-15, eog=150e-6) epochs1 = mne.Epochs(raw, events, event_id, tmin, tmax, picks=picks, baseline=(None, 0), reject=reject, preload=True) event_id = 3 # L visual epochs2 = mne.Epochs(raw, events, event_id, tmin, tmax, picks=picks, baseline=(None, 0), reject=reject, preload=True) # Equalize trial counts to eliminate bias (which would otherwise be # introduced by the abs() performed below) equalize_epoch_counts(epochs1, epochs2) ############################################################################### # Transform to source space fname_inv = data_path + '/MEG/sample/sample_audvis-meg-oct-6-meg-inv.fif' snr = 3.0 lambda2 = 1.0 / snr ** 2 method = "dSPM" # use dSPM method (could also be MNE or sLORETA) inverse_operator = read_inverse_operator(fname_inv) sample_vertices = [s['vertno'] for s in inverse_operator['src']] # Let's average and compute inverse, resampling to speed things up evoked1 = epochs1.average() evoked1.resample(50) condition1 = apply_inverse(evoked1, inverse_operator, lambda2, method)