Files
semesterproject_lecture_eeg/test/visual_sanity_checks.py
2021-03-27 14:58:49 +01:00

20 lines
678 B
Python

from utils.file_utils import load_preprocessed_data, get_epochs
def check_peaks():
"""
Sanity check for the "get_peaks" method
"""
import matplotlib.pyplot as plt
raw = load_preprocessed_data('002', 'N170')
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.show()
check_peaks()