mne-tools / mne-tools/mne-python

Incorrect number of samples error when loading a Synamps Neuroscan Curry file

Open
#9,293 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

BUG
Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Description

Describe the bug

When trying to read the data of a Neuroscan Synamps .dat file containing a recording with 128 EEG-electrodes, I am presented with the following error:

RuntimeError: Incorrect number of samples (7623792 != 24999876), please report this error to MNE-Python developers

The file loads correctly in Matlab using EEGLAB and the loadcurry plugin.
I believe this issue to be different than #8391, since the number of channels looks correct and the reported number of samples is a lot smaller than the actual number of samples.

Steps to reproduce
import mne
mne.io.read_raw_curry('subject_01.dat', preload=True)

I cannot legally share the .dat data file, but the accompanying metadata files in the same directory can be found here:

Expected results

The file loads correctly

Actual results
Leaving device<->head transform as None (no landmarks found)
Reading 0 ... 1748799  =      0.000 ...  1748.799 secs...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<decorator-gen-242>", line 24, in read_raw_curry
  File "/data/Workspace/PhD/mne-python/mne/io/curry/curry.py", line 470, in read_raw_curry
    return RawCurry(fname, preload, verbose)
  File "<decorator-gen-243>", line 24, in __init__
  File "/data/Workspace/PhD/mne-python/mne/io/curry/curry.py", line 503, in __init__
    super(RawCurry, self).__init__(
  File "<decorator-gen-179>", line 24, in __init__
  File "/data/Workspace/PhD/mne-python/mne/io/base.py", line 254, in __init__
    self._preload_data(preload)
  File "/data/Workspace/PhD/mne-python/mne/io/base.py", line 534, in _preload_data
    self._data = self._read_segment(
  File "<decorator-gen-181>", line 24, in _read_segment
  File "/data/Workspace/PhD/mne-python/mne/io/base.py", line 419, in _read_segment
    _ReadSegmentFileProtector(self)._read_segment_file(
  File "/data/Workspace/PhD/mne-python/mne/io/base.py", line 2013, in _read_segment_file
    return self.__raw.__class__._read_segment_file(
  File "/data/Workspace/PhD/mne-python/mne/io/curry/curry.py", line 533, in _read_segment_file
    _read_segments_file(
  File "/data/Workspace/PhD/mne-python/mne/io/utils.py", line 222, in _read_segments_file
    raise RuntimeError('Incorrect number of samples (%s != %s), '
RuntimeError: Incorrect number of samples (7623792 != 24999876), please report this error to MNE-Python developers
Additional information
Platform:      Linux-5.11.11-200.fc33.x86_64-x86_64-with-glibc2.32
Python:        3.9.2 (default, Feb 20 2021, 00:00:00)  [GCC 10.2.1 20201125 (Red Hat 10.2.1-9)]
Executable:    /data/Workspace/PhD/mne-python/.venv/bin/python
CPU:           x86_64: 12 cores
Memory:        Unavailable (requires "psutil" package)
mne:           0.23.dev0
numpy:         1.20.2 {blas=openblas, lapack=openblas}
scipy:         1.6.2
matplotlib:    Not found

sklearn:       Not found
numba:         Not found
nibabel:       Not found
nilearn:       Not found
dipy:          Not found
cupy:          Not found
pandas:        Not found
mayavi:        Not found
pyvista:       Not found
vtk:           Not found
``

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 mne/io/curry/curry.py, especially read_raw_curry, RawCurry, and _read_segment_file, and reproduce the failure with the linked .ceo, .dap, and .rs3 metadata alongside the unavailable .dat file. The work is done when the provided Synamps Neuroscan Curry recording loads without the incorrect-sample-count error and reports the expected samples.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.