-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We're not writing all annotations if events are passed to write_raw_bids() as well #1084
Comments
Another option would be to keep the behavior as-is if only annotations are present (and no This should break significantly less existing user code!! |
Just for clarification, simply not passing |
we have discussed this before and we had decided that we should write
anything that is present in the files.
so to me it's a bug fix
… Message ID: ***@***.***>
|
Yes but the question is simply how to fix it! It's clear that it's a bug :) |
Thanks for investigating, Richard!
I like this fix:
I would also be fine with this fix. |
I'm in favor of this one! This will make things more explicit to users |
I can try to take a look sometime later today. I think this is actually an important issue and warrants a quick patch release, as users might actually be losing data in the BIDS conversion process! |
Just for the procedure of a patch release we would:
right? |
Yeah or just release 0.12 for simplicity hehe |
This sounds like what I do for MNE-Python, yeah |
Description of the problem
This problem came up in https://mne.discourse.group/t/mne-bids-structure-one-subject-is-different/5687/
The user concatenated raws, which creates an
edge
annotation. However, after writing the data viawrite_raw_bids()
, the annotation didn't show up inevents.tsv
. Turns out the user passedevents
andevent_id
towrite_raw_bids()
too, which caused this issue to surface.Steps to reproduce
In the following code, the concatenated raw has an edge and a bad annotation, but they don't end up in the
events.tsv
sidecar:Expected results
We should see 642 events in
events.tsv
, including the edge and bad annotations.Actual results
The edge and bad annotations are missing from the
events.tsv
sidecar.Additional information
The problem occurs here:
mne-bids/mne_bids/read.py
Lines 159 to 163 in 9231836
While in line 162 we explicitly try to include edge and bad annotations, the documentation of
events_from_annotations()
also states that any annotations that do not appear inevent_id
will simply be dropped.IMHO the cleanest solution here would be to force users to always supply an event_id dictionary. Currently it's optional if no
events
are passed, which causes us to generate arbitrary event codes for annotations – which at least one user complained about not too long ago. Of course this would break lots of existing code.We could of course also add special handling for all annotations for which no event_id mapping has been supplied, and we simply generate some new (arbitrary) event codes.
@sappelhoff @agramfort WDYT?
The text was updated successfully, but these errors were encountered: