Why is the `uint16_codec` parameter of `mne.io.read_raw_eeglab` not passed to `loadmat`

Hi, everyone,

I am trying to load an EEGLAB dataset using mne.io.read_raw_eeglab(), but I got the error: buffer is too small for requested array.

Then I found How to solve the problem of TypeError · Issue #8226 · mne-tools/mne-python · GitHub and learned about the parameter uint16_codec, but the problem still persists. Further investigation revealed that the error occurred at:

     75 try:
     76     read_mat = _import_pymatreader_funcs("EEGLAB I/O")
     77 except RuntimeError:  # pymatreader not installed
---> 78     eeg = loadmat(fname, squeeze_me=True, mat_dtype=False)
     79     return _check_for_scipy_mat_struct(eeg)
     80 else:
     81     return read_mat(fname, uint16_codec=uint16_codec)

then searched for related issues of this function and found TypeError: buffer is too small for requested array when reading file with io.loadmat · Issue #5516 · scipy/scipy · GitHub.

In the end, I succeeded by passing uint16_codec to loadmat. So I want to know why the parameter uint16_codec was not directly passed to loadmat, as it seems that pymatreader dependency is not installed when mne is installed.

Please excuse my non-native English and verbose expression.

Thanks for any help!

Thank you for your detailed report! I am not sure why the unit16_codec is not passed, it looks like this was an oversight. Would you be willing to open a PR with this change? If not, I’m happy to do that.

Thank you for your response! Unfortunately, I’m unable to open a PR at the moment, but I appreciate you offering to make the change.

Sure thing: Use `uint16_codec` argument by cbrnr · Pull Request #12971 · mne-tools/mne-python · GitHub

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.