Hello and thanks to everyone working on the 0.7 update! This tool helps our lab really a lot organizing datasets!
I have two additional comments.
First, I tried reading an ieeg Dataset including an electrode.tsv and a coordinatesystem.json. The files get correctly read, and I can also see in the montage the electrode locations.
Then I simply tested to write out the RawArray again using
mne_bids.write_raw_bids(raw_arr, bids_path, format="BrainVision")
This resulted in the following error:
ValueError Traceback (most recent call last)
in
----> 1 mne_bids.write_raw_bids(raw_arr, bids_path, format=âBrainVisionâ)~\Anaconda3\lib\site-packages\mne_bids\write.py in write_raw_bids(raw, bids_path, events_data, event_id, anonymize, format, overwrite, verbose)
1265 # if we have an available DigMontage
1266 if raw.info[âdigâ] is not None and raw.info[âdigâ]:
â 1267 _write_dig_bids(bids_path, raw, overwrite, verbose)
1268 else:
1269 logger.warning(fâWriting of electrodes.tsv is not supported â~\Anaconda3\lib\site-packages\mne_bids\dig.py in _write_dig_bids(bids_path, raw, overwrite, verbose)
367 # XXX: To improve when mne-python allows coord_frame=âunknownâ
368 # coordinate frame is either
â 369 coordsystem_path.update(space=coord_frame)
370 electrodes_path.update(space=coord_frame)
371~\Anaconda3\lib\site-packages\mne_bids\path.py in update(self, check, **kwargs)
610
611 # Perform a check of the entities.
â 612 self._check()
613 return self
614~\Anaconda3\lib\site-packages\mne_bids\path.py in _check(self)
726 fâ{self.datatype}â)
727 elif space not in allowed_spaces_for_dtype:
â 728 raise ValueError(fâspace ({space}) is not valid for â
729 fâdatatype ({self.datatype}).\nâ
730 fâShould be one of âValueError: space (CapTrak) is not valid for datatype (ieeg).
Should be one of [âICBM452AirSpaceâ, âICBM452Warp5Spaceâ, âIXI549Spaceâ, âfsaverageâ, âfsaverageSymâ, âfsLRâ, âMNIColin27â, âMNI152Linâ, âMNI152NLin2009aSymâ, âMNI152NLin2009bSymâ, âMNI152NLin2009cSymâ, âMNI152NLin2009aAsymâ, âMNI152NLin2009bAsymâ, âMNI152NLin2009cAsymâ, âMNI152NLin6Symâ, âMNI152NLin6ASymâ, âMNI305â, âNIHPDâ, âOASIS30AntsOASISAntsâ, âOASIS30Atroposâ, âTalairachâ, âUNCInfantâ, âfsaverage3â, âfsaverage4â, âfsaverage5â, âfsaverage6â, âfsaveragesymâ, âUNCInfant0V21â, âUNCInfant1V21â, âUNCInfant2V21â, âUNCInfant0V22â, âUNCInfant1V22â, âUNCInfant2V22â, âUNCInfant0V23â, âUNCInfant1V23â, âUNCInfant2V23â, âOtherâ, âPixelsâ, âACPCâ]
I guess that itâs related to the standard âCapTrakâ space, also for ieeg. Maybe switching this space for ieeg data to another space might already fix this issue.
My second question, and sorry if this is a bit unrelated, is that it would be super great in future to use write_raw_bids also without previously reading in a fif or brainvision file (as done here 08. Convert iEEG data to BIDS format â MNE-BIDS 0.14 documentation with
raw = [mne.io.read_raw_edf](https://mne.tools/dev/generated/mne.io.read_raw_edf.html#mne.io.read_raw_edf)([misc_path](https://docs.python.org/3/library/stdtypes.html#str) + '/ecog/sample_ecog.edf')
So instead data could be simply specified as
ch_names = ["ch_1", "ch_2", "ch_3", "ch_4"]
info = mne.create_info(ch_names, 1000., 'ecog')
raw = mne.io.RawArray(data=np.random.random([4, 2000]), info=info)
raw.info['line_freq'] = 60 # specify power line frequency as required by BIDS
raw.set_channel_types({ch: 'ecog' for ch in raw.ch_names})
And then write_raw_bids could be called:
mne_bids.write_raw_bids(raw, bids_path=bids_path, format=âBrainVisionâ)
Which currently results in this error:
ValueError Traceback (most recent call last)
in
----> 1 mne_bids.write_raw_bids(raw, bids_path=bids_path, format=âBrainVisionâ)~\Anaconda3\lib\site-packages\mne_bids\write.py in write_raw_bids(raw, bids_path, events_data, event_id, anonymize, format, overwrite, verbose)
1103
1104 if not hasattr(raw, âfilenamesâ) or raw.filenames[0] is None:
â 1105 raise ValueError(âraw.filenames is missing. Please set raw.filenamesâ
1106 âas a list with the full path of original raw file.â)
1107ValueError: raw.filenames is missing. Please set raw.filenamesas a list with the full path of original raw file.
I guess this is simply a feature request, but it would make writing BIDS a lot easier
Thanks again for the great work!
- MNE-BIDS version: 0.7
- operating system: Windows 10