BrainPy to BrainX#
brainpy is the experimental precursor of brainx. It served as
the prototype for the later ecosystem: the ideas first explored in
brainpy — stateful dynamical systems, event-driven operators —
were developed into the focused, production-level packages that make up
brainx today.
The neural-mass modeling explored in brainpy evolved into the dedicated
brainmass package. Its Hodgkin-Huxley cell models inspired the more
comprehensive conductance-based models, ion-channel systems, and neuronal morphology
support now provided by braincell. Its point-neuron modeling — the part
brainpy was best at — became brainpy.state.
This page explains how the packages relate and whether your project should move. When you decide to move, the migration notes cover the mechanics: API mappings, a worked before/after example, and the cases that need care.
brainpy and brainpy.state#
brainpy and brainpy.state are two different packages. They share an import root
and little else: they are distributed separately on PyPI (brainpy and
brainpy-state), and they are built on different state systems — brainpy on its own
brainpy.math.Variable, brainpy.state on brainstate.
Most of the confusion around migration comes from this one fact. Both are installed by
pip install -U BrainX and import cleanly into the same process, so a project can
migrate one model at a time. The
migration notes tabulate the differences.
Status and support#
This page describes brainpy 2.x and the component versions pinned by the current
brainx release; see the change log for the exact pins.
brainpy ships in the BrainX pin set and is in maintenance: it receives
compatibility and bug fixes (for example the recent JAX 0.11 fix), and its analysis
module is still unique in the ecosystem. New modeling features land in the
brainx packages, not in brainpy.
Existing brainpy projects do not need to be rewritten. Migration pays off when a
project needs unit-safe parameters, multicompartment cells, online learning, or
long-term feature work.
Where each modeling scale now lives#
Point-neuron networks → brainpy.state. This was brainpy’s main
strength, and it is the scale that carried over most directly. Model names and
projection patterns stay recognizable; the state system and the runner are what change.
Cells, ions, and morphology → braincell. Migrate rather than mix. The
older ion and channel APIs in brainpy have known design limitations and its
compartmental support is restricted to single-compartment models.
braincell provides comprehensive conductance-based and Hodgkin-Huxley
models together with morphologically structured, multicompartment cells.
Neural-mass and whole-brain models → brainmass. The brainpy rate
models cover FitzHugh-Nagumo, Stuart-Landau, threshold-linear, and Wilson-Cowan
dynamics. brainmass provides direct counterparts, plus models brainpy
never had — Jansen-Rit, Epileptor, Hopf, Montbrió-Pazó-Roxin, Wong-Wang,
Larter-Breakspear — and the infrastructure whole-brain work needs: explicit coupling
schemes, structured noise processes, forward models for BOLD, EEG, and MEG signals, and
parameter fitting against empirical data. Unlike the cellular case this is not a
warning; the brainpy rate models still work, this scale is simply developed in
brainmass now.
Why existing brainpy code still works#
The current brainpy codebase was reconstructed on top of brainstate,
brainevent, and braintools. This is not only a dependency
relationship: many internal functions delegate to the production-level implementations,
so the two share the same underlying code rather than maintaining parallel ports.
brainpy.math.surrogateis an alias ofbraintools.surrogate, and the einops-style helpers inbrainpy.mathare re-exported frombrainunit.math.The operators in
brainpy.math.sparse,brainpy.math.event, andbrainpy.math.jitconnbuildbraineventstructures such asCSR,CSC, and the just-in-time connectivity types, then hand the computation over to them.brainpy.lossesandbrainpy.measuredelegate tobraintools.metric, andbrainpy.initializedelegates tobraintools.init.brainpy.inputsbuilds its current waveforms frombraintools.input, andbrainpy.visualizationfrombraintools.visualize.State handling, environment settings, and compiled transformations come from
brainstate, throughState,environ, andtransform.
So a brainpy project keeps working and stays on the same foundations as the rest of
the ecosystem. Two packages sit outside that arrangement: brainunit,
whose quantities brainpy.math cannot consume, and braintrace, whose
online-learning traces attach to brainstate modules only. Sharing
foundations also does not mean models from both sides can be composed into one — see
the migration notes for both limits in detail.
What brainpy still owns#
brainpy.analysis — phase-plane analyzers, Bifurcation1D / Bifurcation2D, slow-fast
decomposition — has no counterpart in brainx. This is the one capability for
which brainpy remains the right tool, and the reason it stays in the pin set rather
than being retired.
Should I migrate?#
your situation |
recommendation |
|---|---|
Starting a new point-neuron project |
|
Maintaining a working |
stay; migrate when you need something below |
Modeling ions, ion channels, or morphology |
|
Modeling neural-mass or whole-brain dynamics |
|
Wanting unit-safe parameters ( |
migrate — |
Wanting online learning ( |
migrate — traces attach to |
Depending on |
stay on |
In short#
Treat brainpy as the experimental embryo that inspired the brainx
ecosystem. It remains maintained and usable for established projects and for its unique
analysis tools, while brainx is where new work belongs:
brainpy.state for point-neuron networks, braincell for
ions, channels, and morphology, and brainmass for neural-mass and
whole-brain models.
Ready to move? Continue with the BrainPy migration notes.