Skip to main content

Read and write EDF/EDF+C/BDF/BDF+C files.

Project description

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")

Project details


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.14.tar.gz (27.6 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.14-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: edfio-0.4.14.tar.gz
  • Upload date:
  • Size: 27.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","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.14.tar.gz
Algorithm Hash digest
SHA256 2951675e297dd4435baae18e965360aeddff9f5f3b20cc09ddc317326dbc3432
MD5 f58589826b0f4e1e2027d1f29cf7098d
BLAKE2b-256 fd7417fede8457db772e60a7663ddb6c47744af465515099d520ca77e56ec18c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edfio-0.4.14-py3-none-any.whl
  • Upload date:
  • Size: 30.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","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.14-py3-none-any.whl
Algorithm Hash digest
SHA256 dbb682ba79ef7821bf58c220925c65ef1f7c0f43f621670cda90d5f7268eab50
MD5 58288040dfd8f3b5cca0d1de7a6bb673
BLAKE2b-256 83ee8bb87fbcd04d4819197d1f8e2e4069b68debab0cfa73f48211824ed9c810

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page