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

RuntimeError reading BIDS data using mne_bids.read_raw_bids() #1375

Open
pomeloyou opened this issue Feb 20, 2025 · 3 comments
Open

RuntimeError reading BIDS data using mne_bids.read_raw_bids() #1375

pomeloyou opened this issue Feb 20, 2025 · 3 comments

Comments

@pomeloyou
Copy link

Hello!I am learning to use the MNE-Python library for neural signal processing, but an error occurred when reading data using mne_bids.read_raw_bids(). I checked the project history issue and did not find a useful answer. Please help me solve this problem:

data_root = 'F:\\Database\\Multimodal_data\\ds000117_R1.0.0\\derivatives_sub01-04'
data_root = pathlib.Path(data_root)

data_path = mne_bids.BIDSPath(subject='01',
                              session='meg',
                              task='facerecognition',
                              run='01',
                              datatype='meg',
                              suffix='meg',
                              root=data_root
                              )
raw = mne_bids.read_raw_bids(data_path, verbose='error')
  • Traceback:
RuntimeError                              Traceback (most recent call last)
Cell In[5], [line 12](vscode-notebook-cell:?execution_count=5&line=12)
      [2](vscode-notebook-cell:?execution_count=5&line=2) data_root = pathlib.Path(data_root)
      [4](vscode-notebook-cell:?execution_count=5&line=4) data_path = mne_bids.BIDSPath(subject='02',
      [5](vscode-notebook-cell:?execution_count=5&line=5)                               session='meg',
      [6](vscode-notebook-cell:?execution_count=5&line=6)                               task='facerecognition',
   (...)
     [10](vscode-notebook-cell:?execution_count=5&line=10)                               root=data_root
     [11](vscode-notebook-cell:?execution_count=5&line=11)                               )
---> [12](vscode-notebook-cell:?execution_count=5&line=12) raw = mne_bids.read_raw_bids(data_path, verbose='error')

File <decorator-gen-360>:10, in read_raw_bids(bids_path, extra_params, verbose)

File d:\Miniconda3\envs\MF\lib\site-packages\mne_bids\read.py:859, in read_raw_bids(bids_path, extra_params, verbose)
    [855](file:///D:/Miniconda3/envs/MF/lib/site-packages/mne_bids/read.py:855) channels_fname = _find_matching_sidecar(
    [856](file:///D:/Miniconda3/envs/MF/lib/site-packages/mne_bids/read.py:856)     bids_path, suffix="channels", extension=".tsv", on_error="warn"
    [857](file:///D:/Miniconda3/envs/MF/lib/site-packages/mne_bids/read.py:857) )
    [858](file:///D:/Miniconda3/envs/MF/lib/site-packages/mne_bids/read.py:858) if channels_fname is not None:
--> [859](file:///D:/Miniconda3/envs/MF/lib/site-packages/mne_bids/read.py:859)     raw = _handle_channels_reading(channels_fname, raw)
    [861](file:///D:/Miniconda3/envs/MF/lib/site-packages/mne_bids/read.py:861) # Try to find an associated electrodes.tsv and coordsystem.json
    [862](file:///D:/Miniconda3/envs/MF/lib/site-packages/mne_bids/read.py:862) # to get information about the status and type of present channels
    [863](file:///D:/Miniconda3/envs/MF/lib/site-packages/mne_bids/read.py:863) on_error = "warn" if suffix == "ieeg" else "ignore"

File d:\Miniconda3\envs\MF\lib\site-packages\mne_bids\read.py:661, in _handle_channels_reading(channels_fname, raw)
...
    [458](file:///D:/Miniconda3/envs/MF/lib/site-packages/mne/_fiff/meas_info.py:458)                 'in projector "%s"' % (ch["ch_name"], proj["desc"])
    [459](file:///D:/Miniconda3/envs/MF/lib/site-packages/mne/_fiff/meas_info.py:459)             )
    [460](file:///D:/Miniconda3/envs/MF/lib/site-packages/mne/_fiff/meas_info.py:460) ch["kind"] = new_kind

RuntimeError: Cannot change channel type for channel MEG0113 in projector "mag_ssp_upright.fif : PCA-mags-v1"
  • channel.tsv part of the content:
name	       type	description	  sampling_frequency	high_cutoff	low_cutoff	notch	software_filters	status
MEG0113	MEGGRAD	magnetometer gradiometer	  1100	           350	       0	           0	             SSS	         good
MEG0112	MEGGRAD	magnetometer gradiometer	  1100	           350	       0	           0	             SSS	         good

What should I modify to load the data correctly?

Copy link

welcome bot commented Feb 20, 2025

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

@hoechenberger
Copy link
Member

hoechenberger commented Feb 20, 2025

Hello @pomeloyou, could you please update to the latest versions of mne and mne-bids and try again?
Also, please retrieve the dataset from OpenNeuro; OpenfMRI has been deprecated and the datasets might not conform to the latest BIDS specifications.

Thanks

@pomeloyou
Copy link
Author

Thank you for your reply. I'll try it first according to the method you said.

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

No branches or pull requests

2 participants