Analyze Electrooculography (EOG)

Analyze Electrooculography (EOG)#

This example can be referenced by citing the package.

This example shows how to use NeuroKit to analyze EOG data.

# Load NeuroKit and other useful packages
import matplotlib.pyplot as plt
import numpy as np

import neurokit2 as nk

Explore the EOG signal#

Let’s load the example dataset corresponding to a vertical EOG signal.

eog_signal = nk.data("eog_100hz.csv")

nk.signal_plot(eog_signal)
../../_images/6b881029b97a3adc18ee68d94e19def9e8158aacd7355f6dcb05a0cb42cb3d7b.png

Let’s zoom in to some areas where clear blinks are present.

nk.signal_plot(eog_signal[100:1700])
../../_images/3f8c1b87631088f40bb2688a44d57495716c47141278d2164ed97c34a183dce1.png

Clean the signal#

We can now filter the signal to remove some noise and trends.

eog_cleaned = nk.eog_clean(eog_signal, sampling_rate=100, method="neurokit")

Let’s visualize the same chunk and compare the clean version with the original signal.

nk.signal_plot([eog_signal[100:1700], eog_cleaned[100:1700]], labels=["Raw Signal", "Cleaned Signal"])
../../_images/d2b3c7680a8e4138082778e955aae2649ac328f21afd4e7a78dfbecf697bd113.png