EEG - Alpha Band Extraction
Difficulty Level:
 Tags extract☁eeg☁alpha frequency band

Electroencephalogram (EEG) acquired signals reflect the neuronal activity of specific brain areas. For each signal the magnitude of different frequency bands can be extracted, which vary when performing specific tasks.

This Jupyter Notebook provides a simple example on how to extract the alpha frequency band as well as the alpha band power from an EEG acquisition. For further information on EEG frequency bands please refer to Electroencephalography Freq. Bands . The absolute value of alpha band power can be used inter alia to evaluate the state of eyes open or closed. It is measured by integrating the area of the power spectrum in the range of the alpha frequencies. The band power represents the magnitude of a specific frequency band.

Alpha-band oscillations range in frequencies of 8-12 Hz and originate in the occipital lobe. Alpha waves are associated to a specific process and are mainly present when the eyes are closed and mainly blocked when the eyes are open.

Read more detailed information on Alpha Waves .

1 - Importation of the needed packages

In [1]:
# Biosignalsnotebooks python package
import biosignalsnotebooks as bsnb

# Scientific packages
from numpy import loadtxt, array, mean, logical_and, trapz
from scipy.signal import spectrogram, welch


2 - Loading of acquired EEG data and proceed to Unit Conversion
For a detailed explanation on how to load the acquired EEG data as well as performing the Unit Conversion of the raw data, please refer to the notebooks Load acquired data from .txt file , Signal Loading and EEG-Unit Conversion

In [2]:
# Load Data from file path

# [The acquired EEG data is at channel 1 ("CH1")]
eeg_data = data["CH1"]


2.1 - Store some acquisition constants inside variables
Two extremely relevant parameters defined before data acquisition are the sampling rate and ADC resolution

In [3]:
sr = header["sampling rate"] # Sampling Rate


2.2 - Conversion of ADC sample values to physical units (uV) and generation of a time-axis
The device used to acquire EEG data belongs to the "biosignalsplux" model, information that should be passed as an input of raw_to_phy function.

In [4]:
#Unit Conversion
signal_uv = bsnb.raw_to_phy("EEG", "biosignalsplux", eeg_data, resolution, "uV")
time_uv = bsnb.generate_time(signal_uv, sr)


2.3 - Plotting the Raw Data
The following plot illustrates the raw eeg data for open and closed eyes:

In [5]:
bsnb.plot_eeg_signal_wind(time_uv, signal_uv, time_range=[58, 200], time_windows_evt_1=[(58, 89), (119, 149)], time_windows_evt_2=[(89, 119), (149, 179)], y_axis_label="Electric Voltage (uV)")