Hi, I have some problems writing my raw into bids
I did the following:
mne_nirs.io.write_raw_snirf(raw, 'C:/Users/rebec/fNIRS-project/Data/S'+ str(participant) +"raw_coregistered_to_fsaverage.snirf") # save hitachi-raw obj to snirf file
raw_obj = mne.io.read_raw_snirf('C:/Users/rebec/fNIRS-project/Data/S'+ str(participant) +"raw_coregistered_to_fsaverage.snirf")
root = r'C:\Users\rebec\fNIRS-project\Data\BIDS_1'
bids_path = mne_bids.BIDSPath(subject=str(participant), task='intelligible speech',datatype="nirs", suffix="nirs",
description = 'cleaned', extension=".snirf" ,root=root)
# write_bids
mne_bids.write_raw_bids(raw_obj, bids_path, events=events, event_id=event_dict,
format='FIF', anonymize=None, symlink=False, empty_room=None,
allow_preload=True, montage= montage, acpc_aligned=False,
overwrite=True, events_data=None, verbose=None)
The error looks like this:
C:\Users\rebec\fNIRS-project\generate_fif.py:110: RuntimeWarning: Coordinate frame could not be inferred from the raw object and the BIDSPath.space was none, skipping the writing of channel positions
mne_bids.write_raw_bids(raw, bids_path, events=events, event_id=event_dict,
Traceback (most recent call last):
File ~\fNIRS-project\generate_fif.py:117
gen_fif(list_par)
File ~\fNIRS-project\generate_fif.py:110 in gen_fif
mne_bids.write_raw_bids(raw, bids_path, events=events, event_id=event_dict,
File <decorator-gen-631>:12 in write_raw_bids
File ~\Anaconda3\envs\old_mne\lib\site-packages\mne_bids\write.py:1904 in write_raw_bids
elif format not in CONVERT_FORMATS[datatype]:
KeyError: 'nirs'
if I tried the same but loaded the raw-obj from a saved fif. file I get another error:
ValueError: The specified datatype nirs was not found in the raw object. Please specify the correct datatype using `bids_path.update(datatype="<datatype>")` or use raw.set_channel_types to set the correct channel types in the raw object.
and when I tried to use the Hitachi-raw-object I get another error, as MNE-bids can not read Hitachi raw objects
What is the problem here, thanks,
Rebecka