If you have a question or issue with MNE-Python, please include the following info:
- MNE version: 1.4.2
- operating system: Windows 10
It sees that a bug occurs in io.read_raw_eeglab
In method io.eeglab.RawEEGLab.__init__()
at line 481:
annot = read_annotations(input_fname)
only input_fname
is passed into the function, while in read_annotations
, if the input_fname
is a eeglab *.set
file, another argument about codec is also required:
def read_annotations(fname, sfreq="auto", uint16_codec=None):
#...
elif name.endswith("set"):
annotations = _read_annotations_eeglab(fname, uint16_codec=uint16_codec)
My story
I met with the aforementioned problem just now, when I was trying to read a set file by using:
raw = io.read_raw_eeglab(path, preload=False, uint16_codec='latin1', verbose=True)
then I got the error buffer is too small for requested array
Traceback (most recent call last):
…
return self._matrix_reader.array_from_header(header, process)
File “_mio5_utils.pyx”, line 665, in scipy.io.matlab._mio5_utils.VarReader5.array_from_header
File “_mio5_utils.pyx”, line 712, in scipy.io.matlab._mio5_utils.VarReader5.array_from_header
File “_mio5_utils.pyx”, line 956, in scipy.io.matlab._mio5_utils.VarReader5.read_struct
File “_mio5_utils.pyx”, line 663, in scipy.io.matlab._mio5_utils.VarReader5.read_mi_matrix
File “_mio5_utils.pyx”, line 706, in scipy.io.matlab._mio5_utils.VarReader5.array_from_header
File “_mio5_utils.pyx”, line 870, in scipy.io.matlab._mio5_utils.VarReader5.read_char
TypeError: buffer is too small for requested array
To fix this issue, just replace line 481 with:
annot = read_annotations(input_fname, uint16_codec=uint16_codec)
Please fix it
I’ve read Page Redirection, it told me that before I lanuch a new issue or pr, it’s usually best to open a new issue our user forum first.
If the issue I mentioned above is really a bug, please fix it, thanks!