pybv

A lightweight I/O utility for the BrainVision data format, written in Python.

https://github.com/bids-standard/pybv

Science Score: 64.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    2 of 10 committers (20.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.2%) to scientific vocabulary

Keywords

brain brainproducts brainvision data eeg ieeg products vhdr vision vmrk

Keywords from Contributors

meg ecog electrocorticography electroencephalography magnetoencephalography neuroimaging neuroscience mne bids ecg
Last synced: 6 months ago · JSON representation ·

Repository

A lightweight I/O utility for the BrainVision data format, written in Python.

Basic Info
  • Host: GitHub
  • Owner: bids-standard
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: main
  • Homepage: https://pybv.readthedocs.io/
  • Size: 603 KB
Statistics
  • Stars: 22
  • Watchers: 5
  • Forks: 13
  • Open Issues: 6
  • Releases: 15
Topics
brain brainproducts brainvision data eeg ieeg products vhdr vision vmrk
Created over 7 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License Citation

README.rst

.. image:: https://github.com/bids-standard/pybv/workflows/Python%20build/badge.svg
   :target: https://github.com/bids-standard/pybv/actions?query=workflow%3A%22Python+build%22
   :alt: Python build

.. image:: https://github.com/bids-standard/pybv/workflows/Python%20tests/badge.svg
   :target: https://github.com/bids-standard/pybv/actions?query=workflow%3A%22Python+tests%22
   :alt: Python tests

.. image:: https://codecov.io/gh/bids-standard/pybv/branch/main/graph/badge.svg
   :target: https://codecov.io/gh/bids-standard/pybv
   :alt: Test coverage

.. image:: https://readthedocs.org/projects/pybv/badge/?version=stable
   :target: https://pybv.readthedocs.io/en/stable/?badge=stable
   :alt: Documentation Status

.. image:: https://badge.fury.io/py/pybv.svg
   :target: https://badge.fury.io/py/pybv
   :alt: PyPi version

.. image:: https://img.shields.io/conda/vn/conda-forge/pybv.svg
   :target: https://anaconda.org/conda-forge/pybv
   :alt: Conda version

.. image:: https://zenodo.org/badge/157434681.svg
   :target: https://zenodo.org/badge/latestdoi/157434681
   :alt: Zenodo archive

====
pybv
====

For documentation, see the:

- `stable documentation `_
- `latest (development) documentation `_

.. docs_readme_include_label

``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.9 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:

.. code-block:: Text

   python -m pip install --upgrade pybv

or if you use `conda `_:

.. code-block:: Text

   conda install --channel conda-forge pybv

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

.. code-block:: Text

   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.

.. code-block:: python

    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:

.. code-block:: python

    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.

Owner

  • Name: Brain Imaging Data Structure
  • Login: bids-standard
  • Kind: organization

Citation (CITATION.cff)

# YAML 1.2
---
# Metadata for citation of this software according to the CFF format (https://citation-file-format.github.io/)
cff-version: 1.2.0
title: "pybv -- A lightweight I/O utility for the BrainVision data format."
message: "If you use this software, please cite it using the metadata below."
authors:
- given-names: "Stefan"
  family-names: "Appelhoff"
  orcid: "https://orcid.org/0000-0001-8002-0877"
- given-names: "Clemens"
  family-names: "Brunner"
  orcid: "https://orcid.org/0000-0002-6030-2233"
- given-names: "Tristan"
  family-names: "Stenner"
  orcid: "https://orcid.org/0000-0002-2428-9051"
- given-names: "Chris R."
  family-names: "Holdgraf"
  orcid: "https://orcid.org/0000-0002-2391-0678"
- given-names: "Richard"
  family-names: "Höchenberger"
  orcid: "https://orcid.org/0000-0002-0380-4798"
- given-names: "Adam"
  family-names: "Li"
  orcid: "https://orcid.org/0000-0001-8421-365X"
- given-names: "Phillip"
  family-names: "Alday"
  orcid: "https://orcid.org/0000-0002-9984-5745"
- given-names: "Aniket"
  family-names: "Pradhan"
  orcid: https://orcid.org/0000-0002-6705-5116
- given-names: "Pierre"
  family-names: "Cutellic"
  orcid: "https://orcid.org/0000-0002-7224-9222"
- given-names: "Felix"
  family-names: "Klotzsche"
  orcid: "https://orcid.org/0000-0003-3985-2481"
- given-names: "Benjamin"
  family-names: "Beasley"
  orcid: "https://orcid.org/0009-0002-6936-5959"
- given-names: "Robert"
  family-names: "Oostenveld"
  orcid: "https://orcid.org/0000-0002-1974-1293"
type: software
repository-code: "https://github.com/bids-standard/pybv"
url: "https://pybv.readthedocs.io/"
license: BSD-3-Clause
identifiers:
  - description: "Code archive on Zenodo"
    type: doi
    value: 10.5281/zenodo.5539451
keywords:
  - data
  - eeg
  - vision
  - products
  - brain
  - ieeg
  - brainvision
  - brainproducts
  - vhdr
  - vmrk
...

GitHub Events

Total
  • Create event: 4
  • Issues event: 1
  • Release event: 1
  • Watch event: 1
  • Delete event: 5
  • Issue comment event: 11
  • Push event: 16
  • Pull request review event: 5
  • Pull request event: 10
Last Year
  • Create event: 4
  • Issues event: 1
  • Release event: 1
  • Watch event: 1
  • Delete event: 5
  • Issue comment event: 11
  • Push event: 16
  • Pull request review event: 5
  • Pull request event: 10

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 232
  • Total Committers: 10
  • Avg Commits per committer: 23.2
  • Development Distribution Score (DDS): 0.233
Past Year
  • Commits: 59
  • Committers: 5
  • Avg Commits per committer: 11.8
  • Development Distribution Score (DDS): 0.068
Top Committers
Name Email Commits
Stefan Appelhoff s****f@m****g 178
Clemens Brunner c****r@g****m 33
Tristan Stenner t****r@g****m 11
Chris Holdgraf c****f@g****m 3
Richard Höchenberger r****r@g****m 2
Felix Klotzsche k****e@c****e 1
Adam Li a****2@g****m 1
Aniket Pradhan a****3@i****n 1
Pierre Cutellic p****c@g****m 1
dependabot[bot] 4****]@u****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 50
  • Total pull requests: 78
  • Average time to close issues: 2 months
  • Average time to close pull requests: 13 days
  • Total issue authors: 11
  • Total pull request authors: 10
  • Average comments per issue: 4.46
  • Average comments per pull request: 3.67
  • Merged pull requests: 75
  • Bot issues: 0
  • Bot pull requests: 7
Past Year
  • Issues: 2
  • Pull requests: 8
  • Average time to close issues: N/A
  • Average time to close pull requests: about 5 hours
  • Issue authors: 1
  • Pull request authors: 3
  • Average comments per issue: 0.0
  • Average comments per pull request: 2.38
  • Merged pull requests: 7
  • Bot issues: 0
  • Bot pull requests: 2
Top Authors
Issue Authors
  • sappelhoff (31)
  • cbrnr (9)
  • hoechenberger (2)
  • effigies (1)
  • Aniket-Pradhan (1)
  • choldgraf (1)
  • eioe (1)
  • behinger (1)
  • tstenner (1)
  • compmonks (1)
  • alexrockhill (1)
Pull Request Authors
  • sappelhoff (37)
  • cbrnr (24)
  • dependabot[bot] (9)
  • tstenner (6)
  • musicinmybrain (4)
  • hoechenberger (2)
  • eioe (1)
  • compmonks (1)
  • robertoostenveld (1)
  • adam2392 (1)
  • Aniket-Pradhan (1)
Top Labels
Issue Labels
bug (9) enhancement (8) effort:medium (7) maintenance (5) impact:low (4) impact:high (3) impact:medium (3) effort:low (2) effort:high (1) MNE-Python (1) API (1) DOC (1) good first issue (1)
Pull Request Labels
dependencies (9) enhancement (6) fix (3) hacktoberfest-accepted (2) maintenance (2) github_actions (1)

Packages

  • Total packages: 3
  • Total downloads:
    • pypi 36,685 last-month
  • Total docker downloads: 110
  • Total dependent packages: 7
    (may contain duplicates)
  • Total dependent repositories: 68
    (may contain duplicates)
  • Total versions: 28
  • Total maintainers: 3
pypi.org: pybv

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

  • Documentation: https://pybv.readthedocs.io
  • License: BSD 3-Clause License Copyright (c) 2018, pybv developers All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  • Latest release: 0.7.6
    published about 1 year ago
  • Versions: 16
  • Dependent Packages: 5
  • Dependent Repositories: 48
  • Downloads: 36,685 Last month
  • Docker Downloads: 110
Rankings
Dependent packages count: 1.9%
Dependent repos count: 2.1%
Docker downloads count: 2.6%
Downloads: 4.5%
Average: 5.9%
Forks count: 10.9%
Stargazers count: 13.7%
Maintainers (3)
Last synced: 6 months ago
spack.io: py-pybv

A lightweight I/O utility for the BrainVision data format.

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 29.0%
Dependent packages count: 58.1%
Last synced: 6 months ago
conda-forge.org: pybv
  • Versions: 11
  • Dependent Packages: 2
  • Dependent Repositories: 20
Rankings
Dependent repos count: 8.0%
Dependent packages count: 19.6%
Average: 31.0%
Forks count: 45.0%
Stargazers count: 51.3%
Last synced: 6 months ago

Dependencies

.github/workflows/python_build.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/python_publish.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/python_tests.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • codecov/codecov-action v3 composite
pyproject.toml pypi