Fixed some smaller things

This commit is contained in:
2021-03-28 04:46:37 +02:00
parent 3b837869fe
commit c86d46f447
13 changed files with 80 additions and 26 deletions

View File

@@ -1,4 +1,6 @@
from utils.file_utils import load_preprocessed_data, get_epochs
import mne
from utils.file_utils import get_epochs
def check_peaks():
@@ -6,13 +8,16 @@ def check_peaks():
Sanity check for the "get_peaks" method
"""
import matplotlib.pyplot as plt
raw = load_preprocessed_data('002', 'N170')
subject = '001'
folder = "../Dataset/n170/sub-" + subject + "/ses-n170/eeg/"
filepath = folder + "sub-" + subject + "_task-n170"
raw = mne.io.read_raw_fif(filepath + "_cleaned.fif")
epochs, _ = get_epochs(raw, [('face', 'intact')], picks='P7')
ch, latency, peak = epochs.average().get_peak(tmin=0.13, tmax=0.2, mode='neg', return_amplitude=True)
import numpy as np
plt.plot(epochs.times, np.squeeze(epochs.average().data.T))
plt.vlines([0.13, 0.2], -0.00001, 0.00001, colors='r', linestyles='dotted')
plt.vlines(latency, -0.00001, 0.00001, colors='gray', linestyles='dotted')
plt.vlines([0.13, 0.2], -0.00001, 0.00001, colors='gray', linestyles='dotted')
plt.vlines(latency, -0.00001, 0.00001, colors='r', linestyles='dotted')
plt.show()