Skip to content

Conversation

@PierreGtch
Copy link
Collaborator

As described by @simonkojima in #830, when a dataset does not have a stim channel, the paradigm ignores the dataset's interval attribute when creating windows

This PR should fix it

@simonkojima could you review this? On my machine, it passes the test on Dreyer2023 you shared

Fixes #830

@simonkojima
Copy link
Contributor

Thank you, @PierreGtch.
It gives different data depending on dataset.interval.

However, I’m now facing a new issue related to missing events.
Each subject should have 240 events, but the current output returns fewer events (e.g., only 11 for subject 1).

It seems to be caused by the commit in this PR, as the issue does not occur on the current develop branch.

from pathlib import Path
import mne
from moabb.datasets import Dreyer2023
from moabb.paradigms import LeftRightImagery

paradigm = LeftRightImagery()

dataset = Dreyer2023()
X, labels, meta = paradigm.get_data(dataset=dataset, subjects=[1])

print(X.shape[0]) # returns 11 (should be 240)

# extract events from raw processed by moabb
raw = dataset.get_data(subjects=[1])[1]["0"]["0R1acquisition"]
events_moabb, _ = mne.events_from_annotations(raw)

# extract events from unprocessed raw
fname = Path.home() / "mne_data" / "MNE-Dreyer2023-data" / "sub-01" / "eeg" / "sub-01_task-R1acquisition_eeg.edf"
raw = mne.io.read_raw_edf(fname)
events, event_id = mne.events_from_annotations(raw)
new_event_id = {"left_hand":event_id["769"], "right_hand":event_id["770"]}
epochs = mne.Epochs(raw, event_id = new_event_id, tmin=0, tmax=5, baseline=None)
events_unprocessed = epochs.events

print(events_moabb.shape) # 2, 3
print(events_unprocessed.shape) # 40, 3

@PierreGtch
Copy link
Collaborator Author

Ok i think I got it!
The final solution is quite convoluted: basically when no stim channel is present, we do annotations -> events -> annotations -> events
Your code works on my machine. I get :

240
(40, 3)
(40, 3)

Feel free to do additional tests, I will merge when tell me
Thanks for your help :)

@simonkojima
Copy link
Contributor

Thanks! I tested it on my machine, and everything works as expected.

@PierreGtch
Copy link
Collaborator Author

Great! thanks @simonkojima :)

@PierreGtch PierreGtch merged commit a6f4c70 into NeuroTechX:develop Nov 24, 2025
18 checks passed
bruaris added a commit that referenced this pull request Dec 13, 2025
* V1.4.2 (#845)

* fixing the release

* pushing to including the .csv

* pre-commit

* v 1.4.2

* Fix `SetRawAnnotations` when no stim channel (#838)

* First try to fix

* Add test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Whats new

* enforce desired event ids when creating events from annotations

---------

Signed-off-by: Pierre Guetschel <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Increase compatibility with Python 3.14 (#848)

* Initial plan

* Increase compatibility with Python 3.14

Co-authored-by: bruAristimunha <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: bruAristimunha <[email protected]>

* Fix warnings from scikit-learn 1.8+ and introduce FixedPipeline (#850)

* p

* fixing number

* Fix compatibility with scikit-learn 1.8 (#852)

* fixing more colab issues

* updating the utils

* Enhance documentation and update design elements (#853)

* more design details

* more adjust

* more adjusts

* more updates

* updating the readme

* removing the roadmap

* first round

* more modification and almost done

* including subject info

* remove the video

* more details

* updating to colab

* updating the citation

* updating the __init__

* Macro release (#854)

---------

Signed-off-by: Pierre Guetschel <[email protected]>
Co-authored-by: Bru <[email protected]>
Co-authored-by: Pierre Guetschel <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: bruAristimunha <[email protected]>
bruAristimunha added a commit that referenced this pull request Dec 14, 2025
* Release 1.4.3 (#855)

* V1.4.2 (#845)

* fixing the release

* pushing to including the .csv

* pre-commit

* v 1.4.2

* Fix `SetRawAnnotations` when no stim channel (#838)

* First try to fix

* Add test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Whats new

* enforce desired event ids when creating events from annotations

---------

Signed-off-by: Pierre Guetschel <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Increase compatibility with Python 3.14 (#848)

* Initial plan

* Increase compatibility with Python 3.14

Co-authored-by: bruAristimunha <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: bruAristimunha <[email protected]>

* Fix warnings from scikit-learn 1.8+ and introduce FixedPipeline (#850)

* p

* fixing number

* Fix compatibility with scikit-learn 1.8 (#852)

* fixing more colab issues

* updating the utils

* Enhance documentation and update design elements (#853)

* more design details

* more adjust

* more adjusts

* more updates

* updating the readme

* removing the roadmap

* first round

* more modification and almost done

* including subject info

* remove the video

* more details

* updating to colab

* updating the citation

* updating the __init__

* Macro release (#854)

---------

Signed-off-by: Pierre Guetschel <[email protected]>
Co-authored-by: Bru <[email protected]>
Co-authored-by: Pierre Guetschel <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: bruAristimunha <[email protected]>

* updating the md and yml

* updating the DNS config

* more documentation fix

* checking links automatically

* Update README.md

Signed-off-by: Bru <[email protected]>

* more fix within the links

* fixing the url

---------

Signed-off-by: Pierre Guetschel <[email protected]>
Signed-off-by: Bru <[email protected]>
Signed-off-by: Bru <[email protected]>
Co-authored-by: Bruno Aristimunha <[email protected]>
Co-authored-by: Pierre Guetschel <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <[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.

dataset.interval is ignored for datasets without a stim channel

2 participants