Skip to main content

Read and write EDF/EDF+ files.

Project description

edfio

Python PyPI conda-forge License Docs

Poetry 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 and EDF+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

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.
  • BDF files (BioSemi) are not supported.

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.4.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

edfio-0.4.4-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: edfio-0.4.4.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.9.20 Linux/6.8.0-1014-azure

File hashes

Hashes for edfio-0.4.4.tar.gz
Algorithm Hash digest
SHA256 0e18a284d3e9775d89a4e421992cd38b4370a43cb3c93333a10c9b0555f52d96
MD5 12f3f19dd4af8aea1d5487e7ae4cfa43
BLAKE2b-256 701b79b9587a2965e8cbd32e1773523e3ca9c8905aaf2ff1b0caca7aecfb18a8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edfio-0.4.4-py3-none-any.whl
  • Upload date:
  • Size: 25.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.9.20 Linux/6.8.0-1014-azure

File hashes

Hashes for edfio-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 63bbb5288f5a2fe05933f7aedbab01b3abb5a3dcc36586775810dacb2cfd2deb
MD5 a01deaf1e90c6d685465dcb55ce1407c
BLAKE2b-256 374344ef34a10e58e86d086b4e978415c02bdef351be91516391b98689c382fe

See more details on using hashes here.

Supported by

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