braindecode.augmentation.FrequencyShift

class braindecode.augmentation.FrequencyShift(probability, sfreq, max_delta_freq=2, random_state=None)

Add a random shift in the frequency domain to all channels.

Note that here, the shift is the same for all channels of a single example.

Parameters
probabilityfloat

Float setting the probability of applying the operation.

sfreqfloat

Sampling frequency of the signals to be transformed.

max_delta_freqfloat | torch.Tensor, optional

Maximum shift in Hz that can be sampled (in absolute value). Defaults to 2 (shift sampled between -2 and 2 Hz).

random_state: int | numpy.random.Generator, optional

Seed to be used to instantiate numpy random number generator instance. Defaults to None.

Methods

get_params(*batch)

Return transform parameters.

Parameters
Xtensor.Tensor

The data.

ytensor.Tensor

The labels.

Returns
paramsdict

Contains

  • delta_freqfloat

    The amplitude of the frequency shift (in Hz).

  • sfreqfloat

    Sampling frequency of the signals to be transformed.

static operation(X, y, delta_freq, sfreq)

Adds a shift in the frequency domain to all channels.

Note that here, the shift is the same for all channels of a single example.

Parameters
Xtorch.Tensor

EEG input example or batch.

ytorch.Tensor

EEG labels for the example or batch.

delta_freqfloat

The amplitude of the frequency shift (in Hz).

sfreqfloat

Sampling frequency of the signals to be transformed.

Returns
torch.Tensor

Transformed inputs.

torch.Tensor

Transformed labels.

Examples using braindecode.augmentation.FrequencyShift