BrainVision Analyzer Export .fif to MNE

Dear,

I want to export preprocessed data (epoched) from BrainVision Analyzer to a .fif file to open in MNE. When I do the export and try to open the file I get the error message ‘File does not start with a file id tag’.
Could you help me solve this error?

Code in MNE:

Define participant files

participant_files = [‘9696-25_T1_RS.fif’]

Load the participant’s EEG data

for file_name in participant_files:
file_path = os.path.join(working_dir, file_name)
clean_epochs = mne.read_epochs(file_path, preload=True)

Error:
runfile(‘C:/Users/anomatth/Downloads/Power + Fourier_correct.py’, wdir=‘C:/Users/anomatth/Downloads’)
Reading C:\Users\anomatth\OneDrive - UGent\BELAS_EEG_MasterproefII2024\nieuw\9696-25_T1_RS.fif …
C:\Users\anomatth\Downloads\Power + Fourier_correct.py:41: RuntimeWarning: This filename (C:/Users/anomatth/OneDrive - UGent/BELAS_EEG_MasterproefII2024/nieuw\9696-25_T1_RS.fif) does not conform to MNE naming conventions. All epochs files should end with -epo.fif, -epo.fif.gz, _epo.fif or _epo.fif.gz
clean_epochs = mne.read_epochs(file_path, preload=True)
Traceback (most recent call last):

File ~\Downloads\Power + Fourier_correct.py:41
clean_epochs = mne.read_epochs(file_path, preload=True)

File :12 in read_epochs

File ~\Anaconda3\envs\mne\lib\site-packages\mne\epochs.py:3176 in read_epochs
return EpochsFIF(fname, proj, preload, verbose)

File :12 in init

File ~\Anaconda3\envs\mne\lib\site-packages\mne\epochs.py:3235 in init
fid, tree, _ = fiff_open(fname, preload=preload)

File :12 in fiff_open

File ~\Anaconda3\envs\mne\lib\site-packages\mne\io\open.py:126 in fiff_open
return _fiff_open(fname, fid, preload)

File ~\Anaconda3\envs\mne\lib\site-packages\mne\io\open.py:145 in _fiff_open
raise ValueError(f’{prefix} start with a file id tag’)

ValueError: file ‘C:\Users\anomatth\OneDrive - UGent\BELAS_EEG_MasterproefII2024\nieuw\9696-25_T1_RS.fif’ does not start with a file id tag

Kind regards
Anouk

Can you not save your preprocessed data in the BrainVision format? MNE has a dedicated importer for this format.

1 Like