Skip to main content

Biologically Detailed Brain Cell Modeling in JAX

Header image of BrainCell.

Supported Python Version LICENSE Documentation Status PyPI version Continuous Integration DOI

braincell provides a unified interface for modeling single-compartment and multi-compartment Hodgkin-Huxley-styled neuron models. It is built on top of JAX and brainstate, offering a highly parallelized and efficient simulation of biophysically detailed brain cell models.

Quick start

Here is an example to model the single-compartment thalamus neuron model by using the interface of braincell.neuron.SingleCompartment:

import braincell
import brainstate
import brainunit as u

class HTC(braincell.SingleCompartment):
    def __init__(self, size, solver: str = 'exp_euler'):
        super().__init__(size, V_initializer=brainstate.init.Constant(-65. * u.mV), V_th=20. * u.mV, solver=solver)

        self.na = braincell.ion.SodiumFixed(size, E=50. * u.mV)
        self.na.add(INa=braincell.channel.INa_Ba2002(size, V_sh=-30 * u.mV))

        self.k = braincell.ion.PotassiumFixed(size, E=-90. * u.mV)
        self.k.add(IKL=braincell.channel.IK_Leak(size, g_max=0.01 * (u.mS / u.cm ** 2)))
        self.k.add(IDR=braincell.channel.IKDR_Ba2002(size, V_sh=-30. * u.mV, phi=0.25))

        self.ca = braincell.ion.CalciumDetailed(size, C_rest=5e-5 * u.mM, tau=10. * u.ms, d=0.5 * u.um)
        self.ca.add(ICaL=braincell.channel.ICaL_IS2008(size, g_max=0.5 * (u.mS / u.cm ** 2)))
        self.ca.add(ICaN=braincell.channel.ICaN_IS2008(size, g_max=0.5 * (u.mS / u.cm ** 2)))
        self.ca.add(ICaT=braincell.channel.ICaT_HM1992(size, g_max=2.1 * (u.mS / u.cm ** 2)))
        self.ca.add(ICaHT=braincell.channel.ICaHT_HM1992(size, g_max=3.0 * (u.mS / u.cm ** 2)))

        self.kca = braincell.MixIons(self.k, self.ca)
        self.kca.add(IAHP=braincell.channel.IAHP_De1994(size, g_max=0.3 * (u.mS / u.cm ** 2)))

        self.Ih = braincell.channel.Ih_HM1992(size, g_max=0.01 * (u.mS / u.cm ** 2), E=-43 * u.mV)
        self.IL = braincell.channel.IL(size, g_max=0.0075 * (u.mS / u.cm ** 2), E=-70 * u.mV)

Here is an example to model the multi-compartment neuron model by using the interface of braincell.neuron.MultiCompartment:

import braincell
import brainstate
import brainunit as u

# TODO

class HTC(braincell.MultiCompartment):
    def __init__(self, size, solver: str = 'exp_euler'):
        super().__init__(size, V_initializer=brainstate.init.Constant(-65. * u.mV), V_th=20. * u.mV, solver=solver)

Installation

You can install braincell via pip:

pip install braincell --upgrade

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

pip install BrainX -U

Documentation

The official documentation is hosted on Read the Docs: https://braincell.readthedocs.io

See also the brain modeling ecosystem

We are building the brain modeling ecosystem: https://brainmodeling.readthedocs.io/

Metadata

Release files for braincell 0.0.1.post20250508

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for braincell 0.0.1.post20250508
File Interpreter ABI Platform
braincell-0.0.1.post20250508-py2.py3-none-any.whl Python 3, Python 2 none any Details

Release files / braincell-0.0.1.post20250508-py2.py3-none-any.whl

Download URL braincell-0.0.1.post20250508-py2.py3-none-any.whl
Size 114.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
200e369266695cf5e60157ab6ff6aab7822b36194bcf08415f08e7eac4639513
BLAKE2b-256 checksum
How to use checksums
1219e179544cd23d411173cd6eae9f0fa5bbc2092b61f32bb5071ca211fe46a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release history Release notifications | RSS feed

0.1.0

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

This release

0.0.1.post20250508 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page