Hello to everyone,
first time poster so please let me know if I am making any mistake regarding your posting etiquette.
- MNE-Python version: 0.23.0
- MNE_bids version: 0.8
- operating system: Windows 10 (working with JupyterNotebook)
I am working with the MEG dataset provided by Rathee et al. (2021).
Data: Link
Publication describing the data: Link
I am struggeling to read my data into a raw object using mne_bids.read_raw_bids
.
dir_name = "MEG_BIDS"
bids_root = os.path.abspath(dir_name)
subject = "20"
session = "1"
bids_root = pathlib.Path(bids_root)
bids_path = mne_bids.BIDSPath(subject=subject,
session=session,
root=bids_root,
task="bcimici")
raw = mne_bids.read_raw_bids(bids_path)
First, it seems to work. I am getting the following output: (Please note that I removed part of the path with “…” for privacy reasons)
Opening raw data file C:\Users\...s\MNE\00_DataExploration\MEG_BIDS\sub-20\ses-1\meg\sub-20_ses-1_task-bcimici_meg.fif...
Read a total of 13 projection items:
generated with autossp-1.0.1 (1 x 306) idle
generated with autossp-1.0.1 (1 x 306) idle
generated with autossp-1.0.1 (1 x 306) idle
generated with autossp-1.0.1 (1 x 306) idle
generated with autossp-1.0.1 (1 x 306) idle
generated with autossp-1.0.1 (1 x 306) idle
generated with autossp-1.0.1 (1 x 306) idle
generated with autossp-1.0.1 (1 x 306) idle
generated with autossp-1.0.1 (1 x 306) idle
generated with autossp-1.0.1 (1 x 306) idle
generated with autossp-1.0.1 (1 x 306) idle
generated with autossp-1.0.1 (1 x 306) idle
generated with autossp-1.0.1 (1 x 306) idle
Range : 8000 ... 2018999 = 8.000 ... 2018.999 secs
Ready.
Reading events from C:\Users\...\MNE\00_DataExploration\MEG_BIDS\sub-20\ses-1\meg\sub-20_ses-1_task-bcimici_events.tsv.
Reading channel info from C:\Users\...\MNE\00_DataExploration\MEG_BIDS\sub-20\ses-1\meg\sub-20_ses-1_task-bcimici_channels.tsv.
After this, I get the following error:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_14764/2373481023.py in <module>
6 root=bids_root,
7 task="bcimici")
----> 8 raw = mne_bids.read_raw_bids(bids_path)
9 # mne_bids.inspect_dataset(bids_path)
~\.conda\envs\mne\lib\site-packages\mne_bids\read.py in read_raw_bids(bids_path, extra_params, verbose)
694 on_error='warn')
695 if sidecar_fname is not None:
--> 696 raw = _handle_info_reading(sidecar_fname, raw, verbose=verbose)
697
698 # read in associated scans filename
~\.conda\envs\mne\lib\site-packages\mne_bids\read.py in _handle_info_reading(sidecar_fname, raw, verbose)
328 'data for KIT files.')
329 else:
--> 330 hpi_freqs_json = sidecar_json['HeadCoilFrequency']
331 try:
332 hpi_freqs_raw, _, _ = mne.chpi.get_chpi_info(raw.info)
KeyError: 'HeadCoilFrequency'
I looked into the source code. It seems like since my data was recorded on an Elekta system, it automatically expects the sub-20_ses-1_task-bcimici_meg.json file to contain the column “HeadCoilFrequency”, which it does not (I checked manually). Checking the BIDS documentation, it only lists “HeadCoilFrequency” as a recommended value to include, but not as mandatory. Therefore, I am confused why mne_bids seems to expect this value to be always included in the .json file.
How can I solve this problem / work around it? Thanks a lot in advance.