Skip to content

MRG: Allow tmin and tmax in mne.epochs.make_metadata() to accept strings#12462

Merged
larsoner merged 9 commits intomne-tools:mainfrom
hoechenberger:metadata-tmin-tmax-named
Mar 1, 2024
Merged

MRG: Allow tmin and tmax in mne.epochs.make_metadata() to accept strings#12462
larsoner merged 9 commits intomne-tools:mainfrom
hoechenberger:metadata-tmin-tmax-named

Conversation

@hoechenberger
Copy link
Copy Markdown
Member

@hoechenberger hoechenberger commented Feb 26, 2024

This makes it possible to auto-generate metadata in time windows of varying duration, e.g., from a stimulus cue to a participant's response. Here, the response might occur at different times in every epoch. Now, one can specify tmax="response" in this case, and capture all events from tmin until the response for metadata generation. I imagine this to be particularly useful for MNE-BIDS-Pipeline (in fact, I'm already using this feature in my personal pipeline branch)

@hoechenberger hoechenberger force-pushed the metadata-tmin-tmax-named branch 2 times, most recently from 1b81c96 to d2dd467 Compare February 26, 2024 16:15
…ings

This makes it possible to auto-generate metadata in time windows of varying duration, e.g., from a stimulus cue to a participant's response. Here, the response might occur at different times in every epoch. Now, one could specify `tmax="response"` in this case, and capture all events from `tmin` until the response for metadata generation.
@hoechenberger hoechenberger force-pushed the metadata-tmin-tmax-named branch from d2dd467 to 9d7eb8a Compare February 26, 2024 16:17
@hoechenberger hoechenberger marked this pull request as ready for review February 26, 2024 16:19
@larsoner
Copy link
Copy Markdown
Member

Do we have some example/tutorial where you could show this in action?

@hoechenberger
Copy link
Copy Markdown
Member Author

I was considering amending the existing auto-metadata tutorial but it's way too big already ... i could add another, smaller one or an example script!

@hoechenberger
Copy link
Copy Markdown
Member Author

Also, the code is a mess. It was already bad before I started this PR and the changes here don't make it better. Without a debugger and stepping through it line by line, I wouldn't have been able to make these amendments. This will need a serious refactoring sometime in the future. For now, I tried to provide good test coverage so we don't accidentally break stuff even if we don't always fully understand how it works

Copy link
Copy Markdown
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did not review the code in details but the new example is cool and a convincing usecase !

@hoechenberger hoechenberger changed the title Allow tmin and tmax in mne.epochs.make_metadata() to accept strings MRG: Allow tmin and tmax in mne.epochs.make_metadata() to accept strings Mar 1, 2024
@larsoner larsoner merged commit d17d885 into mne-tools:main Mar 1, 2024
@larsoner
Copy link
Copy Markdown
Member

larsoner commented Mar 1, 2024

Thanks @hoechenberger @SophieHerbst !

snwnde pushed a commit to snwnde/mne-python that referenced this pull request Mar 20, 2024
…t strings (mne-tools#12462)

Co-authored-by: Sophie Herbst <ksherbst@gmail.com>
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.

4 participants