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
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Please:
- [ ] Provide a complete example of how to reproduce the bug, wrapped in triple backticks like this:

```python
import brainscale
import braintrace
```

- [ ] If applicable, include full error messages/tracebacks.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: 'Feature Request'
about: 'Suggest a new idea or improvement for BrainScale'
about: 'Suggest a new idea or improvement for BrainTrace'
labels: 'enhancement'
---

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/CI-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ jobs:
python -m pip install . || exit 1
- name: Test with pytest
run: |
pytest brainscale/
pytest braintrace/

6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
pip install .
- name: Test with pytest
run: |
pytest brainscale/
pytest braintrace/


test_macos:
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
pip install .
- name: Test with pytest
run: |
pytest brainscale/
pytest braintrace/


test_windows:
Expand Down Expand Up @@ -110,5 +110,5 @@ jobs:
pip install .
- name: Test with pytest
run: |
pytest brainscale/ -p no:faulthandler
pytest braintrace/ -p no:faulthandler

4 changes: 2 additions & 2 deletions .github/workflows/Publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ jobs:
echo "Release tag: $TAG"
PKG_VERSION=$(python - <<'PY'
import re, pathlib
init = pathlib.Path('brainscale/__init__.py').read_text(encoding='utf-8')
init = pathlib.Path('braintrace/__init__.py').read_text(encoding='utf-8')
m = re.search(r"__version__\s*=\s*\"([^\"]+)\"", init)
print(m.group(1) if m else '')
PY
)
echo "Package version: ${PKG_VERSION}"
TAG_STRIPPED=${TAG#v}
if [[ -z "$PKG_VERSION" ]]; then
echo "Could not determine package version from brainscale/__init__.py" >&2
echo "Could not determine package version from braintrace/__init__.py" >&2
exit 1
fi
if [[ "$TAG_STRIPPED" != "$PKG_VERSION" ]]; then
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to BrainScale
# Contributing to BrainTrace

We welcome contributions to BrainScale!
We welcome contributions to BrainTrace!
Please fork this repository and submit a pull request with your changes.
We will review your changes and merge them if they are appropriate.

Expand Down
72 changes: 43 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,71 @@
<h1 align="center">BrainScale</h1>
<h2 align="center">Scalable Online Learning for Brain Dynamics</h2>
<h1 align="center">BrainTrace</h1>
<h2 align="center">SEligibility Trace-based Online Learning for Brain Dynamics</h2>

<p align="center">
<img alt="Header image of brainscale." src="https://raw.githubusercontent.com/chaobrain/brainscale/main/docs/_static/brainscale.png" width=40%>
<img alt="Header image of braintrace." src="https://raw.githubusercontent.com/chaobrain/braintrace/main/docs/_static/braintrace.png" width=40%>
</p>

<p align="center">
<a href="https://pypi.org/project/brainscale/"><img alt="Supported Python Version" src="https://img.shields.io/pypi/pyversions/brainscale"></a>
<a href="https://github.com/chaobrain/brainscale/blob/main/LICENSE"><img alt="LICENSE" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a>
<a href="https://brainscale.readthedocs.io/?badge=latest"><img alt="Documentation" src="https://readthedocs.org/projects/brainscale/badge/?version=latest"></a>
<a href="https://badge.fury.io/py/brainscale"><img alt="PyPI version" src="https://badge.fury.io/py/brainscale.svg"></a>
<a href="https://github.com/chaobrain/brainscale/actions/workflows/CI.yml"><img alt="Continuous Integration" src="https://github.com/chaobrain/brainscale/actions/workflows/CI.yml/badge.svg"></a>
<a href="https://pypi.org/project/braintrace/"><img alt="Supported Python Version" src="https://img.shields.io/pypi/pyversions/braintrace"></a>
<a href="https://github.com/chaobrain/braintrace/blob/main/LICENSE"><img alt="LICENSE" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a>
<a href="https://braintrace.readthedocs.io/?badge=latest"><img alt="Documentation" src="https://readthedocs.org/projects/braintrace/badge/?version=latest"></a>
<a href="https://badge.fury.io/py/braintrace"><img alt="PyPI version" src="https://badge.fury.io/py/braintrace.svg"></a>
<a href="https://github.com/chaobrain/braintrace/actions/workflows/CI.yml"><img alt="Continuous Integration" src="https://github.com/chaobrain/braintrace/actions/workflows/CI.yml/badge.svg"></a>
</p>

[``brainscale``](https://github.com/chaobrain/brainscale) provides online learning algorithms for biological neural networks.
[``braintrace``](https://github.com/chaobrain/braintrace) provides online learning algorithms for biological neural networks.
It has been integrated into our establishing [brain modeling ecosystem](https://brainmodeling.readthedocs.io/).

## Installation

``brainscale`` can run on Python 3.10+ installed on Linux, MacOS, and Windows. You can install ``brainscale`` via pip:
``braintrace`` can run on Python 3.10+ installed on Linux, MacOS, and Windows. You can install ``braintrace`` via pip:

```bash
pip install brainscale --upgrade
pip install braintrace --upgrade
```

Alternatively, you can install `BrainX`, which bundles `brainscale` with other compatible packages for a comprehensive brain modeling ecosystem:
Alternatively, you can install `BrainX`, which bundles `braintrace` with other compatible packages for a comprehensive brain modeling ecosystem:

```bash
pip install BrainX -U
```

## Documentation

The official documentation is hosted on Read the Docs: [https://brainscale.readthedocs.io](https://brainscale.readthedocs.io)
The official documentation is hosted on Read the Docs: [https://braintrace.readthedocs.io](https://braintrace.readthedocs.io)

## Citation
[//]: # (## Citation)

If you use this package in your research, please cite:
[//]: # ()
[//]: # (If you use this package in your research, please cite:)

```bibtex
@article {Wang2024.09.24.614728,
author = {Wang, Chaoming and Dong, Xingsi and Ji, Zilong and Jiang, Jiedong and Liu, Xiao and Wu, Si},
title = {BrainScale: Enabling Scalable Online Learning in Spiking Neural Networks},
elocation-id = {2024.09.24.614728},
year = {2025},
doi = {10.1101/2024.09.24.614728},
publisher = {Cold Spring Harbor Laboratory},
URL = {https://www.biorxiv.org/content/early/2025/07/27/2024.09.24.614728},
eprint = {https://www.biorxiv.org/content/early/2025/07/27/2024.09.24.614728.full.pdf},
journal = {bioRxiv}
}
```
[//]: # ()
[//]: # (```bibtex)

[//]: # (@article {Wang2024.09.24.614728,)

[//]: # ( author = {Wang, Chaoming and Dong, Xingsi and Ji, Zilong and Jiang, Jiedong and Liu, Xiao and Wu, Si},)

[//]: # ( title = {Enabling Scalable Online Learning in Spiking Neural Networks},)

[//]: # ( elocation-id = {2024.09.24.614728},)

[//]: # ( year = {2025},)

[//]: # ( doi = {10.1101/2024.09.24.614728},)

[//]: # ( publisher = {Cold Spring Harbor Laboratory},)

[//]: # ( URL = {https://www.biorxiv.org/content/early/2025/07/27/2024.09.24.614728},)

[//]: # ( eprint = {https://www.biorxiv.org/content/early/2025/07/27/2024.09.24.614728.full.pdf},)

[//]: # ( journal = {bioRxiv})

[//]: # (})

[//]: # (```)

## See also the ecosystem

``brainscale`` is one part of our brain simulation ecosystem: https://brainmodeling.readthedocs.io/
``braintrace`` is one part of our brain simulation ecosystem: https://brainmodeling.readthedocs.io/
54 changes: 27 additions & 27 deletions brainscale/__init__.py → braintrace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,32 @@
__version__ = "0.1.0"
__version_info__ = (0, 1, 0)

from brainscale._etrace_algorithms import *
from brainscale._etrace_algorithms import __all__ as _alg_all
from brainscale._etrace_compiler_graph import *
from brainscale._etrace_compiler_graph import __all__ as _compiler_all
from brainscale._etrace_compiler_hid_param_op import *
from brainscale._etrace_compiler_hid_param_op import __all__ as _hid_param_all
from brainscale._etrace_compiler_hidden_group import *
from brainscale._etrace_compiler_hidden_group import __all__ as _hid_group_all
from brainscale._etrace_compiler_hidden_pertubation import *
from brainscale._etrace_compiler_hidden_pertubation import __all__ as _hid_pertub_all
from brainscale._etrace_compiler_module_info import *
from brainscale._etrace_compiler_module_info import __all__ as _mod_info_all
from brainscale._etrace_concepts import *
from brainscale._etrace_concepts import __all__ as _con_all
from brainscale._etrace_graph_executor import *
from brainscale._etrace_graph_executor import __all__ as _exec_all
from brainscale._etrace_input_data import *
from brainscale._etrace_input_data import __all__ as _data_all
from brainscale._etrace_operators import *
from brainscale._etrace_operators import __all__ as _op_all
from brainscale._etrace_vjp import *
from brainscale._etrace_vjp import __all__ as _vjp_all
from brainscale._grad_exponential import *
from brainscale._grad_exponential import __all__ as _grad_exp_all
from brainscale._misc import *
from brainscale._misc import __all__ as _misc_all
from braintrace._etrace_algorithms import *
from braintrace._etrace_algorithms import __all__ as _alg_all
from braintrace._etrace_compiler_graph import *
from braintrace._etrace_compiler_graph import __all__ as _compiler_all
from braintrace._etrace_compiler_hid_param_op import *
from braintrace._etrace_compiler_hid_param_op import __all__ as _hid_param_all
from braintrace._etrace_compiler_hidden_group import *
from braintrace._etrace_compiler_hidden_group import __all__ as _hid_group_all
from braintrace._etrace_compiler_hidden_pertubation import *
from braintrace._etrace_compiler_hidden_pertubation import __all__ as _hid_pertub_all
from braintrace._etrace_compiler_module_info import *
from braintrace._etrace_compiler_module_info import __all__ as _mod_info_all
from braintrace._etrace_concepts import *
from braintrace._etrace_concepts import __all__ as _con_all
from braintrace._etrace_graph_executor import *
from braintrace._etrace_graph_executor import __all__ as _exec_all
from braintrace._etrace_input_data import *
from braintrace._etrace_input_data import __all__ as _data_all
from braintrace._etrace_operators import *
from braintrace._etrace_operators import __all__ as _op_all
from braintrace._etrace_vjp import *
from braintrace._etrace_vjp import __all__ as _vjp_all
from braintrace._grad_exponential import *
from braintrace._grad_exponential import __all__ as _grad_exp_all
from braintrace._misc import *
from braintrace._misc import __all__ as _misc_all
from . import nn

__all__ = ['nn'] + _alg_all + _compiler_all + _hid_param_all + _hid_group_all + _hid_pertub_all
Expand All @@ -69,7 +69,7 @@ def __getattr__(name):
import brainstate

warnings.warn(
f"brainscale.{name} is deprecated and will be removed in a future release. "
f"braintrace.{name} is deprecated and will be removed in a future release. "
f"Please use brainstate.{mapping[name]} instead.",
DeprecationWarning,
stacklevel=2,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import jax.numpy as jnp
from jax import jit, make_jaxpr, lax

from brainscale._compatible_imports import (
from braintrace._compatible_imports import (
is_jit_primitive, is_scan_primitive, is_while_primitive,
is_cond_primitive
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ class EligibilityTrace(brainstate.ShortTermState):

Examples
--------
When you are using :class:`brainscale.IODimVjpAlgorithm`, you can get
When you are using :class:`braintrace.IODimVjpAlgorithm`, you can get
the eligibility trace of the weight by calling:

.. code-block:: python

>>> etrace = etrace_algorithm.etrace_of(weight)

"""
__module__ = 'brainscale'
__module__ = 'braintrace'


class ETraceAlgorithm(brainstate.nn.Module):
Expand Down Expand Up @@ -77,7 +77,7 @@ class ETraceAlgorithm(brainstate.nn.Module):
running_index : brainstate.ParamState[int]
The running index.
"""
__module__ = 'brainscale'
__module__ = 'braintrace'

def __init__(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class JaxprEvaluation(object):
outvar_to_hidden_path : Dict[Var, Path]
Stored mapping from output variables to hidden paths.
"""
__module__ = 'brainscale'
__module__ = 'braintrace'

def __init__(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ class ETraceGraph(NamedTuple):

Example::

>>> import brainscale
>>> import braintrace
>>> import brainstate
>>> gru = brainscale.nn.GRUCell(10, 20)
>>> gru = braintrace.nn.GRUCell(10, 20)
>>> gru.init_state()
>>> inputs = brainstate.random.randn(10)
>>> compiled_graph = brainscale.compile_etrace_graph(gru, inputs)
>>> compiled_graph = braintrace.compile_etrace_graph(gru, inputs)
>>> compiled_graph.dict().keys()

"""
Expand Down Expand Up @@ -127,7 +127,7 @@ def __repr__(self) -> str:
return repr(brainstate.util.PrettyMapping(self._asdict(), type_name=self.__class__.__name__))


ETraceGraph.__module__ = 'brainscale'
ETraceGraph.__module__ = 'braintrace'


class CONTEXT(threading.local):
Expand Down
Loading