Skip to content

Support STIM channels in EDF export #9883

@cbrnr

Description

@cbrnr

I found some issues with our recently added EDF export that we might want to fix before the next release:

  1. The error if EDFlib-Python is not installed is misleading, because it says RuntimeError: For exporting to EDF to work, the EDFlib module is needed, but it could not be imported. However, although the import name is EDFlib, the PyPI name is actually EDFlib-Python and EDFlib is a different PyPI package (which requires Cython etc.).
  2. EDFlib-Python is super slow compared to pyEDFlib (which uses the C implementation). I tested exporting with one of our BDF files from our lab (425MB), and it took EDFlib-Python 1 minute and 52 seconds to export. For comparison, pyEDFlib took only 6 seconds.
  3. Analog stim channels are not exported. This is essential in BDF files, because Biosemi amplifiers do not have discrete triggers and instead always write an analog stim channel. There is no technical reason to not export stim channels in addition to EEG (other than carefully setting the scaling, unit, and physical min/max). I've fixed this in my EDF/BDF export implementation in MNELAB recently (today) in Fix EDF/BDF export of data containing STIM channels cbrnr/mnelab#230.

The first issue is probably easy to fix. The second issue is pretty serious, we can't expect that users wait almost 2 minutes for something that can be done in 6 seconds. I'd consider switching to pyEDFlib instead (they have binary wheels and AFAIR the restriction to use pure Python applies only to our project but not external dependencies). The third issue requires some work, but this is important for BDF files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions