How to make overlapped data with make_fixed_length_epochs?

Dear MNE users,

I want to make data with the size is 1 second and is shifted 0.2 second, namely, overlapping windowed data.

If I used mne.make_fixed_length_epochs(raw, duration=1,preload=Flase), I can make 1 second data, but there is no overlapping between each window. Do you know how to make overlapped data ?

Best,
Kyu

Hello @kyuwanchoi,

make_fixed_length_epochs() has an overlap parameter that should do what you want!

Best wishes,
Richard

1 Like

Hi Richard, thanks for your reply.

when I checked make_fixed_length_epcohs() it does not have an overlap parameter. How can I change the input as follows for 80 % overlap? (sliding windows are shifted every 0.2 sec).

mne.make_fixed_length_epochs(raw, duration=1, preload=False)

Best,
Kyu

You need MNE-Python 0.23 to get the overlap parameter. Please see the description in the documentation I linked to.

Best,
Richard

Richard, thank you so much for your support!

First, I installed the latest mne. When I typed pip install mne. I received the reply as follows,

Requirement already satisfied: mne in c:\users\choikx4\anaconda3\envs\mne\lib\site-packages (0.23.0)

I used the command as follows,
epochs = mne.make_fixed_length_epochs(raw, duration=1, preload=False, overlap=0.8)

Then, I have got the error as follows,
TypeError: make_fixed_length_epochs() got an unexpected keyword argument ‘overlap’

What’s wrong with me?

Kyu

I cannot reproduce this problem. Maybe you forgot to activate the correct conda environment, so you weren’t actually using version 0.23 at the time? Try again like this:

epochs = mne.make_fixed_length_epochs(raw, duration=1, preload=False, overlap=0.8)

and if you still get the error, do

print(mne.__version__)

to confirm that you’re in a python environment that has access to the v0.23 that you installed.

1 Like

Thank you Dan, I checked the version. My version is 0.22.dev0.

How to update my version to v0.23?

https://mne.tools/stable/install/updating.html

2 Likes