EEG files in .dat format cannot be read by mne, numpy, pandas and pickle.

  • MNE version: 1.6.0
  • operating system: Windows 11
    I have a series of EEG data recorded with medua server provided by others , the recordings get four files, their txt opens with the contents as shown in the picture. The .dat file is too large for my computer to open in txt.
    I have referred to other questions within the forum about opening .dat files and I understand that the core idea is to use other functions to read them and then convert them to raw objects.
    However, when reading the .dat file using numpy, pandas and pickle in turn, the encoding error occurs, please help me find a solution, thank you.
    The code and the screenshot of the error report are in the post in turn.


#fname = 'xx.dat'
import numpy as np
import matplotlib.pyplot as plt

data = numpy.loadtxt(fname)
data = data.T
plt.plot(*data)
plt.show()

UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xd2 in position 2: illegal multibyte sequence

import pandas
import matplotlib.pyplot as plt

data = pandas.read_csv(fname)
data = data.T
plt.plot(*data)
plt.show()

UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xce in position 0: invalid continuation byte

The encoding method tried GB2312, gb18030, ISO-8859-1, and the error is reported as follows
‘gb2312’ codec can’t decode byte 0xce in position 0: illegal multibyte sequence
‘gb18030’ codec can’t decode byte 0xd2 in position 2: illegal multibyte sequence
ISO-8859-1:Error tokenizing data. C error: Expected 2 fields in line 4, saw 3

The original file is about 300MB, since I’m from China I chose BaiduNetdisk to provide the file, if you can’t get it or there are other ways please let me know, thanks.
Link to original file:https://pan.baidu.com/s/1zalW8ZLcs5X9eiF29g1T9A?pwd=abcd
Extract code: abcd

The problem is that you have a proprietary data format (“MEDUA”?). Not every software will be able to read this, even if the file extension may be something that is common (“.dat” is often used).

For example the extension “.edf” is commonly used for both:

  • eyelink data format
  • european data format

however a “european data format” reading software won’t be able to read an “eyelink data format” data file, and vice versa.

Instead of trying all sorts of software to see whether it can read your data format, you need to go to the documentation of whoever provided you with your data and ask them which software must be used to read the data.