Skip to main content

Brain Modeling Ecosystem.

Project description

Brain Modeling Ecosystem

PyPI version Read the Docs

Header image of Brain Modeling Ecosystem.

Overview

Brain Modeling Ecosystem is a comprehensive framework for computational neuroscience and brain simulation. It provides tools and libraries for researchers to model, simulate, train, and analyze neural systems at different scales.

For complete documentation, please see Brain Modeling Ecosystem.

Core components in this ecosystem includes:

  • BrainUnit: Comprehensive physical units and unit-aware mathematical system for brain dynamics.

  • BrainCell: Intuitive, parallel, and efficient simulation for biologically detailed brain cell modeling.

  • BrainState: State-based IR compilation for efficient simulation of brain models on CPUs, GPUs, and TPUs.

  • BrainTaichi: The first-generation framework for customizing event-driven operators based on Taichi Lang syntax.

  • BrainEvent: Enabling event-driven computations in brain dynamics.

  • BrainScale: Enabling scalable online learning for brain dynamics: $O(N)$ complexity for SNNs, and $O(N^2)$ for RNN computations.

  • BrainTools: Commonly used tools for brain dynamics programming, for example checkpointing.

Installation

The ecosystem can be installed with the following command:

pip install brainmodeling

This pins particular versions of component projects which are known to work correctly together via the integration tests in this repository.

Quick Start

import braintools
import brainstate
import brainunit as u


class EINet(brainstate.nn.Module):
    def __init__(self):
        super().__init__()
        self.n_exc = 3200
        self.n_inh = 800
        self.num = self.n_exc + self.n_inh
        self.N = brainstate.nn.LIFRef(
            self.num, V_rest=-60. * u.mV, V_th=-50. * u.mV, V_reset=-60. * u.mV,
            tau=20. * u.ms, tau_ref=5. * u.ms,
            V_initializer=brainstate.init.Normal(-55., 2., unit=u.mV)
        )
        self.E = brainstate.nn.AlignPostProj(
            comm=brainstate.nn.EventFixedProb(self.n_exc, self.num, 0.02, 0.6 * u.mS),
            syn=brainstate.nn.Expon.desc(self.num, tau=5. * u.ms),
            out=brainstate.nn.COBA.desc(E=0. * u.mV),
            post=self.N
        )
        self.I = brainstate.nn.AlignPostProj(
            comm=brainstate.nn.EventFixedProb(self.n_inh, self.num, 0.02, 6.7 * u.mS),
            syn=brainstate.nn.Expon.desc(self.num, tau=10. * u.ms),
            out=brainstate.nn.COBA.desc(E=-80. * u.mV),
            post=self.N
        )

    def update(self, t, inp):
        with brainstate.environ.context(t=t):
            spk = self.N.get_spike() != 0.
            self.E(spk[:self.n_exc])
            self.I(spk[self.n_exc:])
            self.N(inp)
            return self.N.get_spike()
    
    def save_checkpoint(self):
        braintools.file.msgpack_save('states.msgpack', self.states())

Documentation

For detailed documentation, tutorials, and examples, visit our Documentation Portal.

Contributing

We welcome contributions from the community! Please see our Contributing Guidelines for more information on how to get involved.

License

This project is licensed under the Apache License v2.0.

Citation

If you use the Brain Modeling Ecosystem in your research, please use the following link: https://brainmodeling.readthedocs.io/citation.html

Support

For questions and support, please open an issue or email to us: chao.brain@qq.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brainmodeling-2025.5.4-py2.py3-none-any.whl (8.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file brainmodeling-2025.5.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for brainmodeling-2025.5.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0b464dffac2350008eb063da86a01d11e168744804a25d9f0a2fdc283689e063
MD5 948c55fed437f0afe4d6caf47e03c4d4
BLAKE2b-256 2a528d34dce1887cd34ac5a45b55748f45c8e6b9302f87092ded15be5eeb856e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page