Open source library
edfplus
A typed Python library for reading EDF and EDF+ files, the open format used for EEG, ECG, sleep studies and other biosignal recordings.
The problem
The European Data Format (EDF) and its EDF+ extension store multichannel physiological recordings such as EEG, ECG and polysomnography. They are compact and widely used, but the format has plenty of quirks: a fixed-width ASCII header, 16-bit data records, annotations embedded in the data stream, and separate continuous and discontinuous recording modes.
I have worked with these files professionally and wanted a clean, well-tested reader with a modern Python API and complete type annotations.
The approach
edfplus opens a file from a path or any seekable binary stream and loads signal samples lazily, so you can inspect a large recording and read only the channels and time ranges you need.
- Reads EDF, EDF+C and EDF+D, including embedded annotations
- Slices by seconds, sample index, datetimes or durations
- Returns physical (scaled floats) or raw digital values, in the NumPy dtype you choose
- Generates per-sample timestamps, with timezone correction
- Fully typed, with a py.typed marker for type checkers
from edfplus import read_edf
with read_edf("recording.edf") as edf:
eeg = edf["EEG Fp1"]
samples, timestamps = eeg.load_with_timestamps(onset=5.0, duration=3.0)Where it stands
The library is published on PyPI, with tests running on every change through GitHub Actions and coverage reported to Codecov. Documentation is hosted online, and development used AI coding assistants under close review.