Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ jobs:
python setup.py install
- name: Test with pytest
run: |
cd brainpy
export IS_GITHUB_ACTIONS=1 && pytest _src/
pytest brainpy/_src/


test_macos:
Expand Down Expand Up @@ -83,8 +82,7 @@ jobs:
# pip install jaxlib==0.4.30
- name: Test with pytest
run: |
cd brainpy
export IS_GITHUB_ACTIONS=1 && pytest _src/
pytest brainpy/_src/


test_windows:
Expand Down Expand Up @@ -114,5 +112,4 @@ jobs:
python setup.py install
- name: Test with pytest
run: |
cd brainpy
pytest _src/
pytest brainpy/_src/
32 changes: 25 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img alt="Header image of BrainPy - brain dynamics programming in Python." src="https://github.com/brainpy/BrainPy/blob/master/images/logo.png" width=80%>
<img alt="Header image of BrainPy - brain dynamics programming in Python." src="https://raw.githubusercontent.com/brainpy/BrainPy/master/images/logo.png" width=80%>
</p>


Expand All @@ -22,7 +22,7 @@ BrainPy is a flexible, efficient, and extensible framework for computational neu
- **Ecosystem**: https://brainmodeling.readthedocs.io/


BrainPy now is rewritten based on [brainstate](https://github.com/chaobrain/brainstate), please learn [brainstate documentation](https://brainstate.readthedocs.io/) for the latest updates.
BrainPy is rewritten based on [brainstate](https://github.com/chaobrain/brainstate) since August 2025, please learn [brainstate documentation](https://brainstate.readthedocs.io/) for the latest updates.


## Installation
Expand Down Expand Up @@ -57,17 +57,35 @@ We provide a Binder environment for BrainPy. You can use the following button to

- **[BrainPy](https://github.com/brainpy/BrainPy)**: The solution for the general-purpose brain dynamics programming.
- **[brainpy-examples](https://github.com/brainpy/examples)**: Comprehensive examples of BrainPy computation.
- **[brainpy-datasets](https://github.com/brainpy/datasets)**: Neuromorphic and Cognitive Datasets for Brain Dynamics Modeling.
- **[brain modeling ecosystem](https://brainmodeling.readthedocs.io/)**: A collection of tools and libraries for brain modeling and simulation.
- [《神经计算建模实战》 (Neural Modeling in Action)](https://github.com/c-xy17/NeuralModeling)
- [第一届神经计算建模与编程培训班 (First Training Course on Neural Modeling and Programming)](https://github.com/brainpy/1st-neural-modeling-and-programming-course)
- [第二届神经计算建模与编程培训班 (Second Training Course on Neural Modeling and Programming)](https://github.com/brainpy/2nd-neural-modeling-and-programming-course)
- **[brain modeling ecosystem](https://brainmodeling.readthedocs.io/)**: A collection of tools and libraries for brain modeling and simulation.


## Citing

BrainPy is developed by a team in Neural Information Processing Lab at Peking University, China.
Our team is committed to the long-term maintenance and development of the project.
If you are using ``brainpy``, please consider citing the corresponding paper:

```bibtex
@article {10.7554/eLife.86365,
article_type = {journal},
title = {BrainPy, a flexible, integrative, efficient, and extensible framework for general-purpose brain dynamics programming},
author = {Wang, Chaoming and Zhang, Tianqiu and Chen, Xiaoyu and He, Sichao and Li, Shangyang and Wu, Si},
editor = {Stimberg, Marcel},
volume = 12,
year = 2023,
month = {dec},
pub_date = {2023-12-22},
pages = {e86365},
citation = {eLife 2023;12:e86365},
doi = {10.7554/eLife.86365},
url = {https://doi.org/10.7554/eLife.86365},
abstract = {Elucidating the intricate neural mechanisms underlying brain functions requires integrative brain dynamics modeling. To facilitate this process, it is crucial to develop a general-purpose programming framework that allows users to freely define neural models across multiple scales, efficiently simulate, train, and analyze model dynamics, and conveniently incorporate new modeling approaches. In response to this need, we present BrainPy. BrainPy leverages the advanced just-in-time (JIT) compilation capabilities of JAX and XLA to provide a powerful infrastructure tailored for brain dynamics programming. It offers an integrated platform for building, simulating, training, and analyzing brain dynamics models. Models defined in BrainPy can be JIT compiled into binary instructions for various devices, including Central Processing Unit (CPU), Graphics Processing Unit (GPU), and Tensor Processing Unit (TPU), which ensures high running performance comparable to native C or CUDA. Additionally, BrainPy features an extensible architecture that allows for easy expansion of new infrastructure, utilities, and machine-learning approaches. This flexibility enables researchers to incorporate cutting-edge techniques and adapt the framework to their specific needs},
journal = {eLife},
issn = {2050-084X},
publisher = {eLife Sciences Publications, Ltd},
}
```

If you are using ``brainpy``, please consider citing [the corresponding papers](https://brainpy.readthedocs.io/en/latest/tutorial_FAQs/citing_and_publication.html).

10 changes: 5 additions & 5 deletions brainpy/_src/measure/tests/test_correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_c(self):
bm.random.seed()
spikes = bm.asarray([[1, 0, 1, 0, 1, 0, 1, 0, 0], [1, 1, 1, 1, 1, 1, 1, 0, 0]]).T
cc1 = bp.measure.cross_correlation(spikes, 1., dt=1.)
f_cc = jit(partial(bp.measure.cross_correlation, numpy=False, bin=1, dt=1.))
f_cc = jit(partial(bp.measure.cross_correlation, bin=1, dt=1.))
cc2 = f_cc(spikes)
print(cc1, cc2)
self.assertTrue(cc1 == cc2)
Expand Down Expand Up @@ -67,8 +67,8 @@ def test_vf1(self):
voltages = bm.ones((100, 10))
r1 = bp.measure.voltage_fluctuation(voltages)

jit_f = jit(partial(bp.measure.voltage_fluctuation, numpy=False))
jit_f = jit(lambda a: bp.measure.voltage_fluctuation(a, numpy=False))
jit_f = jit(partial(bp.measure.voltage_fluctuation))
jit_f = jit(lambda a: bp.measure.voltage_fluctuation(a))
r2 = jit_f(voltages)
print(r1, r2) # TODO: JIT results are different?
# self.assertTrue(r1 == r2)
Expand All @@ -82,7 +82,7 @@ def test_cf1(self):
act = bm.random.random((10000, 3))
r1 = bp.measure.functional_connectivity(act)

jit_f = jit(partial(bp.measure.functional_connectivity, numpy=False))
jit_f = jit(partial(bp.measure.functional_connectivity))
r2 = jit_f(act)

self.assertTrue(bm.allclose(r1, r2))
Expand All @@ -95,6 +95,6 @@ def test_mc(self):
B = bm.random.random((100, 100))
r1 = (bp.measure.matrix_correlation(A, B))

jit_f = jit(partial(bp.measure.matrix_correlation, numpy=False))
jit_f = jit(bp.measure.matrix_correlation)
r2 = jit_f(A, B)
self.assertTrue(bm.allclose(r1, r2))
3 changes: 1 addition & 2 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ API Documentation
.. toctree::
:maxdepth: 1

apis/auto/brainpy-changelog.md
apis/auto/brainpylib-changelog.md

apis/brainpy.rst
apis/math.rst
apis/dnn.rst
Expand Down
20 changes: 17 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ Installation

pip install -U brainpy[tpu]

.. tab-item:: Ecosystem

.. code-block:: bash

pip install -U BrainX[cpu]

# or
pip install -U BrainX[cuda12]

# or
pip install -U BrainX[tpu]



----

Expand Down Expand Up @@ -93,7 +106,7 @@ Learn more

.. card:: :material-regular:`settings;2em` Examples
:class-card: sd-text-black sd-bg-light
:link: https://brainpy-examples.readthedocs.io/en/latest/index.html
:link: https://brainpy-examples.readthedocs.io/

.. grid-item::
:columns: 6 6 6 4
Expand All @@ -110,7 +123,7 @@ Learn more


.. note::
BrainPy is rewritten based on `brainstate <https://github.com/chaobrain/brainstate>`_ since August 2025.
``BrainPy>=3.0.0`` is rewritten based on `brainstate <https://github.com/chaobrain/brainstate>`_ since August 2025.



Expand Down Expand Up @@ -140,4 +153,5 @@ Learn more
advanced_tutorials.rst
FAQ.rst
api.rst

apis/auto/brainpy-changelog.md
apis/auto/brainpylib-changelog.md
35 changes: 10 additions & 25 deletions docs/quickstart/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,6 @@ To install brainpy with minimum requirements (has installed ``jax`` and ``jaxlib
pip install brainpy


Minimum requirements (with dependencies)
----------------------------------------

.. note::

Full features of brainpy currently is only available on Python 3.9 - 3.11.


To install brainpy with minimum requirements (only depends on ``jax``), you can use:

.. code-block:: bash

pip install brainpy[cpu_mini] # for CPU

# or

pip install brainpy[cuda12_mini] -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html # for CUDA 12.0

# or

pip install brainpy[tpu] -f https://storage.googleapis.com/jax-releases/libtpu_releases.html # for google TPU


CPU with all dependencies
-------------------------

Expand All @@ -52,6 +29,9 @@ To install a CPU-only version of BrainPy, which might be useful for doing local

pip install brainpy[cpu]

pip install BrainX[cpu] # for whole BrainX ecosystem




GPU with all dependencies
Expand All @@ -62,7 +42,10 @@ To install a GPU-only version of BrainPy, you can run

.. code-block:: bash

pip install brainpy[cuda12] -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html # for CUDA 12.0
pip install brainpy[cuda12] # for CUDA 12.0

pip install BrainX[cuda12] # for whole BrainX ecosystem




Expand All @@ -74,6 +57,8 @@ you can run the following in your cloud TPU VM:

.. code-block:: bash

pip install brainpy[tpu] -f https://storage.googleapis.com/jax-releases/libtpu_releases.html # for google TPU
pip install brainpy[tpu] # for google TPU

pip install BrainX[tpu] # for whole BrainX ecosystem


Loading