Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force little-endian format when writing eeg datafile #80

Merged
merged 14 commits into from Sep 29, 2021
Merged
3 changes: 3 additions & 0 deletions CITATION.cff
Expand Up @@ -23,6 +23,9 @@ authors:
- 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
title: "pybv"
version: 0.5.0
date-released: 2021-01-03
Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.rst
Expand Up @@ -7,6 +7,7 @@ Authors
People who contributed to this software across releases (in **alphabetical order**):

- `Adam Li`_
- `Aniket Pradhan`_
- `Chris Holdgraf`_
- `Clemens Brunner`_
- `Phillip Alday`_
Expand All @@ -33,6 +34,7 @@ Changelog
~~~~~~~~~

- :func:`pybv.write_brainvision` gained a new parameter, ``ref_ch_names``, to specify the reference channels used during recording, by `Richard H枚chenberger`_ and `Stefan Appelhoff`_ (:gh:`75`)
- Fix bug where :func:`pybv.write_brainvision` would write the binary eeg file in big-endian on a big-endian system. This could lead to non-uniformity of data-files written by big-endian or little-endian machines, by `Aniket Pradhan`, `Clemens Brunner` and `Stefan Appelhoff`_ (:gh:`80`).
Aniket-Pradhan marked this conversation as resolved.
Show resolved Hide resolved

API
~~~
Expand Down
4 changes: 2 additions & 2 deletions pybv/io.py
Expand Up @@ -494,8 +494,8 @@ def _write_bveeg_file(eeg_fname, data, orientation, format, resolution, units):

# Swap bytes if system architecure is big-endian and dtype is "native" or
sappelhoff marked this conversation as resolved.
Show resolved Hide resolved
# "big-endian"
byteorder = data.dtype.byteorder
if (sys.byteorder == "big" and byteorder == "=") or byteorder == ">":
byteorder = data.dtype.byteorder # pragma: no cover
if (sys.byteorder == "big" and byteorder == "=") or byteorder == ">": # pragma: no cover # noqa: E501
sappelhoff marked this conversation as resolved.
Show resolved Hide resolved
data = data.byteswap()

# Save to binary
Expand Down