NeuroTechX / moabb

Mother of All BCI Benchmarks
https://neurotechx.github.io/moabb/
BSD 3-Clause "New" or "Revised" License
646 stars 168 forks source link

Fix incorrect interval in annotations #607

Closed PierreGtch closed 1 month ago

PierreGtch commented 1 month ago

The annotations added by SetRawAnnotations do not take into account the case when a dataset’s interval does not start at 0. This PR fixes it.

PierreGtch commented 1 month ago

Datasets affected since version 1.0:

imagery BNCI2014_001    interval=[2, 6]
imagery BNCI2014_002    interval=[3, 8]
imagery BNCI2014_004    interval=[3, 7.5]
imagery BNCI2015_004    interval=[3, 10]
imagery Weibo2014   interval=[3, 7]
p300 Huebner2017    interval=[-0.2, 0.7]
p300 Huebner2018    interval=[-0.2, 0.7]
p300 Sosulski2019   interval=[-0.2, 1]
ssvep Kalunga2016   interval=[2, 4]
ssvep MAMEM1    interval=[1, 4]
ssvep MAMEM2    interval=[1, 4]
ssvep MAMEM3    interval=[1, 4]
ssvep Nakanishi2015 interval=[0.15, 4.3]
ssvep Wang2016  interval=[0.5, 5.5]
bruAristimunha commented 1 month ago

We need to create more tests for this situation, but for a new PR!

PierreGtch commented 1 month ago

A bit more context: In 1.0.0, for all the datasets where interval[0]!=0, the raw.annotations were set to start exactly at the onset events[:,0], and not at events[:,0] + sfreq * interval[0].

The durations in the annotations were correct.

This did not affect the creation of epochs when using MOABB’s paradigms. However, this affected the codes loading the raw data from MOABB and doing the epoching externally by relying on the annotations and ignoring the dataset’s interval, which is the case in Braindecode.

sylvchev commented 1 month ago

Ok, that why there was no regression in MOABB but it was the case for Braindecode. Good catch.