Skip to content
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

optionally return event_id dict from read_raw_bids, and use value column from events file if present #1349

Merged
merged 10 commits into from
Dec 10, 2024

Conversation

drammock
Copy link
Member

@drammock drammock commented Dec 5, 2024

PR Description

closes #223

I opted for @hoechenberger's suggestion in #223 (comment), namely, to allow read_raw_bids to optionally return an event_id dict; when a values column is present in events.tsv it will use those values for the integer IDs. That dict can then be passed to mne.events_from_annotations to recover the original events array.

Merge checklist

Maintainer, please confirm the following before merging.
If applicable:

  • All comments are resolved
  • This is not your own PR
  • All CIs are happy
  • PR title starts with [MRG]
  • whats_new.rst is updated
  • New contributors have been added to CITATION.cff
  • PR description includes phrase "closes <#issue-number>"

Copy link

codecov bot commented Dec 5, 2024

Codecov Report

Attention: Patch coverage is 97.91667% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.43%. Comparing base (6a659c9) to head (1cddfd7).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
mne_bids/read.py 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1349      +/-   ##
==========================================
+ Coverage   97.42%   97.43%   +0.01%     
==========================================
  Files          40       40              
  Lines        8883     8903      +20     
==========================================
+ Hits         8654     8675      +21     
+ Misses        229      228       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

mne_bids/read.py Show resolved Hide resolved
mne_bids/read.py Show resolved Hide resolved
Copy link
Member

@sappelhoff sappelhoff left a comment

Choose a reason for hiding this comment

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

Thanks @drammock

@sappelhoff sappelhoff merged commit 46f284b into mne-tools:main Dec 10, 2024
23 checks passed
@drammock drammock deleted the events-annotations branch December 10, 2024 19:48
# when making our `event_id` dict; `value = n/a` doesn't prevent annotation)
culled = _drop(events_dict, "n/a", "value")
event_id = dict(
zip(culled[trial_type_col_name], np.asarray(culled["value"], dtype=int))
Copy link
Member

Choose a reason for hiding this comment

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

@drammock I think this is causing a failure in mne-bids-pipeline

https://app.circleci.com/pipelines/github/mne-tools/mne-bids-pipeline/4802/workflows/9294a7f0-4de8-4d97-976c-b5bf3f62c3da/jobs/72961

Can you look? You should be able to do pytest mne_bids_pipeline/ -k matching --download to test

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.

read_raw_bids does not use value column from events file
4 participants