This directory contains code to wrap Teunis van Beelen's edflib for python.

It provides access to EDF files, the european data format---commonly used for EEG and other biosignal recordings.

src/ -> holds the a version of edflib from Teunis's web site edflib/ -> holds the python/cython code to wrap edflib tests/ -> tests examples/ -> example code and short samples

Almost all of the low-level C functions in Teunis's edflib are wrapped in edflib._edflib which is created in cython. I have started creating more pythonic wrappers.


This code is licensed under the same BSD-style license that Teunis released edflib under and with the same disclaimer. (See src/edflib.c and README-edflib.txt)



This is currently "research quality" code. I initially developed it for my limited purposes to read a few dozen EEGs for a research project. It is inching towards respectability as it is being updated as we have project that needs it to process through tens of thousands of edf files.

It still more needs tests, more refractoring to make a real pythonic api before heading to towards a polished package.

I am currently updating edfwriter for 0.7 as I will be needing to use this functionality again.

edfreader - now has tests - needs more edfwriter likely needs re-writing

I continue to make it available in the hopes that it may be useful for others. As I need to use it, I may continue to improve and update it, but I can make no promises.

python 3 compatibility

The package is now compatible with python 3. The distinction between bytes and strings is now clear. For clarity all the cython and C code uses bytes only. The python code deals with decoding and encoding to either ascii or UTF-8 (for annotations) as described in the spec. In addition, I will accept UTF-8 on reading though it is outside of spec.

Functions and properties with an 'underscore b' (_b) deal with bytes representation, while unadorned python functions return native python strings or numbers.

The goal is such that one can always get full access to the raw C functions and bytes from python, but provide pleasant to use python interfaces via the reader and writer classes.

Change list

2018-02-15 noted that edflib.h not included in source package added to extension file list for 0.74 2017-03-22 added bitbucket-piplines.yml and got integration tests running 2017-03-22 update properties to modern (python 3) syntax in _edflib. Make distinction clear. Add tests. 2017-03 tweaks to api, python 3 working: will try for dual compatible code python 2.7 + python 3.5+ support 2015-06 update to edflib 1.11


To upload to pypi::
python sdist upload -r pypi


  • [ ] fix examples to be compatible with changes in api
  • [x] basic tests with py.test
  • [ ] test opening two files at once
  • [/] test, tests, tests !!!
  • [x] inital port to python 3 (tested with 3.5)
  • [ ] add new functions from version 1.10 of edflibX
  • [ ] update cython interface to use typed memory views(???)
  • [x] set up continuous build/integration if possible - done on bitbucket for py 3.5