Closed nugenta closed 1 year ago
Hello! π Thanks for opening your first issue here! β€οΈ We will try to get back to you soon. π΄π½ββοΈ
Hi, thanks for the report!
The second issue is both an MNE bids and an MNE issue - not sure if I should replicate this issue there? When reading in a 4D dataset, raw.__init_kwargs is correctly populated with the full path for the dataset, i.e.
please open an MNE-Python issue on the MNE-Python repository π
The first is that if there is no headshape data, mne_bids.write_raw_bids will fail (in function copyfile_bti_mod).
why do you not have a headshape file for your data? Have you had a look at the mne-bids codebase to identify the potential problem?
This is HCP data that I'm trying to get into a format resembling BIDS. Since the HCP did not distribute the data with the headshape or the locations of the fiducial points, I'm limited to organizing the data more-or-less in BIDS format with the -trans.fif file for coregistration. It will make it easier for me to modify software designed to work on BIDS format data if I have the HCP data in something close to BIDS.
Oh - and in response to the suggestion of identifying the source of the problem in the mne-bids codebase, it's just that copyfile_bti fails on line 602 of copyfiles.py:
sh.copyfile(raw._init_kwargs['head_shape_fname'],
op.join(dest, 'hs_file'))
It returns an error that sh.copyfile cannot accept an argument of type None.
Description of the problem
There are two problems with the conversion of BTI/4D data to BIDS format. The first is that if there is no headshape data, mne_bids.write_raw_bids will fail (in function copyfile_bti_mod).
The second issue is both an MNE bids and an MNE issue - not sure if I should replicate this issue there? When reading in a 4D dataset, raw.__init_kwargs is correctly populated with the full path for the dataset, i.e.
raw._init_kwargs['pdf_fname'] = '/path_to_file/4D/c,rfDC'
but the field for the config file
raw._init_kwargs['config_fname'] = 'config'
Without the full path to the config file, copyfile_bti_mod will fail.
Steps to reproduce
Expected results
I expect it to copy the files to the BIDS directory rather than erroring out
Actual results
Error because full path for config file is not specified:
Traceback (most recent call last):
Cell In[7], line 48 write_raw_bids(raw, bids_path, overwrite=True)
File:12 in write_raw_bids
File ~/mambaforge/envs/enigma_meg/lib/python3.11/site-packages/mne_bids/write.py:1979 in write_raw_bids copyfile_bti(raw_orig, raw_dir)
File ~/mambaforge/envs/enigma_meg/lib/python3.11/site-packages/mne_bids/copyfiles.py:600 in copyfile_bti sh.copyfile(raw._init_kwargs['config_fname'],
File ~/mambaforge/envs/enigma_meg/lib/python3.11/shutil.py:256 in copyfile with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'config'
Additional information
Using mne version 1.4.2 and mne-bids 0.12