mne_bids read raw doesn't set channel types when several data types in session

If you have a question or issue with MNE-Python, please include the following info:

  • MNE-Python version: 23.00.0
  • operating system: linux/windows
    -MNE_BIDS version: 0.0

Dear all,

I have been encountering issues when loading a BIDS data set using the mne_bids.read function. My dataset is composed of both ieeg and eeg data for some patients, while other only have ieeg data. Surprisingly, when loading the ieeg data for a patient for whom we only had ieeg data, the channel types of the loaded data is set properly. However, for the patient in whom we have both ieeg and eeg data, the channel type is not set. I am not sure what is the reason behind this. Perhaps the data type not being transferred to the function reading the channel type, leading to the eeg channels.tsv being read instead of the ieeg one?

My directory structure is something like this:
C:.
Ā±ā€“sub-101
| ā€”ses-V1
| |ā€”eeg
| ā€”ieeg
Ā±ā€“sub-102
| ā€”ses-V1
| |ā€”eeg
| ā€”ieeg
Ā±ā€“sub-103
ā€”ses-V1
ā€”ieeg

I am unfortunately not able to share actual data due to data privacy issues.

Thanks in advance for your support,

Kind regards,

Alex

Hello @AlexLepauvre and welcome to the forum!

This behavior indeed does sound like a bug. Do you think you could share some made-up data that allows us to reproduce the issue? This would simplify debugging on our end a lot.

Best wishes,
Richard

Dear Richard,

I will give it a go, it will take me a couple of days to squeeze it in. I will get back to you as soon as I have figured it out.

Kind regards,

Alex

Turns out, it was a bit easier than expected. Here are the data + code: KEEPER
In the attached folder, you will find the following structure:

  • bids
    |ā€” sub-SAMPLE1
    ā€”sub-SAMPLE2
    \code

The bids data were generated using the script generate_simulated_raw.py. I generated the subject SAMPLE1 to have eeg, ecog, seeg and ecg channels (to be fully equivalent to my actual data) while SAMPLE2 has only ieeg data.
The data were then read and plotted using load_raw_bids. For SAMPLE2, things work fine, whereas for SAMPLE1, the following warnings are displayed:
RuntimeWarning: Expected to find a single events file associated with sub-SAMPLE1_ses-V1_task-TEST, but found 2:
RuntimeWarning: Expected to find a single channels file associated with sub-SAMPLE1_ses-V1_task-TEST, but found 2:

It therefore seems that in the scenario where one has multiple data types for the same subject in the same bids data set, the bids reader search for the different sidecar files regardless of the data type.

I hope this makes it clearer. Please let me know if there is anything else required

Kind regards,

Hello @AlexLepauvre,

thank you, I could reproduce your issue locally and have proposed a fix:

1 Like

Dear Richard,

Thanks a lot :slight_smile: I assume the change will be available in the next mne_bids release? Or will it be available in the dev 0.9. version already?

Thanks again for your help,

Kind regards,

Alex

Hello, the fix isnā€™t ready for integration into the main development branch yet, but I will let you know once it is. Youā€™ll have to wait for a few days though, Iā€™m afraid!