Skip to main content
Python build Python tests Test coverage Documentation Status PyPi version Conda version Zenodo archive

pybv

For documentation, see the:

pybv is a lightweight I/O utility for the BrainVision data format.

The BrainVision data format is a recommended data format for use in the Brain Imaging Data Structure.

About the BrainVision data format

BrainVision is the name of a file format commonly used for storing electrophysiology data. Originally, it was put forward by the company Brain Products, however the simplicity of the format has allowed for a diversity of tools reading from and writing to the format.

The format consists of three separate files:

  1. A text header file (.vhdr) containing meta data

  2. A text marker file (.vmrk) containing information about events in the data

  3. A binary data file (.eeg) containing the voltage values of the EEG

Both text files are based on the Microsoft Windows INI format consisting of:

  • sections marked as [square brackets]

  • comments marked as ; comment

  • key-value pairs marked as key=value

The binary .eeg data file is written in little-endian format without a Byte Order Mark (BOM), in accordance with the specification by Brain Products. This ensures that the data file is uniformly written irrespective of the native system architecture.

A documentation for the BrainVision file format is provided by Brain Products. You can view the specification as hosted by Brain Products.

Installation

pybv runs on Python version 3.10 or higher.

pybv’s only dependency is numpy. However, we currently recommend that you install MNE-Python for reading BrainVision data. See their installation instructions.

After you have a working installation of MNE-Python (or only numpy if you do not want to read data and only write it), you can install pybv through the following:

python -m pip install --upgrade pybv

or if you use conda:

conda install --channel conda-forge pybv

For installing the latest (development) version of pyprep, call:

python -m pip install --upgrade https://github.com/bids-standard/pybv/archive/refs/heads/main.zip

Both the stable and the latest installation will additionally install all required dependencies automatically. The dependencies are defined in the pyproject.toml file under the dependencies and project.optional-dependencies sections.

Contributing

The development of pybv is taking place on GitHub.

For more information, please see CONTRIBUTING.md.

Citing

If you use this software in academic work, please cite it using the Zenodo entry. Metadata is encoded in the CITATION.cff file.

Usage

Writing BrainVision files

The primary functionality provided by pybv is the write_brainvision function. This writes a numpy array of data and provided metadata into a collection of BrainVision files on disk.

from pybv import write_brainvision

# for further parameters see our API documentation
write_brainvision(data=data, sfreq=sfreq, ch_names=ch_names,
                  fname_base=fname, folder_out=tmpdir,
                  events=events)

Reading BrainVision files

Currently, pybv recommends using MNE-Python for reading BrainVision files.

Here is an example of the MNE-Python code required to read BrainVision data:

import mne

# Import the BrainVision data into an MNE Raw object
raw = mne.io.read_raw_brainvision('tmp/test.vhdr', preload=True)

# Reconstruct the original events from our Raw object
events, event_ids = mne.events_from_annotations(raw)

Alternatives

The BrainVision data format is very popular and accordingly there are many software packages to read this format, or write to it. The following table is intended as a quick overview of packages similar to pybv. Please let us know if you know of additional packages that should be listed here.

Name of software

Language

Notes

BioSig Project

miscellaneous

Reading and writing capabilities depend on bindings used, see their overview

Brainstorm

MATLAB

Read and write, search for brainamp in their io functions

BrainVision Analyzer

n/a, GUI for Windows

Read and write, by Brain Products, requires commercial license

brainvisionloader.jl

Julia

Read

EEGLAB

MATLAB / Octave

Read and write via BVA-IO

FieldTrip

MATLAB

Read and write, search for brainvision in their ft_read_data and ft_write_data functions

MNE-Python

Python

Read (writing via pybv)

Acknowledgements

This package was originally adapted from the Philistine package by palday. It copies much of the BrainVision exporting code, but removes the dependence on MNE. Several features have been added, such as support for individual units for each channel.

Release files for pybv 0.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pybv 0.8.1
File Size Uploaded
pybv-0.8.1.tar.gz 16.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pybv 0.8.1
File Interpreter ABI Platform
pybv-0.8.1-py3-none-any.whl Python 3 none any Details

Total release size: 32.7 kB

Release files / pybv-0.8.1.tar.gz

Download URL pybv-0.8.1.tar.gz
Size 16.3 kB
Tags Source
SHA-256 checksum
How to use checksums
31cd29612d8d35eda752b992e79da1db9d81bdf9e703743cd863ab2eeb446f22
BLAKE2b-256 checksum
How to use checksums
728b1d6df7b4ee1d89735c2ce86922cfb1b642df9594e2fb58f8b3438768f6ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.

Transparency log

Release files / pybv-0.8.1-py3-none-any.whl

Download URL pybv-0.8.1-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
950b864c0a53b4fc772624c04ba87632d4dd442c7504670674afedcf2c8d40e1
BLAKE2b-256 checksum
How to use checksums
f39bebd66809b5aa5ca0d5a9a25192c8fb68850bb4495b0514043a6641e790f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.8.1 This release

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

0.0.0

2 release 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