BrainPy: Brain Dynamics Programming in Python
Project description
:clap::clap: CHEERS: A new version of BrainPy (>=2.0.0, long term support) has been released! :clap::clap:
Why use BrainPy
BrainPy
is an integrative framework for computational neuroscience and brain-inspired computation based on the Just-In-Time (JIT) compilation (built on top of JAX). Core functions provided in BrainPy includes
- JIT compilation for class objects.
- Numerical solvers for ODEs, SDEs, and others.
- Dynamics simulation tools for various brain objects, like neurons, synapses, networks, soma, dendrites, channels, and even more.
- Dynamics analysis tools for differential equations, including phase plane analysis and bifurcation analysis, and linearization analysis.
- Seamless integration with deep learning models.
- And more ......
BrainPy
is designed to effectively satisfy your basic requirements:
- Pythonic: BrainPy is based on Python language and has a Pythonic coding style.
- Flexible and transparent: BrainPy endows the users with full data/logic flow control. Users can code any logic they want with BrainPy.
- Extensible: BrainPy allows users to extend new functionality just based on Python code. Almost every part of the BrainPy system can be extended to be customized.
- Efficient: All codes in BrainPy can be just-in-time compiled (based on JAX) to run on CPU, GPU, or TPU devices, thus guaranteeing its running efficiency.
How to use BrainPy
Step 1: installation
BrainPy
is based on Python (>=3.6), and the following packages are required to be installed to use BrainPy
: numpy >= 1.15
, matplotlib >= 3.4
, and jax >= 0.2.10
(how to install jax?)
BrainPy
can be installed on Linux (Ubuntu 16.04 or later), macOS (10.12 or later), and Windows platforms. Use the following instructions to install brainpy
:
pip install brain-py -U
For the full installation details please see documentation: Quickstart/Installation
Step 2: useful links
- Documentation: https://brainpy.readthedocs.io/
- Bug reports: https://github.com/PKU-NIP-Lab/BrainPy/issues
- Examples from papers: https://brainpy-examples.readthedocs.io/
- Canonical brain models: https://brainmodels.readthedocs.io/
Step 3: inspirational examples
Here we list several examples of BrainPy. For more detailed examples and tutorials please see BrainModels or BrainPy-Examples.
Neuron models
- Leaky integrate-and-fire neuron model, source code
- Exponential integrate-and-fire neuron model, source code
- Quadratic integrate-and-fire neuron model, source code
- Adaptive Quadratic integrate-and-fire model, source code
- Adaptive Exponential integrate-and-fire model, source code
- Generalized integrate-and-fire model, source code
- Hodgkin–Huxley neuron model, source code
- Izhikevich neuron model, source code
- Morris-Lecar neuron model, source code
- Hindmarsh-Rose bursting neuron model, source code
See brainmodels.neurons to find more.
Synapse models
- Voltage jump synapse model, source code
- Exponential synapse model, source code
- Alpha synapse model, source code
- Dual exponential synapse model, source code
- AMPA synapse model, source code
- GABAA synapse model, source code
- NMDA synapse model, source code
- Short-term plasticity model, source code
See brainmodels.synapses to find more.
Network models
- [CANN] (Si Wu, 2008) Continuous-attractor Neural Network
- (Vreeswijk & Sompolinsky, 1996) E/I balanced network
- (Sherman & Rinzel, 1992) Gap junction leads to anti-synchronization
- (Wang & Buzsáki, 1996) Gamma Oscillation
- (Brunel & Hakim, 1999) Fast Global Oscillation
- (Diesmann, et, al., 1999) Synfire Chains
- [Working Memory] (Mi, et. al., 2017) STP for Working Memory Capacity
- [Working Memory] (Bouchacourt & Buschman, 2019) Flexible Working Memory Model
- [Decision Making] (Wang, 2002) Decision making spiking model
Dynamics training
-
(Song, et al., 2016): Training excitatory-inhibitory recurrent network
-
[Working Memory] (Masse, et al., 2019): RNN with STP for Working Memory
Low-dimensional dynamics analysis
- [1D] Simple systems
- [2D] NaK model analysis
- [3D] Hindmarsh Rose Model
- [Decision Making Model] [2D] Decision making rate model
High-dimensional dynamics analysis
- (Yang, 2020): Dynamical system analysis for RNN
- Continuous-attractor Neural Network
- Gap junction-coupled FitzHugh-Nagumo Model
Citing BrainPy
A nascent version of BrainPy was described in a paper that appeared at ICONIP 2021. We're currently working on covering BrainPy's ideas and capabilities in a more comprehensive and up-to-date paper.
If you use BrainPy for your published research, you can cite BrainPy with:
Wang, C., Jiang, Y., Liu, X., Lin, X., Zou, X., Ji, Z., & Wu, S. (2021, December). A Just-In-Time Compilation Approach for Neural Dynamics Simulation. In International Conference on Neural Information Processing (pp. 15-26). Springer, Cham.
or,
@inproceedings{wang2021just,
title={A Just-In-Time Compilation Approach for Neural Dynamics Simulation},
author={Wang, Chaoming and Jiang, Yingqian and Liu, Xinyu and Lin, Xiaohan and Zou, Xiaolong and Ji, Zilong and Wu, Si},
booktitle={International Conference on Neural Information Processing},
pages={15--26},
year={2021},
organization={Springer}
}
BrainPy 1.x
If you are using brainpy==1.x
, you can find documentation, examples, and models through the following links:
- Documentation: https://brainpy.readthedocs.io/en/brainpy-1.x/
- Examples from papers: https://brainpy-examples.readthedocs.io/en/brainpy-1.x/
- Canonical brain models: https://brainmodels.readthedocs.io/en/brainpy-1.x/
The changes from brainpy==1.x
to brainpy==2.x
can be inspected through API documentation: release notes.
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.