selfeeg.augmentation

This is the data augmentation module of the selfEEG library. It is divided in two submodules:

  • Functional: a collection of data augmentations compatible with numpy arrays and torch tensors moved to both CPU or GPU devices.

  • Compose: a collection of classes designed to combine data augmentations in complex patterns.

augmentation.compose module

Classes

CircularAug

Single Augmenter called sequentially from a list, following a circular order.

DynamicSingleAug

Single augmentation with randomly chosen arguments.

RandomAug

Random augmentation chosen from a given set.

SequentialAug

Multiple augmentations applied sequentially.

StaticSingleAug

Single static augmentation with preset arguments.

augmentation.functional module

Functions

add_band_noise

adds random noise filtered at specific bandwidths.

add_eeg_artifact

add common EEG artifacts to the ArrayLike object.

add_gaussian_noise

adds gaussian noise with the desired standard deviation.

add_noise_SNR

add noise to the input ArrayLike object such that its SNR (Signal to Noise Ratio) will be the one desired.

change_ref

changes the reference of all EEG record in the ArrayLike object.

channel_dropout

puts to 0 a given (or random) amount of channels of the ArrayLike object.

crop_and_resize

crops some segments of the ArrayLike object.

filter_bandpass

applies a bandpass filter on the last dimension of the ArrayLike.

filter_bandstop

applies a bandstop filter on the last dimension of the ArrayLike object.

filter_highpass

applies an highpass filter on the last dimension of the ArrayLike object.

filter_lowpass

applies a lowpass filter on the last dimension of the ArrayLike.

flip_horizontal

flips the elements of the ArrayLike object along its last dimension.

flip_vertical

changes the sign of all the elements of the input.

get_channel_map_and_networks

returns the channel_map and the chan_net arguments for permute_channels.

get_filter_coeff

returns the coefficients a and b necessary to run filtering augmentations.

identity

returns the same array or tensor it was given.

masking

puts to zero random portions of the ArrayLike object.

moving_avg

applies a moving average filter to the input ArrayLike object.

permutation_signal

permutes some portions of the ArrayLike object along its last dimension.

permute_channels

permutes the ArrayLike object along the EEG channel dimension.

phase_swap

Apply the phase swap data augmentation to the ArrayLike object.

random_FT_phase

randomizes the phase of all signals in the input ArrayLike object.

random_slope_scale

randomly scales the first derivative of x.

scaling

rescales the ArrayLike object by a given amplitude.

shift_frequency

shifts the frequency components of the signals included in the ArrayLike object.

shift_horizontal

Shifts temporally the elements of the ArrayLike object.

shift_vertical

adds a scalar value to the ArrayLike object.

warp_signal

stretches and squeezes portions of the ArrayLike object.