Skip to content

Error checking in Info - setting unsupported keys in mne.Info or mne.Info attributes partially works and doesn't show any warnings #9752

@mscheltienne

Description

@mscheltienne

In my preprocessing pipeline, I'm setting some information about the subjects. One of the interesting features is the age, or the birth year. But MNE only supports the birthday as a tuple (year, month, day), as per the documentation of mne.Info.

Sadly, I do not have the exact birthday, and instead of setting it as (year, month, 1), I figured I could set a different birthyear or age argument directly.

raw = mne.io.read_raw_fif(...)
raw.info['subject_info']['birthyear'] = 1995
{'id': 65, 'his_id': '065', 'birthyear': 1995, 'sex': 1}
raw.save(...)

And it worked really nicely. Until I saved and reloaded the file.

raw = mne.io.read_raw_fif(...)
raw.info['subject_info']
{'id': 65, 'his_id': '065', 'sex': 1}

The issue is that this emits no warning, no error, and yet the added data is not saved to disk.

If the dictionary stored in 'subject_info' is not used by anything, and is just here for user-defined variables (is this the case?) then how about dropping the limitation on what the keys can be?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions