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 numpy as np
import pandas as pd
import matplotlib.pyplot as plt
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/2c755b151097c33c073a9dabdb9e174464348afad94580c4812ae48de11f80b2.png

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

nk.signal_plot(eog_signal[100:1700])
../../_images/a78a8bdb60181d8a6bfd0881ff838cb48794d0c920d2c96f525dfa62301129ba.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/e5fd8400fb9ddc0d62df34239354d61da9c7189d541beb73fa337c90d6513fec.png