Hello MNE community!
I have a question concerning mne.bids.write_raw_bids() function.
I’m trying to save the preprocessed data from the eegbci dataset after running mne.preprocessing.compute_current_source_density() on it, but I get the following error:
ValueError: The specified datatype eeg 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.
If I run the mne.bids.write_raw_bids() function before running mne.preprocessing.compute_current_source_density(), everything works fine. Here is my code after applying mne.preprocessing.compute_current_source_density():
bids_root = 'C:/Users/M/Desktop/data/BIDS_preprocessed'
# csd
raw_csd = mne.preprocessing.compute_current_source_density(ica_raw)
#saving as BIDS
bids_path = BIDSPath(subject='001', session='01', task= 'EyesOpen',
datatype='eeg', root= bids_root)
write_raw_bids(raw_csd, bids_path=bids_path, allow_preload=True, format = 'BrainVision')
I guess, the problem is with the format of the data after running the mne.preprocessing.compute_current_source_density() function, but I don’t know how to solve it.
WIll be grateful for your help!
- MNE version: 1.6.1
- operating system: Windows 11