Hello, I need help importing my EEG dataset. I have three files in my folder (.dat , vhdr, vmrk). I use:
mne.io.read_raw_brainvision(complete_path, preload=True, verbose=0) to import dataset.
But I get the following error:
OSError: The header file must be given to read the data, not a file with extension β.datβ.
Although the vhdr file is already present there.
agramfort
(Alexandre Gramfort)
2
you need to pass the vhdr path do mne.io.read_raw_brainvision not the the .dat path.
Alex
1 Like
Hello Alex, Thanks for the quick response.
Both files are in the same directory. And I have mentioned the path of the directory for vhdr file.
*path = path_eeg + individual + '/export/'*
*brainvision_files = sorted([f for f in listdir(path) if isfile(join(path, f))])*
-
vhdr_file = brainvision_files[1]*
-
complete_path = path + vhdr_file*
-
return mne.io.read_raw_brainvision(complete_path, preload=True, verbose=0)*
Please check it.
agramfort
(Alexandre Gramfort)
4
can you please check that the variable complete_path is a string that ends with .vhdr ?
it must be the path to the .vhdr file.
Alex
I tried to use .dat file in another folder and gave a path to it. Now it says list out of range.
dataset_path = home + β/eeg_to_fmriβ
def get_eeg_instance_01(individual, path_eeg=dataset_path+β/datasets/01/EEG/β, preprocessed=True):
individuals = sorted([f for f in listdir(path_eeg) if isdir(join(path_eeg, f))])
individual = individuals[individual]
if(preprocessed):
path = path_eeg + individual + '/export/'
else:
path = path_eeg + individual + '/raw/'
brainvision_files = sorted([f for f in listdir(path) if isfile(join(path, f))])
vhdr_file = brainvision_files[0]
complete_path = path + vhdr_file
return mne.io.read_raw_brainvision(complete_path, preload=True, verbose=0)