braindecode.augmentation.functional.bandstop_filter#

braindecode.augmentation.functional.bandstop_filter(X, y, sfreq, bandwidth, freqs_to_notch)[source]#

Apply a band-stop filter with desired bandwidth at the desired frequency position.

Suggested e.g. in [1] and [2]

Parameters
  • X (torch.Tensor) – EEG input example or batch.

  • y (torch.Tensor) – EEG labels for the example or batch.

  • sfreq (float) – Sampling frequency of the signals to be filtered.

  • bandwidth (float) – Bandwidth of the filter, i.e. distance between the low and high cut frequencies.

  • freqs_to_notch (array-like | None) – Array of floats of size (batch_size,) containing the center of the frequency band to filter out for each sample in the batch. Frequencies should be greater than bandwidth/2 + transition and lower than sfreq/2 - bandwidth/2 - transition (where transition = 1 Hz).

Returns

  • torch.Tensor – Transformed inputs.

  • torch.Tensor – Transformed labels.

References

1

Cheng, J. Y., Goh, H., Dogrusoz, K., Tuzel, O., & Azemi, E. (2020). Subject-aware contrastive learning for biosignals. arXiv preprint arXiv:2007.04871.

2

Mohsenvand, M. N., Izadi, M. R., & Maes, P. (2020). Contrastive Representation Learning for Electroencephalogram Classification. In Machine Learning for Health (pp. 238-253). PMLR.