How to create windows (frames) from the edf files? (With condition based overlap)

  • MNE-Python version: 0.23.4
  • operating system: Linux

Hi everyone,
I’m new to the MNE library. I have a question about windowing EEG data. I’m working on an EEG dataset in order to detect Seizures. The dataset I’m using is CHB-MIT Scalp. There are a couple of issues I’m experiencing:

1 - I wanted to window the data using MNE, but there are no events in the dataset. The only worthwhile events are when the seizures are recorded which are stored in a txt file for each patient. Plus, for my baseline task I want to create consistent constant width time windows from all patients and all edf files, which Epochs in MNE apparently does not (or does it?) I’ve found about Braindecode library that gives this functionality, but it has a problem that I will address in the next point.

2 - Given that the seizures are scarce in the dataset, I need to window the parts of the EEG data representing seizures with more overlap in comparison to non-seizure parts. This is a label based augmentation step to make the dataset imbalance less of an issue. Is there any way to window EEG signals with variable overlap? Braindecode does not offer any form of overlap between windows.

3 - What is the fastest way to create such windows, and is it possible to do this lazily?

Thanks for your response in advance.

  1. Maybe try making fixed-length “events”, which for you would just be window start times? There is a command for this:

  1. Maybe run the above command with different settings for different sections of your time series. And can run multiple times for a given section, then concatenation the events to create overlap.