Skip to content

";" are not supported in EDF annotation descriptions #7287

Closed

Description

@adam2392

Describe the bug

Hi, I'm currently reading in an EDF file w/ the latest MNE dev version. read_raw_edf, and I encounter this error:

"ValueError: Semicolons in descriptions not supported."

I took a look at the descriptions for each annotation inside the EDF file using edfbrowser, and I see semicolons, but at the same time I don't quite understand why this is a problem? Is it possible to submit a PR that gets rid of this check if it is not necessary?

I can submit a PR if this is something we can fix.

Steps to reproduce

  1. Create EDF file with annotation with a ";" in description.
  2. Use read_raw_edf to read in file

Expected results

Some specific error text, specifying how we can fix this?

Or just no error at all.

Actual results

"ValueError: Semicolons in descriptions not supported."

Additional information

/home/adam2392/anaconda3/envs/eztrack/bin/python /home/adam2392/Documents/eztrack/eztrack/pipeline/preprocess/run_bids_conversion.py
Platform:      Linux-5.3.0-26-generic-x86_64-with-debian-buster-sid
Python:        3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 19:07:31)  [GCC 7.3.0]
Executable:    /home/adam2392/anaconda3/envs/eztrack/bin/python
CPU:           x86_64: 24 cores
Memory:        62.7 GB

mne:           0.20.dev0
numpy:         1.17.2 {blas=mkl_rt, lapack=mkl_rt}
scipy:         1.3.1
matplotlib:    3.1.2 {backend=Qt5Agg}

sklearn:       0.21.3
numba:         0.45.1
nibabel:       2.5.1
cupy:          Not found
pandas:        0.25.1
dipy:          1.0.0
mayavi:        4.6.2 {qt_api=pyqt5, PyQt5=5.9.2}
pyvista:       Not found
vtk:           8.2.0
None

Process finished with exit code 0

Activity

  1. agramfort commented on Feb 4, 2020

    @agramfort
    SponsorMember
  2. adam2392 commented on Feb 4, 2020

    @adam2392
    MemberAuthor

    Sharing a file or fixing the bug directly is helpful

    Will try trimming a file and posting a dropbox link here.

  3. adam2392 commented on Feb 4, 2020

    @adam2392
    MemberAuthor

    https://www.dropbox.com/s/f3cg7xme8x3a0ui/SEEG_SZ_1P_0001_reduced_reduced.edf?dl=0

    for a reduced file that will not read because ";" are in annotation descriptions. I took a look at the source code, and:

    from mne.annotations.py

    def _check_o_d_s(onset, duration, description):
        ...
        description = np.array(description, dtype=str)
        if description.ndim == 0 or description.shape == (1,):
            description = np.repeat(description, len(onset))
        if description.ndim != 1:
            raise ValueError('Description must be a one dimensional array, '
                             'got %d.' % (description.ndim,))
        if any([';' in desc for desc in description]):
            raise ValueError('Semicolons in descriptions not supported.')
    

    is causing the error. I don't see why, we possibly can't take out that value error, or do a string replacement w/ say "-", or "|" to denote separation if really necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions