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

Potential incompatibility between MNE 1.8.0 and MNE-BIDS 0.15.0 #1306

Closed
bootstrapbill opened this issue Sep 11, 2024 · 6 comments · Fixed by #1336
Closed

Potential incompatibility between MNE 1.8.0 and MNE-BIDS 0.15.0 #1306

bootstrapbill opened this issue Sep 11, 2024 · 6 comments · Fixed by #1336
Labels
Milestone

Comments

@bootstrapbill
Copy link
Contributor

Description of the problem

When calling write_raw_bids() I ran into the following error:

TypeError: 'datetime.date' object is not subscriptable

After some digging I realised that this is due to the switch in MNE 1.8.0 to storing subject birthdays as a date object instead of a tuple. But, in MNE-BIDS 0.15.0 a tuple is still expected.

I can see this bug has already been fixed here: #1278 (comment), but since that's currently only in the development version the latest stable releases of MNE and MNE-BIDS are incompatible (at least in this specific situation), right?

Steps to reproduce

import os.path as op
import datetime
import mne
from mne.datasets import sample

from mne_bids import (
    BIDSPath,
    write_raw_bids,
)

data_path = sample.data_path()

event_id = {
    "Auditory/Left": 1,
    "Auditory/Right": 2,
    "Visual/Left": 3,
    "Visual/Right": 4,
    "Smiley": 5,
    "Button": 32,
}

raw_fname = op.join(data_path, "MEG", "sample", "sample_audvis_raw.fif")
events_fname = op.join(data_path, "MEG", "sample", "sample_audvis_raw-eve.fif")
output_path = op.join(data_path, "..", "MNE-sample-data-bids")

raw = mne.io.read_raw(raw_fname)

raw.info["line_freq"] = 60

# add birthday following mne 1.8.0 specifications
raw.info['subject_info'] = {'birthday': datetime.date(1999,1,1)}

task = "audiovisual"

bids_path = BIDSPath(
    subject="01", session="01", task=task, run="1", datatype="meg", root=output_path
)

write_raw_bids(
    raw=raw,
    bids_path=bids_path,
    events=events_fname,
    event_id=event_id,
    overwrite=True,
)

Expected results

Expect write_raw_bids() to run as normal.

Actual results

TypeError: 'datetime.date' object is not subscriptable

Additional information

I'm not sure what the protocol is here, can the fix be backported? Or could this potential incompatibility be flagged in the documentation until the next release is rolled out? I've checked and the issue can easily be circumvented by either downgrading MNE (to 1.7.1) or installing the current development version of MNE-BIDS, so one of those solutions could be recommended?

Copy link

welcome bot commented Sep 11, 2024

Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴🏽‍♂️

@sappelhoff
Copy link
Member

Thanks for the report! You are right -- we should probably make a release to fix this.

@sappelhoff sappelhoff added this to the 0.16 milestone Sep 12, 2024
@berkgercek
Copy link

Thanks for your work on this really nice tool!

I would support the fix for this bug being a patch to the current version (e.g. 0.15.1) rather than part of the next minor version milestone, provided the team has the resources to do so.

It is currently breaking the raw_to_bids subcommand as well, so long as an incompatible version of MNE is installed. I found this issue through googling the error but the normal error output isn't informative enough to easily resolve the issue.

@sappelhoff
Copy link
Member

Hey all, I will try to push out a release this Saturday!

@berkgercek
Copy link

Thanks! I've also found the problem in the upstream repo for MNE and created another issue for that so hopefully it will be fixed at the source as well soon.

@sappelhoff
Copy link
Member

sappelhoff commented Nov 16, 2024

@bootstrapbill @berkgercek @thht mne-bids v0.16.0 has been released and is available on PyPI and in a few hours on conda-forge!

🚀 happy bids-ifying!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants