Error reading EEGLAB file (buffer too small)
See original GitHub issueThis issue was reported in our forum using this example file.
raw = mne.io.read_raw_eeglab("EC_CON1.set")
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-6-90625f7fcaf5> in <module>
----> 1 raw = mne.io.read_raw_eeglab("EC_CON1.set")
/usr/local/lib/python3.9/site-packages/mne/io/eeglab/eeglab.py in read_raw_eeglab(input_fname, eog, preload, uint16_codec, verbose)
217 .. versionadded:: 0.11.0
218 """
--> 219 return RawEEGLAB(input_fname=input_fname, preload=preload,
220 eog=eog, verbose=verbose, uint16_codec=uint16_codec)
221
<decorator-gen-261> in __init__(self, input_fname, eog, preload, uint16_codec, verbose)
/usr/local/lib/python3.9/site-packages/mne/io/eeglab/eeglab.py in __init__(self, input_fname, eog, preload, uint16_codec, verbose)
316 preload=False, uint16_codec=None, verbose=None): # noqa: D102
317 input_fname = _check_fname(input_fname, 'read', True, 'input_fname')
--> 318 eeg = _check_load_mat(input_fname, uint16_codec)
319 if eeg.trials != 1:
320 raise TypeError('The number of trials is %d. It must be 1 for raw'
/usr/local/lib/python3.9/site-packages/mne/io/eeglab/eeglab.py in _check_load_mat(fname, uint16_codec)
57 """Check if the mat struct contains 'EEG'."""
58 from ...externals.pymatreader import read_mat
---> 59 eeg = read_mat(fname, uint16_codec=uint16_codec)
60 if 'ALLEEG' in eeg:
61 raise NotImplementedError(
/usr/local/lib/python3.9/site-packages/mne/externals/pymatreader/pymatreader.py in read_mat(filename, variable_names, ignore_fields, uint16_codec)
87 extra_kwargs['uint16_codec'] = uint16_codec
88
---> 89 raw_data = scipy.io.loadmat(fid, struct_as_record=True,
90 squeeze_me=True, mat_dtype=False,
91 variable_names=variable_names,
/usr/local/lib/python3.9/site-packages/scipy/io/matlab/mio.py in loadmat(file_name, mdict, appendmat, **kwargs)
224 with _open_file_context(file_name, appendmat) as f:
225 MR, _ = mat_reader_factory(f, **kwargs)
--> 226 matfile_dict = MR.get_variables(variable_names)
227
228 if mdict is not None:
/usr/local/lib/python3.9/site-packages/scipy/io/matlab/mio5.py in get_variables(self, variable_names)
330 continue
331 try:
--> 332 res = self.read_var_array(hdr, process)
333 except MatReadError as err:
334 warnings.warn(
/usr/local/lib/python3.9/site-packages/scipy/io/matlab/mio5.py in read_var_array(self, header, process)
290 `process`.
291 '''
--> 292 return self._matrix_reader.array_from_header(header, process)
293
294 def get_variables(self, variable_names=None):
mio5_utils.pyx in scipy.io.matlab.mio5_utils.VarReader5.array_from_header()
mio5_utils.pyx in scipy.io.matlab.mio5_utils.VarReader5.array_from_header()
mio5_utils.pyx in scipy.io.matlab.mio5_utils.VarReader5.read_struct()
mio5_utils.pyx in scipy.io.matlab.mio5_utils.VarReader5.read_mi_matrix()
mio5_utils.pyx in scipy.io.matlab.mio5_utils.VarReader5.array_from_header()
mio5_utils.pyx in scipy.io.matlab.mio5_utils.VarReader5.read_char()
TypeError: buffer is too small for requested array
It looks like this is related to reading the .mat file.
Issue Analytics
- State:
- Created 2 years ago
- Comments:27 (18 by maintainers)
Top Results From Across the Web
How to solve the problem of TypeError · Issue #8226 - GitHub
File "mio5_utils.pyx", line 876, in scipy.io.matlab.mio5_utils.VarReader5.read_char TypeError: buffer is too small for requested array.
Read more >TypeError: buffer is too small for requested array - MNE Forum
External Email - Use Caution. Hi everyone,. I am trying to load an EEGLAB dataset using mne.io.read_raw_eeglab(), and here are the lines:.
Read more >mne.io.read_raw_eeglab — MNE 1.3.dev0 documentation
If your set file contains non-ascii characters, sometimes reading it may fail and give rise to error message stating that “buffer is too...
Read more >Error -200229: Buffer Is Too Small to Fit Read Data - NI - Support
Solution. This error can occur when you increase the number of channels to read from, but do not increase the sample buffer size...
Read more >[Eeglablist] LIMO Errors Importing Data
Previous message: [Eeglablist] The Melcher (NYUAD) Lab is recruiting ... create single trial data: Error using load: Unable to read file '…
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://github.com/mne-tools/mne-python/issues/8226#issuecomment-965439900
Quoting the docs for the
uint16_codec
parameter ofread_raw_eeglab
: