Now I upgraded to mne_bids: 0.11.dev0, there’s an error with the BIDSPath:
from mne_bids import BIDSPath, write_raw_bids
output_path = r'Z:\MEG_data\MNE-pilot-data-bids'
bids_path = BIDSPath(subject=subject, session=session,
task=task, run=run, root=output_path)
write_raw_bids(raw, bids_path, events_data=events_data,
event_id=events_id, overwrite=True)
Traceback (most recent call last):
File "C:\Users\ghafarit\AppData\Local\Temp\ipykernel_23084\1508003131.py", line 1, in <module>
write_raw_bids(raw, bids_path, events_data=events_data,
File "<decorator-gen-611>", line 12, in write_raw_bids
File "C:\Users\ghafarit\Anaconda3\envs\mne\lib\site-packages\mne_bids\write.py", line 1504, in write_raw_bids
raise RuntimeError('"bids_path" must be a BIDSPath object. Please '
RuntimeError: "bids_path" must be a BIDSPath object. Please instantiate using mne_bids.BIDSPath().
No idea from what you shared it’s not clear what the error could be. Progress with one error message at a time … anyhow, if this is a different issue, I suggest you investigate first and try to solve it. If you really hit a wall and cannot progress further or if you think you have identified a bug, please open a new report either here or on Issues · mne-tools/mne-bids · GitHub
In order to convert the ctf data to bids format, I upgraded mne_bids and that was the only thing I changed, everything else was the same as before (there was no error regarding BIDSPath when I was using mne_bids:0.10). Basically the MWE is still the same as the one I shared with you before.
This error is the reason I can’t try the developer’s version of mne_bids to see if on windows I can convert CTF data to bids format. and I could not solve it unfortunately.
That’s why I asked if you have any ideas how to solve it and move forward in converting ctf data to bids.
Thanks for your reply.
below please find the output and error:
<class 'mne_bids.path.BIDSPath'>
Z:/MEG_data/MNE-pilot-data-bids/sub-02/ses-01/meg/sub-02_ses-01_task-SpAtt_run-01_meg.ds
Traceback (most recent call last):
File "C:\Users\ghafarit\AppData\Local\Temp\ipykernel_23084\1067814209.py", line 3, in <module>
write_raw_bids(raw, bids_path, events_data=events_data,
File "<decorator-gen-611>", line 12, in write_raw_bids
File "C:\Users\ghafarit\Anaconda3\envs\mne\lib\site-packages\mne_bids\write.py", line 1504, in write_raw_bids
raise RuntimeError('"bids_path" must be a BIDSPath object. Please '
RuntimeError: "bids_path" must be a BIDSPath object. Please instantiate using mne_bids.BIDSPath().
@sappelhoff The type of the BIDSPath object looks kinda weird, no? Why does it have an entire “path to the namespace” (sorry, idk how to properly call this) prepended? I’ve never seen anything like this… this probably also explains why the check fails. I wonder if there are multiple MNE-BIDS installations interacting with each other in unforeseen ways?
Actually this is not correct; I get the same behavior on macOS:
In [9]: from mne_bids import BIDSPath
In [10]: BIDSPath
Out[10]: mne_bids.path.BIDSPath
So this is not it.
@tghafari I suspect something with your installation is broken … I’d suggest you wait for the MNE-BIDS 0.11 release and then do a fresh install of everything.
I hope I don’t have to wait for long. I am making all my scripts BIDS compatible at the moment, I will continue to use mne-bids 0.10 for .fif data for now until the next version is released.
Just to be clear, by “fresh install of everything” you mean uninstalling and installing mne-bids, right?