BrainPy
is an integrative framework for computational neuroscience and brain-inspired computation based on Just-In-Time (JIT) compilation (built on the top of JAX and Numba). Core functions provided in BrainPy includes
- JIT compilation for class objects.
- Numerical solvers for ODEs, SDEs, DDEs, FDEs, 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, continuation analysis and sensitive analysis.
- Seamless integration with deep learning models, and has the speed benefit on JIT compilation.
- And more ......
BrainPy
is designed to effectively satisfy your basic requirements:
- Easy to learn and use: BrainPy is only based on Python language and has little dependency requirements.
- Flexible and transparent: BrainPy endows the users with the fully data/logic flow control. Users can code any logic they want with BrainPy.
- Extensible: BrainPy allow users to extend new functionality just based on Python coding. For example, we extend the numerical integration with the ability to do numerical analysis. In such a way, the same code in BrainPy can not only be used for simulation, but also for dynamics analysis.
- Efficient: All codes in BrainPy can be just-in-time compiled (based on JAX and Numba) to run on CPU or GPU devices, thus guaranteeing its running efficiency.
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
The installation details please see documentation: Quickstart/Installation
Method 1: install BrainPy
by using pip
:
To install the stable release of BrainPy (V1.0.3), please use
> pip install -U brain-py
To install the latest pre-release version of BrainPy (V1.1.0), please use
> pip install -U brain-py --pre
If you have installed the previous version of BrainPy, please uninstall the older one first
> pip uninstall brainpy-simulator
# Then install the latest version of BrainPy
> pip install -U brain-py --pre
Method 2: install BrainPy
from source:
> pip install git+https://github.com/PKU-NIP-Lab/BrainPy
>
> # or
> pip install git+https://git.openi.org.cn/OpenI/BrainPy
>
> # or
> pip install -e git://github.com/PKU-NIP-Lab/BrainPy.git@V1.0.0
Other dependencies: you want to get the full supports by BrainPy, please install the following packages:
JAX >= 0.2.10
, needed for "jax" backend and "dnn" moduleNumba >= 0.52
, needed for JIT compilation on "numpy" backendSymPy >= 1.4
, needed for dynamics "analysis" module and Exponential Euler method
- Documentation: https://brainpy.readthedocs.io/
- Source code: https://github.com/PKU-NIP-Lab/BrainPy or https://git.openi.org.cn/OpenI/BrainPy
- Bug reports: https://github.com/PKU-NIP-Lab/BrainPy/issues or Email to adaduo@outlook.com
- Examples from papers: https://brainmodels.readthedocs.io/en/latest/
Here list several examples of BrainPy. More detailed examples and tutorials please see BrainModels.
- 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.
- 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.
- [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
- [Recurrent Network] (Laje & Buonomano, 2013) Robust Timing in RNN
- [Recurrent Network] (Sussillo & Abbott, 2009) FORCE Learning