Welch Periodogram

Description

This module implements the Welch Periodogram feature extractor, which computes the power spectral density (PSD) of EEG signals using Welch’s method. This feature is commonly used in BCI applications to analyze the frequency content of brain activity.

Welch’s method divides the signal into overlapping segments, computes the periodogram for each segment, and averages the results to reduce noise.

Class

class bciflow.modules.fe.welch_period.welch_period(flating: bool = False)[source]

Bases: object

flating

If True, the output data is returned in a flattened format (default is False).

Type:

bool

fit(eegdata)[source]

This method does nothing, as the Welch Periodogram feature extractor does not require training.

Parameters:

eegdata (dict) – The input data.

Return type:

self

fit_transform(eegdata, sfreq: int) dict[source]

This method combines fitting and transforming into a single step. It returns a dictionary with the transformed data.

Parameters:
  • eegdata (dict) – The input data.

  • sfreq (int) – The sampling frequency of the EEG data.

Returns:

output – The transformed data.

Return type:

dict

transform(eegdata, sfreq: int) dict[source]

This method computes the power spectral density (PSD) using Welch’s method for each trial, band, and channel in the input data. The result is stored in the dictionary under the key ‘X’.

Parameters:
  • eegdata (dict) – The input data.

  • sfreq (int) – The sampling frequency of the EEG data.

Returns:

output – The transformed data.

Return type:

dict