Event-driven Computation in JAX for Brain Dynamics.
Project description
Enabling Event-driven Computation in Brain Dynamics
Brain is characterized by the discrete spiking events, which are the fundamental units of computation in the brain.
BrainEvent provides a set of data structures and algorithms for such event-driven computation on
CPUs, GPUs, TPUs, and maybe more, which can be used to model the brain dynamics in an
efficient and biologically plausible way.
Particularly, it provides the following class to represent binary events in the brain:
EventArray: representing array with a vector/matrix of events.
Furthermore, it implements the following commonly used data structures for event-driven computation of the above class:
COO: a sparse matrix in COO format for sparse and event-driven computation.CSR: a sparse matrix in CSR format for sparse and event-driven computation.CSC: a sparse matrix in CSC format for sparse and event-driven computation.JITCHomoR: a just-in-time connectivity matrix with homogenous weight for sparse and event-driven computation.JITCNormalR: a just-in-time connectivity matrix with normal distribution weight for sparse and event-driven computation.JITCUniformR: a just-in-time connectivity matrix with uniform distribution weight for sparse and event-driven computation.FixedPreNumConn: a fixed number of pre-synaptic connections for sparse and event-driven computation.FixedPostNumConn: a fixed number of post-synaptic connections for sparse and event-driven computation.- ...
BrainEvent is fully compatible with physical units and unit-aware computations provided
in BrainUnit.
Usage
If you want to take advantage of event-driven computations, you must warp your data with brainevent.EventArray:
import brainevent
# wrap your array with EventArray
event_array = brainevent.EventArray(your_array)
Then, the matrix multiplication with the following data structures, $\mathrm{event\ array} @ \mathrm{data}$, will take advantage of event-driven computations:
- Sparse data structures provided by
brainevent, like:brainevent.CSRbrainevent.JITCHomoRbrainevent.FixedPostNumConn- ...
- Dense data structures provided by JAX/NumPy, like:
jax.numpy.ndarraynumpy.ndarray
data = jax.random.rand(...) # normal dense array
data = brainevent.CSR(...) # CSR structure
data = brainevent.JITCHomoR(...) # JIT connectivity
data = brainevent.FixedPostNumConn(...) # fixed number of post-synaptic connections
# event-driven matrix multiplication
r = event_array @ data
r = data @ event_array
Installation
You can install brainevent via pip:
pip install brainevent --upgrade
Documentation
The official documentation is hosted on Read the Docs: https://brainevent.readthedocs.io/
See also the brain modeling ecosystem
We are building the brain modeling ecosystem: https://brainmodeling.readthedocs.io/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file brainevent-0.0.1.post20250502-py2.py3-none-any.whl.
File metadata
- Download URL: brainevent-0.0.1.post20250502-py2.py3-none-any.whl
- Upload date:
- Size: 271.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8893cc5670c1b3746879d6abf9e9ce4f6cae530ca30be302075afdc4460bb4e2
|
|
| MD5 |
7f817354955e6d7cb711f13ffffff4e0
|
|
| BLAKE2b-256 |
c999573457bf3c35d7ddb5cd2a68d3cfe71ef2bef52a7cef3a0ec1d4465342f2
|