BrainPy: A flexible and extensible framework for brain modeling
Project description
Why to use BrainPy
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 functions and 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 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 same code with the ability to do numerical analysis (whatever low- or high-dimensional system).
- Efficient: All codes in BrainPy can be just-in-time compiled (based on JAX and Numba) 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
The installation details please see documentation: Quickstart/Installation
Method 1: install BrainPy
by using pip
:
To install the stable release of BrainPy, please use
> pip install -U brain-py
Method 2: install BrainPy
from source:
> pip install git+https://github.com/PKU-NIP-Lab/BrainPy
>
> # or
>
> git clone https://github.com/PKU-NIP-Lab/BrainPy
> cd BrainPy
> python setup.py install
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 many other supports (how to install jax?)Numba >= 0.52
, needed for JIT compilation on "numpy" backend (how to install numba?)SymPy >= 1.4
, needed for dynamics "analysis" module and Exponential Euler method (how to install sympy?)
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/en/latest/
- Canonical brain models: https://brainmodels.readthedocs.io/en/latest/
Step 3: inspirational examples
Here list several examples of BrainPy. 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 Learning
-
(Song, et al., 2016): Training excitatory-inhibitory recurrent network
-
[Working Memory] (Masse, et al., 2019): RNN with STP for Working Memory
Low-dimension dynamics analysis
- 1D system bifurcation
- Codimension 1 bifurcation analysis of FitzHugh Nagumo model
- Codimension 2 bifurcation analysis of FitzHugh Nagumo model
- [Decision Making Model] (Wong & Wang, 2006) Decision making rate model
High-dimension dynamics analysis
- [Fixed point finder]
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 Distribution
File details
Details for the file brain-py-1.1.5.tar.gz
.
File metadata
- Download URL: brain-py-1.1.5.tar.gz
- Upload date:
- Size: 230.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
8cdcf00c4658e3fe1c9cbb68ff231e5e422fc8606d8d0f1025fefe39a7ca30e7
|
|
MD5 |
3622215646da87ed72b5c6fe4ed803d5
|
|
BLAKE2b-256 |
32c2727945b440b8d471e78da05774cec0dbe7760043e704ed7ad088576046c1
|