-
Notifications
You must be signed in to change notification settings - Fork 69
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
fix ignoring sessions that have no data #1035
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regarding testing, @larsoner and I came up with the plan to use a small dataset we have from UW (after BIDSifying it and uploading to OSF). It could make sense to add that in this PR, or a separate one
@@ -159,9 +172,9 @@ def get_subjects_sessions(config: SimpleNamespace) -> dict[str, list[str] | list | |||
f"{tuple(sorted(missing_sessions))}, and " | |||
"`config.allow_missing_sessions` is False" | |||
) | |||
subj_sessions[subject] = sorted(set(cfg_sessions) & set(valid_sessions_subj)) | |||
if subj_sessions[subject] == []: | |||
subj_sessions[subject] = [None] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this wasn't doing what was intended. We want [None]
(or (None,)
) for datasets where sessions aren't tracked (ie there's just one session). But for datasets where sessions are tracked, we should omit an entry from this subj_sessions
dict if there aren't any sessions found for that subj.
ignore_acquisitions=("calibration", "crosstalk"), | ||
ignore_suffixes=("scans", "coordsystem"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two lines are the important bit, for getting MNE-BIDS to only tell us if data files are present.
This ignore_suffixes
line requires upstream mne-tools/mne-bids@41ce36a to work, so we'll need to pin MNE-BIDS to that commit, or wait for the next MNE-BIDS release before merging here.
I'm also not really sure if coordsystems.json
and scans.tsv
are the only possible sidecars that could have the undesirous effect (of having get_entity_vals
return a false positive when no data files are actually present for the requested session --- cf. discussion at mne-tools/mne-bids#1351). If you can think of other sidecar suffixes to exclude, speak now.
The addition of
allow_missing_sessions
in #1000 had some problems:[None]
in thesubjs_sessions
dict in cases where a subject had no valid sessions; this was not behaving as expectedmne_bids.get_entity_vals
was not working as expected, because even if a subject had no data for a session for a given task, the presence ofcoordsystem.json
orscans.tsv
sidecars was causing it to report that the subject had some files for that session.Item (2) was fixed in mne-tools/mne-bids#1362; item (1) is fixed here. Works on my data, but will self-review to add some questions about implementation/testing.
Before merging …
docs/source/dev.md.inc
)