biosppy.signals.eeg

biosppy.signals.eeg

This module provides methods to process Electroencephalographic (EEG) signals.

copyright:
  1. 2015-2026 by Instituto de Telecomunicacoes

license:

BSD 3-clause, see LICENSE for more details.

Functions

car_reference([signal])

Change signal reference to the Common Average Reference (CAR).

eeg([signal, sampling_rate, labels, path, show])

Process raw EEG signals and extract relevant signal features using default parameters.

get_plf_features([signal, sampling_rate, ...])

Extract Phase-Locking Factor (PLF) features from EEG signals between all channel pairs.

get_power_features([signal, sampling_rate, ...])

Extract band power features from EEG signals.

biosppy.signals.eeg.car_reference(signal=None)[source]

Change signal reference to the Common Average Reference (CAR).

Parameters:

signal (array) – Input EEG signal matrix; each column is one EEG channel.

Returns:

signal (array) – Re-referenced EEG signal matrix; each column is one EEG channel.

biosppy.signals.eeg.eeg(signal=None, sampling_rate=1000.0, labels=None, path=None, show=True)[source]

Process raw EEG signals and extract relevant signal features using default parameters.

Parameters:
  • signal (array) – Raw EEG signal matrix; each column is one EEG channel.

  • sampling_rate (int, float, optional) – Sampling frequency (Hz).

  • labels (list, optional) – Channel labels.

  • path (str, optional) – If provided, the plot will be saved to the specified file.

  • show (bool, optional) – If True, show a summary plot.

Returns:

  • ts (array) – Signal time axis reference (seconds).

  • filtered (array) – Filtered EEG signal.

  • features_ts (array) – Features time axis reference (seconds).

  • theta (array) – Average power in the 4 to 8 Hz frequency band; each column is one EEG channel.

  • alpha_low (array) – Average power in the 8 to 10 Hz frequency band; each column is one EEG channel.

  • alpha_high (array) – Average power in the 10 to 13 Hz frequency band; each column is one EEG channel.

  • beta (array) – Average power in the 13 to 25 Hz frequency band; each column is one EEG channel.

  • gamma (array) – Average power in the 25 to 40 Hz frequency band; each column is one EEG channel.

  • plf_pairs (list) – PLF pair indices.

  • plf (array) – PLF matrix; each column is a channel pair.

biosppy.signals.eeg.get_plf_features(signal=None, sampling_rate=1000.0, size=0.25, overlap=0.5)[source]

Extract Phase-Locking Factor (PLF) features from EEG signals between all channel pairs.

Parameters:
  • signal (array) – Filtered EEG signal matrix; each column is one EEG channel.

  • sampling_rate (int, float, optional) – Sampling frequency (Hz).

  • size (float, optional) – Window size (seconds).

  • overlap (float, optional) – Window overlap (0 to 1).

Returns:

  • ts (array) – Features time axis reference (seconds).

  • plf_pairs (list) – PLF pair indices.

  • plf (array) – PLF matrix; each column is a channel pair.

biosppy.signals.eeg.get_power_features(signal=None, sampling_rate=1000.0, size=0.25, overlap=0.5)[source]

Extract band power features from EEG signals.

Computes the average signal power, with overlapping windows, in typical EEG frequency bands:

  • Theta: from 4 to 8 Hz,

  • Lower Alpha: from 8 to 10 Hz,

  • Higher Alpha: from 10 to 13 Hz,

  • Beta: from 13 to 25 Hz,

  • Gamma: from 25 to 40 Hz.

Parameters:
  • array (signal) – Filtered EEG signal matrix; each column is one EEG channel.

  • sampling_rate (int, float, optional) – Sampling frequency (Hz).

  • size (float, optional) – Window size (seconds).

  • overlap (float, optional) – Window overlap (0 to 1).

Returns:

  • ts (array) – Features time axis reference (seconds).

  • theta (array) – Average power in the 4 to 8 Hz frequency band; each column is one EEG channel.

  • alpha_low (array) – Average power in the 8 to 10 Hz frequency band; each column is one EEG channel.

  • alpha_high (array) – Average power in the 10 to 13 Hz frequency band; each column is one EEG channel.

  • beta (array) – Average power in the 13 to 25 Hz frequency band; each column is one EEG channel.

  • gamma (array) – Average power in the 25 to 40 Hz frequency band; each column is one EEG channel.