how to read eeg txt file with mne?

I have some EEG files with txt format but i don’t know how to use mne to read them?
i’ll be thanksful if you help me.

Hello @mehrab and welcome to the forum!

It’s difficult to tell how to read those files, as it seems to be an arbitrary format. If you could share one of them, we could certainly have a look and try to help you!

Best wishes,
Richard

1 Like

Hello.
thanks for your answe.
i’ll share the file here and i also should say that i’m using the last version of mne.
thanks again.
here it is the link:

Hello, the following code should do the trick.

# %%
from pathlib import Path
import pandas as pd
import mne


in_path = './P1.txt'
data = pd.read_csv(in_path, sep=' ')

ch_names = data.columns.tolist()
data_scaled = data.to_numpy() * 1e-6  # µV -> V
data_scaled = data_scaled.T  # (n_times, n_chans) -> (n_chans, n_times)
del data

info = mne.create_info(
    ch_names=ch_names,
    ch_types='eeg',
    sfreq=500  # check this!
)
raw = mne.io.RawArray(
    data=data_scaled, 
    info=info
)
raw.plot()

1 Like

Thank you for taking the trouble to help me.I do appreciate it.