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

Open
bootstrapbill opened this issue Sep 11, 2024 · 2 comments
Open

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

bootstrapbill opened this issue Sep 11, 2024 · 2 comments
Labels
Milestone

Comments

@bootstrapbill
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants