Documentation of eeglib.features module

This module define the functions of the features for EEG analysis

eeglib.features.DFA(data, fit_degree=1, min_window_size=4, max_window_size=None, fskip=1, max_n_windows_sizes=None)

Applies Detrended Fluctuation Analysis algorithm to the given data.

Parameters
data: array_like

The signal.

fit_degree: int, optional

Degree of the polynomial used to model de local trends. Default: 1.

min_window_size: int, optional

Size of the smallest window that will be used. Default: 4.

max_window_size: int, optional

Size of the biggest window that will be used. Default: signalSize//4

fskip: float, optional

Fraction of the window that will be skiped in each iteration for each window size. Default: 1

max_n_windows_sizes: int, optional

Maximum number of window sizes that will be used. The final number can be smaller once the repeated values are removed Default: log2(size)

Returns
float

The resulting value

eeglib.features.HFD(data, kMax=None)

Returns the Higuchi Fractal Dimension of the signal given data.

Parameters
data: array_like

signal

kMax: int, optional

By default it will be windowSize//4.

Returns
float

The resulting value

eeglib.features.LZC(data, threshold=None)

Returns the Lempel-Ziv Complexity (LZ76) of the given data.

Parameters
data: array_like

The signal.

theshold: numeric, optional

A number use to binarize the signal. The values of the signal above threshold will be converted to 1 and the rest to 0. By default, the median of the data.

References

1

M. Aboy, R. Hornero, D. Abasolo and D. Alvarez, “Interpretation of the Lempel-Ziv Complexity Measure in the Context of Biomedical Signal Analysis,” in IEEE Transactions on Biomedical Engineering, vol. 53, no.11, pp. 2282-2288, Nov. 2006.

eeglib.features.PFD(data)

Returns the Petrosian Fractal Dimension of the signal given in data.

Parameters
data: array_like

Signal

Returns
float

The resulting value

eeglib.features.bandPower(spectrum, bandsLimits, freqRes, normalize=False)

Returns the power of each band at the given index.

Parameters
spectrum: 1D arraylike

An array containing the spectrum of a signal

bandsLimits: dict

This parameter is used to indicate the bands that are going to be used. It is a dict with the name of each band as key and a tuple with the lower and upper bounds as value.

freqRes: float

Minimum resolution for the frequency.

normalize: bool, optional

If True the each band power is divided by the total power of the spectrum. Default False.

Returns
dict

The keys are the name of each band and the values are their power.

eeglib.features.countSignChanges(data)

Returns the number of sign changes of a 1D array

Parameters
data: array_like

The data from which the sign changes will be counted

Returns
int

Number of sign changes in the data

eeglib.features.hjorthActivity(data)

Returns the Hjorth Activity of the given data

Parameters
data: array_like
Returns
float

The resulting value

eeglib.features.hjorthComplexity(data)

Returns the Hjorth Complexity of the given data

Parameters
data: array_like
Returns
float

The resulting value

eeglib.features.hjorthMobility(data)

Returns the Hjorth Mobility of the given data

Parameters
data: array_like
Returns
float

The resulting value

eeglib.features.sampEn(data, m=2, l=1, r=None, fr=0.2, eps=1e-10)

Returns Sample Entropy of the given data.

Parameters
data: array_like

The signal

m: int, optional

Size of the embedded vectors. By default 2.

l: int, optional

Lag beetwen elements of embedded vectors. By default 1.

r: float, optional

Tolerance. By default fr*std(data)

fr: float, optional

Fraction of std(data) used as tolerance. If r is passed, this parameter is ignored. By default, 0.2.

eps: float, optional

Small number added to avoid infinite results. If 0 infinite results can appear. Default: 1e-10.

Returns
float

The resulting value

eeglib.features.synchronizationLikelihood(c1, c2, m, l, w1, w2, pRef=0.05, epsilonIterations=20)

Returns the Synchronization Likelihood between c1 and c2. This is a modified version of the original algorithm.

Parameters
c1: array_like

First signal

c2: array_like

second signal

m: int

Numbers of elements of the embedded vectors.

l: int

Separation between elements of the embedded vectors.

w1: int

Theiler correction for autocorrelation effects

w2: int

A window that sharpens the time resolution of the Synchronization measure

pRef: float, optional

The pRef param of the synchronizationLikelihood. Default 0.05

epsilonIterations: int,optional

Number of iterations used to determine the value of epsilon. Default:20

Returns
float

A value between 0 and 1. 0 means that the signal are not synchronized at all and 1 means that they are totally synchronized.