eegunity.modules.correction#

Submodules#

eegunity.modules.correction.eeg_correction module#

class eegunity.modules.correction.eeg_correction.EEGCorrection(main_instance)[source]#

Bases: _UDatasetSharedAttributes

This is a key module of UnifiedDataset class, with focus on data correction. This EEGCorrection class has the same attributes as the UnifiedDataset class. In this class, we define the functions relative to data correction.

report()[source]#

Generate a statistical report on the dataset, providing proportions for file types, sampling rates, channel configurations, and completeness checks. The report can be generated for the dataset as a whole or for individual groups based on domain tags.

The report includes: - File Type Proportions (%) - Sampling Rate Proportions (%) - Channel Configuration Proportions (%) - Completeness Check Proportions (%)

Returns:

  • dict (A dictionary containing the computed proportions for file types,)

  • sampling rates, channel configurations, and completeness checks for each domain or overall.

Examples

>>> unified_dataset.eeg_correction.report()
visualization_channels_corr(max_sample=16)[source]#

Visualize the correlation between EEG data channels for different domains.

This method computes and visualizes the correlation matrix between EEG channels for each domain available in the dataset. For each domain, a sample of EEG data is selected, and the correlation between channels is plotted as a matrix.

Parameters:

max_sample (int, optional) – The maximum number of samples to visualize per domain. If the number of available samples exceeds this value, a random subset of samples is selected. Default is 16.

Returns:

This function does not return any value. It generates and displays a set of correlation matrix plots for each domain.

Return type:

None

Note

  • This function uses the np.corrcoef method to compute the correlation matrix.

  • The visualization is created using matplotlib, and the correlation values range from -1 to 1.

Example

>>> # To visualize the correlation matrices for up to 10 samples per domain:
>>> unified_dataset.eeg_batch.visualization_channels_corr(max_sample=10)
visualization_frequency(max_sample: int = 10)[source]#

Visualize the frequency spectrum for each domain in the dataset.

For each domain in the dataset, this function computes and visualizes the amplitude spectrum of the data. The number of samples visualized per domain is limited by the max_sample parameter. If a domain contains more samples than this limit, a random subset will be selected.

Parameters:

max_sample (int, optional) – The maximum number of samples to visualize per domain. If the number of samples in a domain exceeds this value, a random subset will be used. The default value is 10.

Returns:

This function does not return any value. It displays frequency spectrum plots for each domain in the dataset.

Return type:

None

Note

If a domain contains inconsistent sampling rates across its samples, the data will be resampled to the lowest sampling rate within the domain. Frequency bands for visualization are fixed as follows: 0-4 Hz, 4-8 Hz, and 8-13 Hz, 13-30 Hz.

Example

>>> unified_dataset.eeg_correction.visualization_frequency(max_sample=5)
>>> # This will visualize the frequency spectrum for up to 5 samples per domain from the dataset.

Module contents#