BrainCell
What's New — Release Notes 2026
Platform:  NEURON (HOC + MOD) + Python Lab:  Savtchenko / Rusakov Lab, UCL Date:  March 2026

Overview

This release introduces a major new simulation — SimMyelinatedAxon — with a full biophysics + RxD radial-diffusion engine for myelinated axons, along with a redesigned animation and data-capture pipeline, an interactive GUI for drawing myelinated regions, and two complementary AI-agent tools for codebase assistance.

AreaWhat changed
Simulation New SimMyelinatedAxon with Schwann-cell RxD, radial K+ diffusion (Config B), and IClamp / SEClamp support
RxD engine Extended-shell (Config B) radial grid; piecewise diffusion; Dirichlet / zero-flux boundary conditions per-zone; ProcAdvanceHelper
Geometry helpers BaseAxonHelper, AxonTransformationHelper, CellBuildHelper — build, transform, and validate axon sections
Myelin region MyelRegionHelper — entire-axon / zebra / draw-by-hand modes with PlotShape marker integration
Biophysics helpers AxonBiophysCompsHelper — manages MechManager rescan; dirty-state tracking via DirtyStatesHelper
Animation & export Dual-mode recording: in-process PyplotAndSaveHelper and subprocess-isolated PyplotHelper; TXT export; frame-slider playback
AI tooling Terminal agent (braincell_agent.py + braincell_mapper.py) and GUI panel (braincell_panel.py); BrainCell AI Agent manuals
Multi-cell export Export packages now include all extra cells from ExtraCellsManagerWidget; re-import and one-cycle re-export supported; extra-cell detection by comp.name regex
Import without nano Plain geometry HOC files (astrocyte and neuron, no nano arrays) now load cleanly; SWC / ASC / ZIP import paths normalised; Geometry Zoo library added
User simulations Open plugin framework for user-defined simulation scenarios via SimManager ABCs; nine built-in reference implementations; GUI embedding rules documented

1. SimMyelinatedAxon — New Simulation

NewSimMyelinatedAxon

A complete NEURON simulation for studying K+ dynamics in myelinated peripheral axons. Implemented in SimMyelinatedAxon.py (main GUI class) and SimCore.py (SimMyelinatedAxonCore), with supporting HOC parameters in ParamsHelper.hoc.

The simulation inherits RequiresAltRunControl, UsesCustomProcAdvance, and Simulation from the SimManager ABCs, so it integrates cleanly with BrainCell's standard init / run / continue workflow.

Axon geometry modes

Three modes are selectable via radio buttons at runtime (EnumAxonGeometry in BasicEnums.py):

Myelin sheath modes

Three states selectable via radio buttons (EnumMyelSheath):

Biophysics modes

CoreDirty-state change tracking — DirtyStatesHelper

DirtyStatesHelper (in DirtyStatesHelper.py) maintains a dirtyParamCat value that records the deepest change made since the last successful run. EnumParamCats defines six levels in ascending depth:

LevelMeaning
noneNo pending changes
animAnimation / presentation params changed
rxdRxD shell or diffusion params changed
biophysBiophysics or initial conditions changed
modifGeomSheath / myelination geometry changed
baseGeomBase axon geometry (length, diameter, nseg) changed

On each Init & Run, SimMyelinatedAxon.preRun() reads dirtyParamCat and rebuilds only what has changed, avoiding redundant re-initialization of expensive structures such as RxD.


2. RxD Radial-Diffusion Engine (Configuration B)

CoreExtended-shell radial grid

SimMyelinatedAxonCore.initRxDStaff() constructs a two-zone radial shell model around each axon trunk section:

The transition between zones uses a harmonic mean of the two diffusion coefficients to avoid numerical discontinuities at the sheath boundary. All shell-to-shell transport is implemented as NEURON rxd.MultiCompartmentReaction with appropriate unit scaling (mM → molecules·μm−3).

Boundary conditions

Flux injection

CoreProcAdvanceHelper — per-timestep RxD post-processing

A new ProcAdvanceHelper class (ProcAdvanceHelper.py) is called on every NEURON timestep via the UsesCustomProcAdvance mechanism. It performs three operations in order:

  1. Enforce the Dirichlet BC at Rmax for all non-myelinated segment outermost nodes
  2. Clamp any negative concentration values to veryMinOuterConc (prevents NaN propagation)
  3. Copy the sheath-boundary node concentration into schwann.ko for each Schwann-cell segment, so MOD files in Schwann sections can read the correct extracellular [K+]

The segment-to-node mapping for step 3 is pre-computed in the constructor (not per-timestep) for performance.


3. Axon Geometry Helper Classes

CoreBaseAxonHelper — axon construction and SWC import

BaseAxonHelper.py encapsulates all logic for creating the base axon section before any myelination transformation. It handles:

CoreAxonTransformationHelper — myelination geometry

AxonTransformationHelper.py transforms the base axon into a biologically realistic myelinated structure. It creates:

Key data structures: AxonArcInterval (normalized 0–1 arc position) and Axon3DPointWithArc for 3D coordinate reconstruction.

CoreCellBuildHelper — auxiliary geometry panel

CellBuildHelper.py provides a dockable panel for drawing axon sections by hand in Draw-by-hand mode. It validates the drawn topology and provides a warning footer when the geometry is invalid (e.g., the user clicks Init & Run before completing the drawing).


4. Interactive Myelinated-Region Editor

NewMyelRegionHelper — three myelination modes

MyelRegionHelper.py implements the myelinated-region selection logic for the three modes defined in EnumMyelRegion:

Entire axon

All sections are myelinated from trunk start to trunk end. No user input needed.

Zebra (periodic)

Schwann cells and nodes are placed periodically from four parameters: schwann1_start, schwann1_end, schwann2_start (the first three anchor points), and maxNumSchwannCells. All subsequent boundaries are computed by linear extrapolation.

Draw by hand

The user selects segments interactively on the PlotShape canvas using the Draw Myelinated Region menu tool. Mouse press and drag events are handled by onMousePressOrDragging(), which maintains a SortedSet of selected segment indices and groups them into contiguous Interval objects. Coloured markers (blue by default) are placed at the start and end of each myelinated region. A Clean up drawing button removes all markers.


5. Animation & Data-Export Pipeline

CoreDual-mode recording architecture

The simulation can record and display K+ concentration data in two modes, controlled by the isShowPyplotFigsInSubProcess flag:

In-process mode (PyplotAndSaveHelper)

Implemented in PyplotAndSaveHelper_Separated.py. Frames are stored directly in memory as OneFrame objects and rendered with matplotlib in the same process. A frame slider and start/stop button are provided for playback. Cumulative min/max tracking ensures consistent colour-scale across all frames.

Subprocess mode (PyplotSubProcHelper)

Implemented in PyplotSubProcHelper.py. Frames are serialised to .pickle files in a temporary folder (named frame0000.pickle, frame0001.pickle, …). A separate Python process reads and animates them via a polling timer, keeping the NEURON GUI responsive during long simulations. Marker files (running, save_to, saved) coordinate the lifecycle between producer and consumer.

Two visualisation types

CoreAnimSavePrintHelper — simulation-time frame capture

AnimSavePrintHelper.py is called from the simulation's custom procAdvance hook at intervals of Dt ms. On each frame it:

CoreTXT export

When the Save K+ conc(t, dist, radius) to TXT file checkbox is enabled, all recorded frames are written to a structured text file after the run completes. In subprocess mode, the save request is communicated via a marker file to avoid thread-safety issues; in in-process mode, PyplotAndSaveHelper.saveToTxtFile() is called directly.

CorePresentationParams — unified GUI for recording options

PresentationParams.py consolidates all recording and display checkboxes into a single object used by both SimMyelinatedAxon and AnimSavePrintHelper:

Checking/unchecking isAnim automatically resets altRunControlWidget.isInited to prevent Continue from using stale RxD state.


6. Biophysics Helper Classes

CoreAxonBiophysCompsHelper

AxonBiophysCompsHelper.py manages the MechManager interaction for the myelinated axon simulation. After the base axon geometry is established, it schedules a MechManager rescan (scheduleRescan(2)) and optionally shows the MechManager widget if the user has previously opened it. It also detects all un-insertable biophysics mechanism names from BrainCell's global list and skips them safely during biophysics application.

CoreProtoGeomStructs — reusable geometry data containers

ProtoGeomStructs.py provides lightweight data classes used across the geometry pipeline to pass section properties (length, diameter, 3D point list, parent connectivity) between helpers without coupling them to specific NEURON section objects.


7. BrainCell AI Agent Tools

The AI agent tools are external to the NEURON simulation runtime. They run as standalone Python programs and do not affect any simulation state.
Toolsbraincell_mapper.py — repository index generator

Scans all .mod, .hoc, and .py files in the BrainCell repository and produces braincell_map.json — a structured index of every file with its procedures, functions, classes, imports, and size. The map is used by the agent for fast keyword-based file search without reading every file on each query.

Output statistics: 131 MOD files, 346 HOC files, 74 Python files (typical repository). Run once at setup, then again whenever new files are added.

Toolsbraincell_agent.py — terminal AI assistant

A terminal-based AI assistant powered by the Anthropic Claude API (claude-opus-4-6). Supports four commands:

CommandDescription
ask <question>General question about any file or concept
search <query>Find the 8 most relevant files by keyword
explain <file>Full biophysical explanation of a MOD / HOC / PY file
modify <file> <task>Propose a code modification; requires explicit user approval before saving

The agent's system prompt includes the full repository structure, key MOD file list, and instructions to always cite parameter names and line-level details when discussing biophysics.

Toolsbraincell_panel.py — GUI desktop panel

A tkinter-based desktop application providing the same AI-agent functionality without a terminal. Features a dark-blue colour scheme matching BrainCell's visual identity, a scrollable output area with monospace code rendering, a file browser for selecting targets, and background threading so the GUI stays responsive during API calls.

The panel reads and writes ANTHROPIC_API_KEY from the environment and can be launched by double-clicking braincell_panel.py in File Explorer — no Anaconda Prompt required.

ToolsDocumentation — two HTML manuals

8. Known Limitations & Open Items

The following limitations are formally documented in the source code and are subjects for future development.
AreaLimitation
RxD Only K+ is supported for radial diffusion; Na+, Ca2+, and other ions are not yet included
RxD No longitudinal diffusion; its contribution at nodes of Ranvier may be significant
RxD Diffusion coefficient in the outer zone is uniform (D/α); section-dependent values would require separate rxd.Region objects per zone
RxD Homogeneous radial shell spacing assumed; inhomogeneous axon diameter and per-section shell counts are not supported
Simulation Outside-in diffusion extracellular mechanisms are not inserted into newly created axon and Schwann sections on re-use
Simulation Switching real biophysics → test sines → real biophysics resets biophysics to defaults (mini bug)
Visualisation Colour map columns have equal visual width regardless of the segment length they represent
Performance ProcAdvanceHelper.onAdvance() iterates over all RxD nodes; candidate for @njit parallelisation
MOD units NEURON's modlunit checker reports a units problem in _i2fc.mod

9. Multi-Cell Export and Re-Import

NewExport of network configurations with extra cells

BrainCell now supports exporting simulation packages that contain not only the primary cell but also all additional cells registered through the Extra Cells Manager (ExtraCellsManagerWidget.hoc). The export generator (GeneratorsForMainHocFile.py) iterates over extraCellsManagerWidget.listOfExtraCellListItems and emits instantiation code for each extra cell, preserving:

The exported HOC package is self-contained and re-runnable without the BrainCell GUI, making it suitable for cluster submission (e.g., NSG / HPC workflows).

CoreExtra-cell re-import and the one-cycle limitation

Exported multi-cell packages can be re-imported into BrainCell via _Testing/init_ImportExtraCells.hoc and the ExtraCellsManagerWidget. After re-import, the user can modify biophysics or connection parameters and perform a second export.

Known architectural limitation: After re-import and modification, a second export may omit extra cells because extraCellsManagerWidget.listOfExtraCellListItems is empty at that point — the re-imported cells are instantiated directly from HOC rather than being registered through the widget's normal creation path.

The planned fix is a registerExistingExtraCell procedure in ExtraCellsManagerWidget that registers already-instantiated cells without re-running ExtraCell.__init__. Until that fix is in place, one reliable multi-cell export/re-import cycle is supported.
CoreExtra-cell detection by component name pattern

When scanning sections after re-import, extra-cell sections are identified by matching comp.name against the regular expression ^Extra Cell #(\d+)$. This is more robust than the previous approach of inspecting comp.list_ref[0].sec.name(), which was fragile after re-import because section names can change.


10. Import of Astrocytes and Neurons Without Nano-Structures

NewDirect import of plain geometry files

Previously, BrainCell required nano-geometry (Nanogeometry/ HOC files with embedded spine/process data) for astrocytes and neurons to be fully functional in the GUI. This release extends the import pipeline to accept plain geometry-only files — HOC files from Geometry/Astrocyte/ and Geometry/Neuron/ that contain only section topology and 3D coordinates, with no nano-structure arrays.

The import layer (_Code/Import/ImportBaseGeometry/) now:

CoreGeometry Zoo — shared morphology library

A new Geometry/Zoo/ folder provides reference morphologies for both cell types in plain format, independent of any nano-structure. These files are suitable for rapid prototyping, teaching, and validation workflows where nano-scale geometry is not required. Currently includes neuron_NEURON_HOC.hoc (48 kB) as a starting reference.

CoreSWC / ASC import pipeline

The import pipeline supports morphology files in three formats beyond plain HOC:

All three paths normalise to a temporary HOC file before loading, ensuring a single downstream import code path regardless of source format. The temporary file is regenerated only when the source changes, avoiding redundant conversion on repeated loads.


11. User-Extensible Simulation Scenarios

NewOpen simulation framework for user-defined scenarios

BrainCell now provides a formal extension point that allows any user to add a completely new simulation scenario without modifying BrainCell's core files. The mechanism is based on the SimManager plugin architecture: each simulation is a Python class that inherits one or more abstract base classes (ABCs) from SimABCs and is registered with SimManager via a sourcePythonCode call in the SimManager loader.

How to add a new simulation

  1. Create a new subfolder under _Code/Simulations/Sims/Common/ or _Code/Simulations/Sims/Neuron/ (or Astrocyte) containing a Python file with your simulation class
  2. Inherit from the appropriate ABC combination — for example, Simulation alone for a basic simulation, RequiresAltRunControl for a custom run-control widget, or UsesCustomProcAdvance to hook into every NEURON timestep
  3. Implement the required interface methods: show(), preRun(isInitOnly), and optionally procAdvance() and postRun()
  4. Register the new folder and class in SimManager's loader so that BrainCell discovers it at startup:
    sourcePythonCode("\\Sims\\Common\\MySimFolder", "from MySimFile import MySimClass", "context")
  5. BrainCell will automatically add the new simulation to the SimManager dropdown menu — no further changes to core files are needed
CoreAvailable ABC mix-ins for simulation authors
ABCWhat it provides
Simulation Base class; requires show() and preRun(isInitOnly)
RequiresAltRunControl Replaces NEURON's default RunControl with a custom Init & Run panel; required when default tstop / dt controls are insufficient
UsesCustomProcAdvance Registers a Python procAdvance() method that is called on every NEURON timestep via CVode.extra_scatter_gather()
CoreExisting simulations as reference implementations

The following built-in simulations serve as reference implementations and templates for user-defined scenarios:

SimulationCell typeDemonstrates
SimMyelinatedAxon Neuron Full ABC combination, RxD, dirty-state tracking, custom procAdvance, matplotlib animation
SimVoltageCA1Neuron Neuron Voltage-clamp / current-clamp with graph recording
SimCalciumWave Common RxD calcium wave propagation
SimFrapSphere / Cylinder / Plane Common FRAP (fluorescence recovery) diffusion modelling in three geometries
SimGlutamate / SimPotassium Common Iterative neurotransmitter / ion concentration dynamics
SimOutsideInDiffusion Common Integration with the OutsideInDiffusion extracellular engine
SimConstantElectricalSimulations Common Constant-current injection protocols
SimFrequencyElectricalSimulation Common Frequency-sweep stimulation
SimSpatialVoltageDistributions Common Spatial voltage along dendrites
CoreGUI integration — simulations appear inside SimManager's panel

Each simulation's show() method must build its GUI using h.xpanel("") / h.xpanel() blocks as top-level containers. This ensures the simulation's controls appear inside SimManager's panel rather than as a detached pop-up window — a requirement enforced by SimManager's panel-embedding architecture. Using bc.VBox as the outermost container is explicitly disallowed for this reason.


BrainCell • What's New • Savtchenko / Rusakov Lab, UCL • March 2026