Пример #1
0
def test_permutation_test():
    """Test one way permutation test"""
    covset = generate_cov(10, 30)
    labels = np.array([0, 1]).repeat(5)
    # base
    p = PermutationTest(10)
    p.test(covset, labels)
    # fit perm
    p = PermutationTest(10, fit_perms=True)
    p.test(covset, labels)
    # unique perms
    p = PermutationTest(1000)
    p.test(covset, labels)
    p.summary()
    p.plot(nbins=2)
Пример #2
0
# strip channel names
raw.info['ch_names'] = [chn.strip('.') for chn in raw.info['ch_names']]

# 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) 

p_test = PermutationTest(5000)
p,F = p_test.test(covmats,labels)
p_test.plot()
print p_test.summary()

plt.show()


Пример #3
0
                   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)

p_test = PermutationTest(5000)
p, F = p_test.test(covmats, labels)
p_test.plot()
print(p_test.summary())

plt.show()