Repository navigation
FIX MOABBDataset: add interval[0] once to trials that MOABB already shifted - #1849
Merged
bruAristimunha merged 3 commits intoNov 30, 2026
Merged
bruAristimunha merged 3 commits into
bruAristimunha merged 3 commits into
Conversation
…hifted 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.
Contributor
Author
|
Also checked on a dataset without a stim channel: the real BNCI2020_001, subject 1 (moabb 1.7.2, 256 Hz, |
Collaborator
|
Maintainer note: checked the version suspicion before merging. braindecode declares |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Since NeuroTechX/moabb#607,
SetRawAnnotationsin MOABB's default pipeline puts each trial at event +interval[0]. Without a stim channel,_annotations_from_moabb_stim_channelrebuilds the trials from these annotations and addsinterval[0]again; raws from MOABB's raw cache have no stim channel. This fixes that shift, the first part of #1845, and leaves the BAD segments as they are.Trial samples, synthetic datasets of #1845 (triggers at 1000 and 3000, 100 Hz,
interval=(2, 6)):get_data()SetRawAnnotationsFixedPipeline([])Real BNCI2014_001, subject 4 (12 runs, 250 Hz):
MOABBDatasetminusget_data()onsets are 0 samples without the cache; withsave_raw=True, 500 samples (2 s) on master and 0 on this branch.Changes
_fetch_and_unpack_moabb_data: trials count as shifted whenprocess_pipelineis MOABB's default or containsSetRawAnnotations, nested steps included._annotations_from_moabb_stim_channel: addsinterval[0]to stim-channel trials, or to annotations MOABB did not shift.whats_new.rst.Testing
Windows, Python 3.12.10, moabb 1.7.2, MNE 1.13.2;
masterat 83f756a.The 14 files of
ci_plan.py, with BNCI2014_001 downloaded and zarr 3.4.2: 1040 passed, 73 skipped, 1 failed;master1037 passed, same skips and failure (test_overwrite_keeps_one_cache_and_the_lazy_dataset_readable: Windows keeps a memory-mapped.npy). Skips: Windows-only, no CUDA or MPS, per-test reasons (-rfEs).Mutations, each killed: onset always added, stim path not shifted, pipeline ignored, custom pipelines never shifted, nested steps not searched.
Unchanged on the scripts of MOABBDataset adds interval[0] twice without a stim channel and drops BAD annotations #1845:
first_samp500, an extra event code, BAD segments (still dropped), inferred targets (0, 1).pre-commit: passed. Not run: other real datasets, moabb other than 1.7.2 (1.4.3, the floor, already shifts: read on its tag).New or changed behavior is covered by relevant regression tests (or N/A with reason)
Style checks recorded, e.g.
pre-commit run --files <changed files>docs/whats_new.rstupdated (at most 3 lines), or theno changeloglabel, which a maintainer adds, for changes to code that is not released yet (the changelog CI check requires one of the two)Notes for reviewers
interval[0] != 0move (from reading moabb 1.7.2: Huebner2017/2018, Kojima2024A, Nieto2022, ErpCore2021, BNCI2016_002, BNCI2019_001, BNCI2020_001), and any dataset read through the raw cache.