Skip to main content

Modeling tools for brain simulation.

Reason this release was yanked:

bug

Project description

Modeling tools for brain simulation

Header image of braintools.

Supported Python Version LICENSE Documentation Status PyPI version Continuous Integration Test Coverage DOI

braintools is a lightweight, JAX-friendly toolbox with practical utilities for brain modeling.

Highlights

  • Composable connectivity: declarative builders for point, multi-compartment, and population networks with spatial kernels, degree constraints, and unit-aware metadata
  • Cognitive task framework: phase-based, composable trial construction (braintools.cogtask) for training and analyzing neural networks on classic systems-neuroscience paradigms — decision making, working memory, reasoning, motor — plus a registry of pre-built tasks
  • Visualization suite: publication plots, interactive dashboards, 3D viewers, and animation helpers in braintools.visualize
  • Metrics and solvers: losses, evaluation metrics, and PyTree-aware ODE/SDE/DDE integrators ready for jit/vmap
  • Signal and optimization helpers: reusable generators and lightweight optimizers to prototype models quickly

braintools integrates smoothly with the broader ecosystem (e.g., brainstate, brainunit) while keeping a simple, functional style.

Installation

pip install -U braintools

Optional extras are published for hardware-specific builds:

pip install -U braintools[cpu]
# CUDA 12.x wheels
pip install -U braintools[cuda12]
# TPU runtime
pip install -U braintools[tpu]

Alternatively, install the curated BrainX bundle that ships with braintools and related projects:

pip install -U BrainX

Cognitive task framework (braintools.cogtask)

braintools.cogtask lets you build cognitive tasks from composable, named phases (fixation, stimulus, delay, response, ...) connected by simple operators:

  • a >> b runs b after a (sequential)
  • a * n repeats a n times
  • a | b runs a and b in parallel (multi-modal stimuli)
  • If, Switch, While add trial-by-trial branching

Trials are generated lazily via task.sample(i) / task.batch_sample(B), both JIT- and vmap-friendly, with per-trial keys derived from seed so batches are fully reproducible.

import brainunit as u
from braintools.cogtask import PerceptualDecisionMaking

task = PerceptualDecisionMaking(t_stimulus=1500 * u.ms, num_choices=2, seed=0)
X, Y = task.batch_sample(32)   # X: (T, B, n_in), Y: (T, B) labels

The package also ships a registry of canonical tasks: PerceptualDecisionMaking, ContextDecisionMaking, DelayMatchSample, DelayComparison, GoNoGo, ReadySetGo, PostDecisionWager, Reaching1D, EvidenceAccumulation, HierarchicalReasoning, and more — see the API reference for the full list.

Documentation

The full documentation is available at https://brainx.chaobrain.com/braintools/

Ecosystem

braintools is one part of our brain simulation ecosystem: https://brainx.chaobrain.com/

Contributing

Contributions and issue reports are welcome! See CONTRIBUTING.md for guidelines.

License

Apache 2.0. See LICENSE for details.

Citation

If you use braintools in your work, please cite the Zenodo DOI: 10.5281/zenodo.17110064

Project details


Download files

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

Source Distribution

braintools-0.2.0.tar.gz (746.2 kB view details)

Uploaded Source

Built Distribution

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

braintools-0.2.0-py3-none-any.whl (903.9 kB view details)

Uploaded Python 3

File details

Details for the file braintools-0.2.0.tar.gz.

File metadata

  • Download URL: braintools-0.2.0.tar.gz
  • Upload date:
  • Size: 746.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for braintools-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c3743bd8e97dfd40df3a276611f349173dd69c1f8e0199f9ed7ce6004a24cc6a
MD5 1295efec36183ade09a8912a0c443fa7
BLAKE2b-256 4d67bf9b9c17206afee4456a9afef56dd951538e537efc8d02a55ccd5b39f1d4

See more details on using hashes here.

File details

Details for the file braintools-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: braintools-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 903.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for braintools-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ccc1f2cfa0de61e846cb9a4ec8bde56d7b64cbef0ee4b86946dff5d3e9edd71d
MD5 bd316ed43201e3cdbdbe6b9d82cbb493
BLAKE2b-256 08cd6f0d31859e83b4fc3d3b87babdee09a25aeecc0221960a2a3d126f5f50a8

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