Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

edfio

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

edfio

Read and write EDF/EDF+ files.

  • 0.4.5
  • PyPI
  • Socket score

Maintainers
1

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc