Skip to content

Fix incorrect interval in annotations - #607

Merged
bruAristimunha merged 2 commits into
NeuroTechX:developfrom
PierreGtch:fix-incorrect-interval-in-annotations
May 29, 2024
Merged

bruAristimunha merged 2 commits into
NeuroTechX:developfrom
PierreGtch:fix-incorrect-interval-in-annotations

Conversation

@PierreGtch

Copy link
Copy Markdown
Collaborator

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

PierreGtch commented May 29, 2024 •

Copy link
Copy Markdown
Collaborator Author

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
bruAristimunha merged commit e1c2466 into NeuroTechX:develop May 29, 2024
@bruAristimunha

Copy link
Copy Markdown
Collaborator

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

@PierreGtch

Copy link
Copy Markdown
Collaborator Author

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

Copy link
Copy Markdown
Member

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

PierreGtch added a commit to PierreGtch/moabb that referenced this pull request May 30, 2024
bruAristimunha added a commit to braindecode/braindecode that referenced this pull request Nov 30, 2026
…hifted (#1849)

* FIX MOABBDataset: add interval[0] once to trials that MOABB already shifted

Since NeuroTechX/moabb#607, SetRawAnnotations, a step of MOABB's default process
pipeline, puts each trial at event + interval[0]. Without a stim channel,
braindecode rebuilt the trials from these annotations and added interval[0]
again; raws read from MOABB's raw cache have no stim channel and took that path
too. Add the onset only when the trials come from the stim channel or from a
pipeline without SetRawAnnotations.

* DOC whats_new: add the pull request number for MOABBDataset

---------

Co-authored-by: bruAristimunha <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants