-
Notifications
You must be signed in to change notification settings - Fork 87
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
Automatically assigning metadata #1162
Comments
can you draft an API for this?
… Message ID: ***@***.***>
|
I think it would just be added automatically sounds nice to me, within the existing read_raw_bids API |
Well actually that could look like passing only |
I'm probably missing something here but ... shouldn't we add full support for Raw metadata the MNE first? I mean like we have it for Epochs. Even if that means storing that data in a separate file. |
Oh never mind, we can store that stuff as annotations, as you suggested. Sorry about the confusion. |
Well actually that could look like passing only raw to mne.Epochs with
events=None. That's a pretty big API change but it kind of seems like
it's very sensible since annotations were introduced and you don't have to
preload epochs. I think you'd need a lot of opinions on that though as it's
super central to pretty much any workflow.Message ID:
***@***.***>
can you finish the thought process? then what? What behavior? what do you
do with event_id?
I don't want to close the door here but the plan should be well designed so
we don't end up in a rabbit hole
|
Sorry if that was unclear. The motivation is from working with this dataset https://openneuro.org/datasets/ds003708/versions/1.0.3 with stimulation sites per trial. As far as I know, that can't be stored in annotations and is metadata that is nice associate with epochs. If metadata were allowed to be assigned to raw and checked that it was the length of annotations (first PR) then when |
Unfortunately this already seems like we're going to head down a rabbit hole. We have all sorts of ways of setting/appending/deleting annotations. So now you have to either prevent these operations or insert empty metadata for new ones, etc. An alternative would be to make the So I think the best/simplest/cleanest solution is the one mentioned above:
In I think a MNE-BIDS helper that returns an ndarray |
That sounds reasonable, the only thing I'm thinking is that we ran into an issue where the events were mislabeled in the annotations in a raw brainvision file and the dataset curator labeled them correctly in the events.tsv. This was confusing when setting |
I don't think we should write a new function for this. If we try to write a helper function to fix every instance of a broken dataset, we're going to end up with infinite functions. A better idea I think is 1) tell them to fix their dataset (which they might ignore), and then 2) write code to overcome this particular use case in the meantime. Now if this starts happening for dozens of datasets, then I think there's an argument to be made for a helper. But I really hope this is a rare exception... |
I have stuff like this in BIDS datasets that I have too. It often happens when you have a version of task or recording with event codings and then you change them in a later version. I think the idea with BIDS is that you leave the raw file be so that everything you put in BIDS is not modified and just correct it in the sidecar. That doesn't mean you necessarily need a helper function or new helper functions for everything but I do think that the idea that the sidecars overwrite anything in the files should be facilitated by |
- see also this discussion mne-tools/mne-python#6018
I would suggest also to have a helper function that attaches metadata to
epochs a bit manually
so far this approach has always worked for me (see indeed mne bids pipeline
approach)
… Message ID: ***@***.***>
|
I just wanted to chime in and share my strong disagreement with this viewpoint. I don't believe we should consider a dataset that relies on events.tsv to encode events as flawed. In reality, the problem here lies more in how we handle this type of data, which isn't always ideal. Historically, dealing with events in EEG recordings has been quite limited due to technical constraints. Most systems lacked the ability to attach complex metadata to events. But what if we're working with a complex experimental design or need to add post-hoc metadata? Sure, we could manually tweak the triggers in the EEG recording file, but that's error-prone and goes against the spirit of the BIDS format. As @alexrockhill pointed out, this is a common challenge, and I believe that, for a BIDS dataset, we should consider events.tsv as the primary source of truth. Perhaps a practical solution could be allowing for arbitrary metadata to be added to the Anyway, I do really like MNE, but I don't think event handling is one of its strong points at the moment. |
Ahh I see -- rereading I think you're right and I was wrong about this (sassuming the other MNE-BIDS people agree). as it could be a way to fix a flawed recording. To not force this behavior, though, it seems like a
FWIW recently the |
regarding:
and
I personally agree, and this is how we handle things in mne-bids. However, within BIDS, this is an unresolved issue:
this sounds good to me! |
Describe the problem
Metadata must be added separately when creating epochs, it's not part of
read_raw_bids
Describe your solution
How do you handle extra event columns in an events.tsv? You can read them in separately and assign them but it might be nice to either 1) make an mne-bids helper function to read metadata or 2) put them as metadata on a raw object (not currently an attribute) automatically during read_raw_bids and then add them to the epochs when that raw object is epoched. Option 2 might be super clean for abstracting bids stuff
Describe possible alternatives
Above
Additional context
No response
The text was updated successfully, but these errors were encountered: