예제 #1
0
def test_permutation2way_test():
    """Test two way permutation test"""
    covset = generate_cov(40, 3)
    labels = np.array([0, 1]).repeat(20)
    labels2 = np.array([0, 1, 2, 3]).repeat(10)
    p = PermutationTestTwoWay(200)
    p.test(covset, labels2, labels)
    p.plot(nbins=10)
    p.summary()
    p.test(covset, labels2, labels, names=['a', 'b'])
    p.summary()
예제 #2
0
             for f in eegbci.load_data(subject, runs)]
raw = concatenate_raws(raw_files)

# Apply band-pass filter
raw.filter(7., 35., method='iir')

events = find_events(raw, shortest_event=0, stim_channel='STI 014')
picks = pick_types(raw.info, meg=False, eeg=True, stim=False, eog=False,
                   exclude='bads')

# Read epochs (train will be done only between 1 and 2s)
# Testing will be done with a running classifier
epochs = Epochs(raw, events, event_id, tmin, tmax, proj=True, picks=picks,
                baseline=None, preload=True, add_eeg_ref=False, verbose=False)
labels = epochs.events[:, -1] - 2

# get epochs
epochs_data = epochs.get_data()

# compute covariance matrices
covmats = Covariances().fit_transform(epochs_data)

session = np.array([1, 2, 3]).repeat(15)

p_test = PermutationTestTwoWay(5000)
p, F = p_test.test(covmats, session, labels, ['session', 'handsVsFeets'])
p_test.plot()
print(p_test.summary())

plt.show()
예제 #3
0
# Apply band-pass filter
raw.filter(7., 35., method='iir')

events = find_events(raw, shortest_event=0, stim_channel='STI 014')
picks = pick_types(raw.info, meg=False, eeg=True, stim=False, eog=False,
                   exclude='bads')

# Read epochs (train will be done only between 1 and 2s)
# Testing will be done with a running classifier
epochs = Epochs(raw, events, event_id, tmin, tmax, proj=True, picks=picks,
                baseline=None, preload=True, add_eeg_ref=False,verbose=False)
labels = epochs.events[:, -1] - 2

# get epochs
epochs_data = epochs.get_data()

# compute covariance matrices
covmats = Covariances().fit_transform(epochs_data) 

session = np.array([1,2,3]).repeat(15)

p_test = PermutationTestTwoWay(5000)
p,F = p_test.test(covmats,session,labels,['session','handsVsFeets'])
p_test.plot()
print p_test.summary()

plt.show()