NeuroTechX / NeuroTechX/moabb

Error reading matlab files from Cattan2019_VR

Open
#506 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug moabb
Dominant language
Python
Stars
1.1k
Forks
264
Avg merge
1d 13m
Merged PRs (30d)
23

Description

There is an issue arising in Cattan2019_VR when reading matlab, but I could not track to what triggered it. I thought it was from h5py new version (above 3.8), but this does not seems to any impact.

There error is:

Unexpected failing examples:
/home/runner/work/moabb/moabb/examples/plot_vr_pc_p300_different_epoch_size.py failed leaving traceback:
Traceback (most recent call last):
  File "/home/runner/work/moabb/moabb/examples/plot_vr_pc_p300_different_epoch_size.py", line 108, in <module>
    X_train, y_train, _ = dataset.get_block_repetition(
  File "/home/runner/work/moabb/moabb/moabb/datasets/braininvaders.py", line 936, in get_block_repetition
    X, labels, meta = paradigm.get_data(self, subjects)
  File "/home/runner/work/moabb/moabb/moabb/paradigms/base.py", line 278, in get_data
    data = [
  File "/home/runner/work/moabb/moabb/moabb/paradigms/base.py", line 279, in <listcomp>
    dataset.get_data(
  File "/home/runner/work/moabb/moabb/moabb/datasets/base.py", line 342, in get_data
    data[subject] = self._get_single_subject_data_using_cache(
  File "/home/runner/work/moabb/moabb/moabb/datasets/base.py", line 436, in _get_single_subject_data_using_cache
    sessions_data = self._get_single_subject_data(subject)
  File "/home/runner/work/moabb/moabb/moabb/datasets/braininvaders.py", line 899, in _get_single_subject_data
    return _bi_get_subject_data(self, subject)
  File "/home/runner/work/moabb/moabb/moabb/datasets/braininvaders.py", line 166, in _bi_get_subject_data
    data = loadmat(os.path.join(file_path, os.listdir(file_path)[0]))["data"]
  File "/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/scipy/io/matlab/_mio.py", line 227, in loadmat
    matfile_dict = MR.get_variables(variable_names)
  File "/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/scipy/io/matlab/_mio5.py", line 332, in get_variables
    res = self.read_var_array(hdr, process)
  File "/home/runner/work/moabb/moabb/.venv/lib/python3.9/site-packages/scipy/io/matlab/_mio5.py", line 292, in read_var_array
    return self._matrix_reader.array_from_header(header, process)
  File "_mio5_utils.pyx", line 666, in scipy.io.matlab._mio5_utils.VarReader5.array_from_header
  File "_mio5_utils.pyx", line 695, in scipy.io.matlab._mio5_utils.VarReader5.array_from_header
  File "_mio5_utils.pyx", line 769, in scipy.io.matlab._mio5_utils.VarReader5.read_real_complex
  File "_mio5_utils.pyx", line 446, in scipy.io.matlab._mio5_utils.VarReader5.read_numeric
  File "_mio5_utils.pyx", line 351, in scipy.io.matlab._mio5_utils.VarReader5.read_element
  File "_streams.pyx", line 171, in scipy.io.matlab._streams.ZlibInputStream.read_string
  File "_streams.pyx", line 164, in scipy.io.matlab._streams.ZlibInputStream.read_into
OSError: could not read bytes

For now, the examples/plot_vr_pc_p300_different_epoch_size.py, examples/plot_phmd_ml_spectrum.py and tutorial_5_build_a_custom_dataset.pyare not built within CI to avoid the error, but we need to find ther source of error and report it to upstream.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with moabb/datasets/braininvaders.py at _bi_get_subject_data and reproduce the failure using the three named examples, especially plot_vr_pc_p300_different_epoch_size.py. Trace the failing scipy.io.loadmat call against the Cattan2019_VR data and determine whether the source is the file or an upstream reader. Done means documenting the cause and reporting it upstream, with the affected examples no longer needing to be excluded from CI.

Written by the indexing model from the issue text.

Assessment

Tech stack
matlab, python
Domain
data, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.