Calculating connectivity out of EEG signal segments

  • MNE version: 1.5.0
  • operating system: Windows 10
  • Python version: 3.11.4
  • MNE-Connectivity version: 0.5.0

Hello, everyone.
I’m getting confused when creating epochs out of my raw file. My ECG recordings are in .edf extension and I want to analyze only segments of 20 seconds in order to have 1 second-length epochs. I used the function mne.Annotations() to set the time where I want my signal to be analyzed and then created the epochs as follow:

segmentos_raw = mne.Annotations(onset = [368,466,487,507,528,549,594,748,769], duration = [20], description = ['1','2','3','4','5','6','7','8','9'])
raw.set_annotations(segmentos_raw)
event_1s = mne.events_from_annotations(raw)
epoc_1s = mne.Epochs(canales, event_1s[0], tmin=0, tmax=1, baseline=None)
conect = spectral_connectivity_epochs(epoc_1s, method='coh', sfreq=Fs, mode='fourier', fmin=8, fmax=13, faverage=True)

Does mne.Epochs() and mne.spectal_connectivity_epochs() creates the epoch where the events start or does it take all the data from the signal?

I don’t know if using raw.crop(tmin, tmax) to select the desired segments and mne.make_fixed_length_epochs() is more suitable for connectivity calculation?

If what you want is equally-spaced epochs then you should use mne.make_fixed_length_epochs() on your Raw data object. There is no need to create the Annotations first. You might need to use .crop() on the Raw data first, if there are parts of the recording that you want to ignore that come before/after the desired 20 seconds.

1 Like