Skip to main content

Python library for importing XDF (Extensible Data Format)

Project description

Latest PyPI Release Latest Conda Release Python 3.9+ License

pyXDF

pyXDF is a Python importer for XDF files.

Sample usage

import matplotlib.pyplot as plt
import numpy as np

import pyxdf

data, header = pyxdf.load_xdf("test.xdf")

for stream in data:
    y = stream["time_series"]

    if isinstance(y, list):
        # list of strings, draw one vertical line for each marker
        for timestamp, marker in zip(stream["time_stamps"], y):
            plt.axvline(x=timestamp)
            print(f'Marker "{marker[0]}" @ {timestamp:.2f}s')
    elif isinstance(y, np.ndarray):
        # numeric data, draw as lines
        plt.plot(stream["time_stamps"], y)
    else:
        raise RuntimeError("Unknown stream format")

plt.show()

CLI examples

pyxdf has a cli module with the following basic command line tools:

  • print_metadata will enable a DEBUG logger to log read messages, then it will print basic metadata for each found stream.
    • python -m pyxdf.cli.print_metadata -f=/path/to/my.xdf
  • playback_lsl will open an XDF file, then replay its data in an infinite loop, but using current timestamps. This is useful for prototyping online processing.
    • python -m pyxdf.cli.playback_lsl /path/to/my.xdf --loop

Installation

The latest stable version can be installed with pip install pyxdf.

For the latest development version, use pip install git+https://github.com/xdf-modules/pyxdf.git.

For maintainers

A new release is automatically uploaded to PyPI. Therefore, as soon as a new release is created on GitHub (using a tag labeled e.g. v1.16.3), a PyPI package is created with the version number matching the release tag.

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

pyxdf-1.17.0.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

pyxdf-1.17.0-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file pyxdf-1.17.0.tar.gz.

File metadata

  • Download URL: pyxdf-1.17.0.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.5.15

File hashes

Hashes for pyxdf-1.17.0.tar.gz
Algorithm Hash digest
SHA256 9980c5506945632fcb27cca899e4db12b156d70fc31c703d3fdb2f0870dbaee9
MD5 2fd638d11405cfe1ef724f98da86805f
BLAKE2b-256 ea6792ddc296e1b25f421983c5e58fb59f85a26350af9805359b356abbf6337e

See more details on using hashes here.

File details

Details for the file pyxdf-1.17.0-py3-none-any.whl.

File metadata

  • Download URL: pyxdf-1.17.0-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.5.15

File hashes

Hashes for pyxdf-1.17.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a651ab64283e05b4ea98e403aeb6b695e83902d2a1f3c43fa80f9679c91f023f
MD5 be0541949ccd8c414a58ec21ce02fbe9
BLAKE2b-256 2570d56d7f4c0bc61e35b83ec949b34393e845d8b68f52f6b290b3186e4b24c9

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