Added some files, updated some files

This commit is contained in:
2021-03-27 21:42:55 +01:00
parent fc4eec6ac7
commit 287fdf5c9e
7 changed files with 78 additions and 283 deletions

View File

@@ -128,7 +128,7 @@ def decoding(dataset, filename, compute_metric=True, mask=None):
# Compute the permutation tests
for t in range(len(metric[0][index:])):
score_t = np.asarray(metric[:, t + index])
p = permutation_test(baseline, score_t, 100)
p = permutation_test(baseline, score_t, 1000)
p_values.append(p)
if t % 50 == 0:
print(str(t) + " Out of " + str(len(metric[0][index:])))
@@ -184,7 +184,8 @@ def time_frequency(dataset, filename, compute_tfr=True):
"""
# Parameters
# Frequency space (from, to, steps) -> Control frequency resolution : Between num=50-80 good for 1-50Hz
freqs = np.logspace(*np.log10([0.5, 50]), num=50) #
# freqs = np.linspace(0.1, 50, num=50) #
freqs = np.logspace(*np.log10([0.1, 50]), num=50)
# Number of cycles -> Controls time resolution ? At ~freqs/2 good for high frequency resolution
n_cycles = freqs / 2 # 1 for high time resolution & freq smoothing, freqs/2 for high freq resolution & time smooth
# Baseline -> Should not go post-stimulus, i.e. > 0 -> Best ist pre-stimulus (e.g. -400 to -200ms)
@@ -223,7 +224,8 @@ def time_frequency(dataset, filename, compute_tfr=True):
cond2 = np.load('cached_data/tf_data/' + filename + '_cond2.npy', allow_pickle=True).tolist()
if times is None:
times = cond1[0].times
mne.grand_average(cond2).plot(picks=['P7'], vmin=-3, vmax=3, title='Grand Average P7')
# mne.grand_average(cond1).plot(picks=['P7'], vmin=-3, vmax=3, title='Grand Average P7')
# mne.grand_average(cond2).plot(picks=['P7'], vmin=-3, vmax=3, title='Grand Average P7')
plot_oscillation_bands(mne.grand_average(cond1))
plot_oscillation_bands(mne.grand_average(cond2))
F, clusters, cluster_p_values, h0 = mne.stats.permutation_cluster_test(
@@ -236,4 +238,5 @@ if __name__ == '__main__':
mne.set_log_level(verbose=VERBOSE_LEVEL)
ds = 'N170'
# decoding(ds, 'faces_vs_cars_100iters', False)
# time_frequency(ds, 'face_intact_vs_all_0.1_50hz_ncf2', False)
time_frequency(ds, 'face_intact_vs_all_0.1_50hz_ncf2', False)