Skip to main content

edfio

Python PyPI conda-forge License Docs

Checked with mypy Ruff

edfio is a Python package for reading and writing EDF and EDF+C files.

It requires Python>=3.9 and NumPy>=1.22 and is available on PyPI:

pip install edfio
  • Support for EDF, EDF+C, BDF, and BDF+C including annotations
  • Fast I/O thanks to NumPy - read and write GB-sized files in seconds
  • Fail late on read: Non-compliant header fields only raise an exception when the corresponding property is accessed.
  • Fail early on write: Trying to create a new non-compliant EDF file raises an exception.
  • Object-oriented design and type annotations for IDE autocompletion
  • Pure Python implementation and 100% test coverage to simplify contributions

Features

  • Read/write from/to files or file-like objects
  • Modify signal and recording headers
  • Drop EDF+ annotations
  • Slice recordings (by seconds or annotation texts)
  • Drop individual signals
  • Anonymize recordings
  • BDF file (BioSemi) support

Known limitations

  • Discontiguous files (EDF+D) are treated as contiguous ones.
  • The maximum data record size of 61440 bytes recommended by the EDF specs is not enforced.
  • To write an EDF with a non-integer seconds duration, the data record duration has to be manually set to an appropriate value.
  • Slicing an EDF to a timespan that is not an integer multiple of the data record duration does not work.

Contributing

Contributions are welcome and highly appreciated. Check out the contributing guidelines to get started.

Usage

Further information is available in the API reference and usage examples.

To read an EDF from a file, use edfio.read_edf:

from edfio import read_edf

edf = read_edf("example.edf")

A new EDF can be created and written to a file as follows:

import numpy as np

from edfio import Edf, EdfSignal

edf = Edf(
    [
        EdfSignal(np.random.randn(30 * 256), sampling_frequency=256, label="EEG Fpz"),
        EdfSignal(np.random.randn(30), sampling_frequency=1, label="Body Temp"),
    ]
)
edf.write("example.edf")

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

edfio-0.4.16.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

edfio-0.4.16-py3-none-any.whl (31.8 kB view details)

Uploaded Python 3

File details

Details for the file edfio-0.4.16.tar.gz.

File metadata

  • Download URL: edfio-0.4.16.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for edfio-0.4.16.tar.gz
Algorithm Hash digest
SHA256 d30cabe949d95f9ca6291dafac56c497cc1ecefc0b1c549edaf2c9a04475499c
MD5 32d79c09a50feaa83f54a5158c894cae
BLAKE2b-256 03baaf2ab056cfb87c5cca3417e7ddc15e44c7f8038273bdce7d76c1ec60704d

See more details on using hashes here.

File details

Details for the file edfio-0.4.16-py3-none-any.whl.

File metadata

  • Download URL: edfio-0.4.16-py3-none-any.whl
  • Upload date:
  • Size: 31.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for edfio-0.4.16-py3-none-any.whl
Algorithm Hash digest
SHA256 9badc75b49457c43a283ed85ec05d3873be1b920c09abe8cba756cb3616b7143
MD5 9958d6533c71f3e15db2a933a79ac912
BLAKE2b-256 f5e0a10b924c3da5e6be57819aeea8f3fa7a8fba8f0710aa77b290f080bf531d

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.4.16 This release

2 files

0.4.15

2 files

0.4.14

2 files

0.4.13

2 files

0.4.12

2 files

0.4.11

2 files

0.4.10

2 files

0.4.9

2 files

0.4.8

2 files

0.4.7

2 files

0.4.6

2 files

0.4.5

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page