Help importing .dat & .eeg data.

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.

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.

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)