Welcome to bwpy’s documentation!#

bwpy helps you interact with 3Brain’s BrainWave data formats BRW and BXR. It is built on top of h5py as the data formats are contained within an HDF5 structure.

The package can be installed as follows:

pip install bwpy

BWR and BXR files can be opened as a regular h5py.File objects (see File Objects):

import bwpy

with bwpy("my_data.bwr", "r") as datafile:
   print(datafile.description)

Slicing#

The package allows you to slice the data in .brw files. The data can be restricted to certain time samples by indexing the .t property like a one-dimensional array: .. code-block:: python

import bwpy

with bwpy(“my_data.bwr”, “r”) as datafile:

# Return the slice of the first 10 temporal recordings with a step of 2 datafile.t[0:10:2]

The data can be restricted to certain channels by indexing the .ch property like a two-dimensional array:

import bwpy

with bwpy("my_data.bwr", "r") as datafile:
   # Return the slice of the block of the first 10x10 channels
   datafile.ch[0:10, 0: 10]

The obtained slices can themselves be sliced further:

import bwpy

with bwpy("my_data.bwr", "r") as datafile:
   # Return the slice of the first 10 temporal recordings of the first channel
   datafile.t[0:10].ch[0, 0]

After slicing, the sliced data can be obtained by accessing the data property:

import bwpy

with bwpy("my_data.bwr", "r") as datafile:
   sliced_data = datafile.t[0:10].ch[0, 0].data

Indices and tables#