Regions & Locsets#
When you decorate a multi-compartment cell you must say where a mechanism
goes. braincell answers this with two kinds of selection expression, both
living in braincell.filter:
a region selects an extended set of cable — “the soma”, “all apical dendrites”, “everything within 100 µm of the root”. You
paintdensity mechanisms onto regions.a locset selects a set of points — “the root”, “all branch tips”, “every 50 µm”. You
placepoint mechanisms onto locsets.
import braincell.filter as f
Note
This mirrors the labels idea in simulators like Arbor: a small, composable algebra for naming parts of a morphology, kept separate from the mechanisms you attach to them.
Regions (paint targets)#
Expression |
Selects |
|---|---|
the entire cell |
|
nothing (useful as an identity in set operations) |
|
branches matching a property, e.g. |
|
a sub-interval along branches |
|
a branch and everything distal to it |
|
cable whose radius falls in a range |
|
cable within a straight-line / along-the-tree distance |
from braincell.filter import AllRegion, branch_in
cell.paint(AllRegion(), mech.Channel("IL", g_max=0.0003 * u.S / u.cm**2, E=-70. * u.mV))
cell.paint(branch_in("type", "soma"), mech.Channel("Na_Ba2002", g_max=0.12 * u.S / u.cm**2))
cell.paint(
branch_in("type", ("dendrite", "basal_dendrite", "apical_dendrite")),
mech.Channel("CaL_IS2008", g_max=0.002 * u.S / u.cm**2),
)
Locsets (place targets)#
Expression |
Selects |
|---|---|
a point on the root branch, e.g. |
|
all terminal tips |
|
all branch points (bifurcations) |
|
evenly / step-spaced points along the cell |
|
randomly sampled points |
|
a specific (branch, position) location |
from braincell.filter import RootLocation, Terminals
cell.place(RootLocation(0.5), mech.CurrentClamp(durations=50 * u.ms, amplitudes=0.2 * u.nA))
cell.place(Terminals(), mech.StateProbe("V"))
Composing selections#
Both regions and locsets support set operations — union, intersection,
difference — so you can build precise targets from simple parts
(RegionSetOp, LocsetSetOp,
and the mask variants). This is the same composability that makes mechanisms
reusable: name a place once, decorate it many times.
braincell.filter also caches selection results
(SelectionCache) so repeated paints over the same
region don’t recompute the membership.
See also#
Mechanisms — the things you paint and place.
Morphology — what the selections range over.
braincell.filter module — full selection API reference.