brainx-skill 1.0.14 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/README.md +17 -1
  2. package/manifest.json +1 -1
  3. package/mcp-servers/codex/skills.json +1 -1
  4. package/package.json +1 -1
  5. package/skills/bio-neuro-lit/SKILL.md +4 -2
  6. package/skills/bio-neuro-lit/references/required-supplements.md +27 -0
  7. package/skills/brainx-acceleration/SKILL.md +30 -437
  8. package/skills/brainx-acceleration/references/audit-and-rewrite-patterns.md +326 -0
  9. package/skills/brainx-general-guard/SKILL.md +24 -8
  10. package/skills/brainx-install/SKILL.md +3 -3
  11. package/skills/brainx-install/references/compatibility-and-release-matching.md +28 -20
  12. package/skills/brainx-install/references/uninstall-and-cleanup.md +11 -4
  13. package/skills/brainx-modeling-loop/SKILL.md +143 -36
  14. package/skills/brainx-modeling-loop/agents/openai.yaml +2 -2
  15. package/skills/brainx-modeling-loop/references/mechanism-comparison.md +62 -0
  16. package/skills/brainx-modeling-loop/references/multiscale-coupling.md +16 -0
  17. package/skills/brainx-modeling-loop/references/paper-reproduction.md +42 -0
  18. package/skills/brainx-modeling-loop/references/parameter-fitting-workflow.md +14 -14
  19. package/skills/brainx-modeling-loop/references/run-experiment.md +1 -1
  20. package/skills/brainx-modeling-loop/references/training-workflow.md +10 -8
  21. package/skills/brainx-visualization/SKILL.md +6 -2
  22. package/skills/brainx-visualization/references/neural-data-visualization.md +1 -1
  23. package/skills/brainx-visualization/references/statistical-and-model-visualization.md +1 -1
  24. package/skills/package-skills/braincell/SKILL.md +23 -14
  25. package/skills/package-skills/braincell/references/braintools/input-current.md +1 -1
  26. package/skills/package-skills/braincell/references/braintools/metric.md +72 -46
  27. package/skills/package-skills/braincell/references/mixions-for-adaptation.md +1 -1
  28. package/skills/package-skills/braincell/references/multicompartment/braincell-manual-morphology-construction.md +1 -1
  29. package/skills/package-skills/braincell/references/multicompartment/cv-policy-reference.md +1 -1
  30. package/skills/package-skills/braincell/references/multicompartment/filter-function-library.md +3 -3
  31. package/skills/package-skills/braincell/references/multicompartment/morphology-io-loading-validation.md +1 -1
  32. package/skills/package-skills/braincell/references/multicompartment/multicompartment-cell-workflow.md +31 -43
  33. package/skills/package-skills/braincell/references/multicompartment/network-workflow.md +49 -0
  34. package/skills/package-skills/braincell/references/multicompartment/probe-reference.md +26 -114
  35. package/skills/package-skills/braincell/references/multicompartment/topology-building-and-visualization.md +40 -28
  36. package/skills/package-skills/braincell/references/scripts/cell_multicompartment_reference.py +13 -17
  37. package/skills/package-skills/brainevent/SKILL.md +0 -3
  38. package/skills/package-skills/brainevent/references/synaptic-plasticity.md +1 -1
  39. package/skills/package-skills/brainmass/SKILL.md +5 -3
  40. package/skills/package-skills/brainmass/references/brainstate/parameter-constraints-regularization.md +9 -7
  41. package/skills/package-skills/brainmass/references/brainstate/parameter-transforms-regularizers-catalog.md +4 -4
  42. package/skills/package-skills/brainmass/references/braintools/data-preprocessing.md +15 -7
  43. package/skills/package-skills/brainmass/references/braintools/metric.md +72 -46
  44. package/skills/package-skills/brainmass/references/coupling-network-api.md +3 -1
  45. package/skills/package-skills/brainmass/references/fitting-with-objectives-api.md +6 -6
  46. package/skills/package-skills/brainmass/references/horn-task-training.md +9 -9
  47. package/skills/package-skills/brainmass/references/modellibrary.md +12 -10
  48. package/skills/package-skills/brainmass/references/scripts/resting-state-meg-whole-brain-pipeline.py +5 -3
  49. package/skills/package-skills/brainmass/references/scripts/wilson-cowan-ei-dynamics.py +10 -6
  50. package/skills/package-skills/brainmass/references/simulator-input-monitor-api.md +3 -1
  51. package/skills/package-skills/brainmass/references/visualization-analysis-api.md +17 -9
  52. package/skills/package-skills/brainspike/SKILL.md +201 -0
  53. package/skills/package-skills/brainspike/references/braintools/connectivity.md +40 -0
  54. package/skills/package-skills/brainspike/references/braintools/data-preprocessing.md +39 -0
  55. package/skills/package-skills/brainspike/references/braintools/input-current.md +55 -0
  56. package/skills/package-skills/brainspike/references/braintools/metric.md +36 -0
  57. package/skills/package-skills/brainspike/references/braintools/optimizer.md +50 -0
  58. package/skills/package-skills/brainspike/references/braintools/parameter-initializer.md +43 -0
  59. package/skills/package-skills/brainspike/references/braintools/surrogate.md +40 -0
  60. package/skills/package-skills/brainspike/references/migration-boundary.md +38 -0
  61. package/skills/package-skills/brainspike/references/model-and-readout-selection.md +41 -0
  62. package/skills/package-skills/brainspike/references/multirate-coupling.md +31 -0
  63. package/skills/package-skills/brainspike/references/multiscale-composition.md +28 -0
  64. package/skills/package-skills/brainspike/references/native-composition.md +52 -0
  65. package/skills/package-skills/brainspike/references/native-delays.md +34 -0
  66. package/skills/package-skills/brainspike/references/native-projections.md +43 -0
  67. package/skills/package-skills/brainspike/references/native-training.md +36 -0
  68. package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/devices.md +33 -33
  69. package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/divergence-and-parity.md +15 -15
  70. package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/integration-categories.md +1 -1
  71. package/skills/package-skills/brainspike/references/nest-compatible/model-library.md +200 -0
  72. package/skills/package-skills/brainspike/references/nest-compatible/network-building.md +276 -0
  73. package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/scripts/brette_et_al_2007.py +23 -26
  74. package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/scripts/brunel_alpha.py +18 -21
  75. package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/scripts/brunel_delta.py +16 -19
  76. package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/scripts/clopath_synapse_spike_pairing.py +11 -12
  77. package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/scripts/evaluate_tsodyks2_synapse.py +10 -11
  78. package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/scripts/spatial_gaussex.py +18 -18
  79. package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/scripts/synapsecollection.py +26 -29
  80. package/skills/package-skills/brainspike/references/nest-compatible/synapse-and-connectivity.md +166 -0
  81. package/skills/package-skills/brainspike/references/nest-delay-boundaries.md +31 -0
  82. package/skills/package-skills/brainspike/references/nonlinear-state-sharing.md +26 -0
  83. package/skills/package-skills/{brainpy-state → brainspike}/references/perturbation-experiment-validity.md +2 -2
  84. package/skills/package-skills/brainspike/references/simulator-training.md +61 -0
  85. package/skills/package-skills/brainspike/references/temporal-task-training.md +36 -0
  86. package/skills/package-skills/brainspike/scripts/advanced_native_patterns.py +76 -0
  87. package/skills/package-skills/brainspike/scripts/delay_workflow.py +44 -0
  88. package/skills/package-skills/brainspike/scripts/delayed_cue_training.py +78 -0
  89. package/skills/package-skills/brainspike/scripts/lif_smoke.py +31 -0
  90. package/skills/package-skills/brainspike/scripts/multiscale_workflow.py +35 -0
  91. package/skills/package-skills/brainspike/scripts/native_ei_network.py +47 -0
  92. package/skills/package-skills/brainspike/scripts/native_workflows.py +77 -0
  93. package/skills/package-skills/brainspike/scripts/nest_boundary_workflows.py +108 -0
  94. package/skills/package-skills/brainspike/scripts/train_native_snn.py +65 -0
  95. package/skills/package-skills/brainspike/scripts/train_nest_simulator.py +69 -0
  96. package/skills/package-skills/brainspike/scripts/train_nest_simulator_two_weights.py +220 -0
  97. package/skills/package-skills/brainstate/SKILL.md +16 -21
  98. package/skills/package-skills/brainstate/references/brainstate/brainstate-control-flow-patterns.md +1 -138
  99. package/skills/package-skills/brainstate/references/brainstate/brainstate-transformed-diagnostics.md +1 -1
  100. package/skills/package-skills/brainstate/references/brainstate/delay-buffers.md +45 -0
  101. package/skills/package-skills/brainstate/references/brainstate/parameter-constraints-regularization.md +9 -7
  102. package/skills/package-skills/brainstate/references/brainstate/parameter-transforms-regularizers-catalog.md +4 -4
  103. package/skills/package-skills/brainstate/references/brainstate/randomness-and-reproducibility.md +6 -4
  104. package/skills/package-skills/brainstate/references/brainstate/transformation-grad-expansion.md +4 -4
  105. package/skills/package-skills/brainstate/references/brainstate/transformation-vmap-expansion.md +1 -1
  106. package/skills/package-skills/brainstate/references/braintools-optimizer-reference.md +16 -0
  107. package/skills/package-skills/brainstate/references/libraries/prebuilt-layer-library.md +1 -1
  108. package/skills/package-skills/brainstate/references/simulation-environment.md +5 -5
  109. package/skills/package-skills/braintrace/SKILL.md +17 -38
  110. package/skills/package-skills/braintrace/references/Drtrl.md +9 -26
  111. package/skills/package-skills/braintrace/references/algorithm selection.md +7 -12
  112. package/skills/package-skills/braintrace/references/batching.md +15 -35
  113. package/skills/package-skills/braintrace/references/compiler_internal.md +1 -1
  114. package/skills/package-skills/braintrace/references/custom algorithms.md +1 -2
  115. package/skills/package-skills/braintrace/references/customizing_primitive_transforms.md +26 -15
  116. package/skills/package-skills/braintrace/references/pp_pprop workflow.md +5 -139
  117. package/skills/package-skills/brainunit/SKILL.md +7 -2
  118. package/skills/package-skills/brainunit/references/array-mechanics/functional-structural-api.md +1 -1
  119. package/skills/package-skills/brainunit/references/math-function-library.md +2 -2
  120. package/skills/package-skills/brainunit/references/typing-and-runtime-validation.md +5 -2
  121. package/skills/package-skills/brainevent/references/scripts/102_EI_net_1996.py +0 -107
  122. package/skills/package-skills/brainevent/references/scripts/204_joglekar_2018_propagation.py +0 -168
  123. package/skills/package-skills/brainevent/references/scripts/coba_ei_teaching.py +0 -356
  124. package/skills/package-skills/brainpy-state/SKILL.md +0 -247
  125. package/skills/package-skills/brainpy-state/references/array-creation.md +0 -158
  126. package/skills/package-skills/brainpy-state/references/brain-dynamics-delay-protocol.md +0 -147
  127. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/analysis.md +0 -150
  128. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/brainpy legacy workflow.md +0 -373
  129. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/built-in dynamic neuron model.md +0 -150
  130. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/connecting neurons.md +0 -175
  131. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/customize neuron and synpase.md +0 -286
  132. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/infrastructure/Input generation.md +0 -111
  133. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/infrastructure/More about simulation.md +0 -163
  134. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/infrastructure/Multi-device array sharding.md +0 -113
  135. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/infrastructure/Parallel experiment execution.md +0 -136
  136. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/infrastructure/array creation and mechanics.md +0 -222
  137. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/infrastructure/brainpy math environment setting.md +0 -123
  138. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/infrastructure/delays.md +0 -107
  139. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/infrastructure/object oriented transformations and control flows.md +0 -185
  140. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/integrators.md +0 -181
  141. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/route activity through connectivity.md +0 -102
  142. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/synaptic projections.md +0 -147
  143. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/synpase properties.md +0 -159
  144. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/training/loss library.md +0 -127
  145. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/training/optimizers.md +0 -167
  146. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/training/parameter initializers.md +0 -107
  147. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/training/prebuilt neural network layers.md +0 -186
  148. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/training/surrogate gradients.md +0 -104
  149. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/training/trainer library.md +0 -89
  150. package/skills/package-skills/brainpy-state/references/brainPy(legacy)/training/trainingworkflows.md +0 -253
  151. package/skills/package-skills/brainpy-state/references/braintools/brainstate-control-flow-patterns.md +0 -334
  152. package/skills/package-skills/brainpy-state/references/braintools/connectivity.md +0 -206
  153. package/skills/package-skills/brainpy-state/references/braintools/data-preprocessing.md +0 -79
  154. package/skills/package-skills/brainpy-state/references/braintools/input-current.md +0 -199
  155. package/skills/package-skills/brainpy-state/references/braintools/metric.md +0 -152
  156. package/skills/package-skills/brainpy-state/references/braintools/optimizer.md +0 -179
  157. package/skills/package-skills/brainpy-state/references/braintools/parameter-initializer.md +0 -183
  158. package/skills/package-skills/brainpy-state/references/braintools/surrogate.md +0 -147
  159. package/skills/package-skills/brainpy-state/references/component-selection.md +0 -288
  160. package/skills/package-skills/brainpy-state/references/nest-compatible/model-library.md +0 -200
  161. package/skills/package-skills/brainpy-state/references/nest-compatible/nest-workflow.md +0 -156
  162. package/skills/package-skills/brainpy-state/references/nest-compatible/network-building.md +0 -264
  163. package/skills/package-skills/brainpy-state/references/nest-compatible/synapse-and-connectivity.md +0 -153
  164. package/skills/package-skills/brainpy-state/references/projection-patterns.md +0 -127
  165. package/skills/package-skills/brainpy-state/references/scripts/103_COBA_2005.py +0 -86
  166. package/skills/package-skills/brainpy-state/references/scripts/106_COBA_HH_2007.py +0 -181
  167. package/skills/package-skills/brainpy-state/references/scripts/107_gamma_oscillation_1996.py +0 -156
  168. package/skills/package-skills/brainpy-state/references/scripts/109_fast_global_oscillation.py +0 -111
  169. package/skills/package-skills/brainpy-state/references/scripts/201_surrogate_grad_lif_fashion_mnist.py +0 -221
  170. package/skills/package-skills/brainpy-state/references/scripts/sound_localization.py +0 -240
  171. package/skills/package-skills/brainpy-state/references/scripts/training-snn.py +0 -119
@@ -2,13 +2,13 @@
2
2
 
3
3
  ## Purpose and boundary
4
4
 
5
- Use this reference when a BrainCell simulation depends on geometry, axial current, regional biophysics, or location-specific stimulation and recording. Keep isopotential cells in `skills/package-skills/braincell/SKILL.md` and cross-cell connections or training in `skills/package-skills/brainpy-state/SKILL.md`; never model compartments with `SingleCompartment.size`.
5
+ Use this reference when a BrainCell simulation depends on geometry, axial current, regional biophysics, or location-specific stimulation and recording. Use `SingleCompartment` for isopotential cells. Keep independent cells on the population axis and resolve compartments through the morphology and CV policy.
6
6
 
7
7
  ## Underlying principle of BrainCell multicompartment cells
8
8
 
9
9
  `braincell.filter` expressions represent spatial targets. Regions select cable for `paint()`; locsets select points for `place()`.
10
10
 
11
- `braincell.mech` declarations represent cellular biophysics and point processes. Paint cable properties, ions, and channels over regions; place clamps and probes at locsets.
11
+ `braincell.mech` declarations represent cellular biophysics and point processes. Paint cable properties, ions, and channels over regions. Place clamps and synapses at locsets. Declare recordings on the cell or a spatial view.
12
12
 
13
13
  ## Workflow map
14
14
 
@@ -133,7 +133,7 @@ for cv in cell.cvs[:3]:
133
133
 
134
134
  Validate every policy by refining it and comparing the target observable. Resolve cable properties before `DLambda`; split capacitance or axial-resistivity changes at branch boundaries.
135
135
 
136
- Open `references/multicompartment/cv-policy-reference.md` for by-type or composite policies, probe mapping, and convergence.
136
+ Open `references/multicompartment/cv-policy-reference.md` for by-type or composite policies, recording-site mapping, and convergence.
137
137
 
138
138
  ## Declare distributed biophysics
139
139
 
@@ -174,9 +174,9 @@ BrainCell area-scales capacitance and conductance densities during lowering; kee
174
174
 
175
175
  Open `references/multicompartment/filter-function-library.md` for composed or geometry-based regions, `references/ion-library.md` or `references/channel-library.md` for non-canonical mechanisms, and `references/mixions-for-adaptation.md` for calcium-dependent or multi-ion coupling.
176
176
 
177
- ## Place stimuli and probes
177
+ ## Place stimuli and declare recordings
178
178
 
179
- Point declarations define where current enters and what the simulation exposes; use locsets for both and place at least one probe before `run()`.
179
+ Place current clamps at locsets. Register observables on a selected view before initialization.
180
180
 
181
181
  | API | Description |
182
182
  |---|---|
@@ -184,9 +184,7 @@ Point declarations define where current enters and what the simulation exposes;
184
184
  | `braincell.filter.at(branch, position)` | Use for one named branch position; the branch argument identifies a branch, not an anatomical type. |
185
185
  | `braincell.filter.Terminals()` | Use when a point declaration must resolve at every terminal tip. |
186
186
  | `braincell.mech.CurrentClamp(...)` | Use for piecewise current injection; declare delay, durations, and amplitudes with time and current units. Currents from clamps at the same runtime point add. |
187
- | `braincell.mech.StateProbe(field="v")` | Use to record cell-owned membrane voltage; `v` is the current multicompartment State field. |
188
- | `braincell.mech.MechanismProbe(mechanism=..., field=...)` | Use to record a real runtime State field on a named channel or ion; do not request a static parameter or derived property. |
189
- | `braincell.mech.CurrentProbe(...)` | Use to record one mechanism current or the total current owned by a named ion. |
187
+ | `cell.loc(locset).record(name, observable)` | Use to record over the CVs selected by a locset. Select membrane voltage with `braincell.observe.state("v")`. |
190
188
  | `cell.place(locset, *point_mechanisms)` | Use only in DECLARING; it records point declarations at every resolved location and returns the cell for chaining. |
191
189
 
192
190
  ```python
@@ -202,12 +200,10 @@ cell.place(
202
200
  amplitudes=0.2 * u.nA,
203
201
  ),
204
202
  )
205
- cell.place(soma_midpoint, mech.StateProbe())
203
+ cell.loc(soma_midpoint).record("soma_v", braincell.observe.state("v"))
206
204
  ```
207
205
 
208
- A multi-point locset creates one probe per resolved point. Inspect `sample_probes()` for keys; assign unique names only when stable keys are required.
209
-
210
- Open `references/multicompartment/filter-function-library.md` for composed locsets and `references/multicompartment/probe-reference.md` for probe selection or missing and ambiguous keys.
206
+ Open `references/multicompartment/filter-function-library.md` for composed locsets and `references/multicompartment/probe-reference.md` for observable selection, sample schedules, result schemas, or legacy probe migration.
211
207
 
212
208
  ## Initialize and inspect the lowered runtime
213
209
 
@@ -215,35 +211,32 @@ Open `references/multicompartment/filter-function-library.md` for composed locse
215
211
 
216
212
  | API | Description |
217
213
  |---|---|
218
- | `cell.init_state(batch_size=None)` | Use after every `paint()` and `place()` call; it lowers declarations, allocates evolving model State, materializes clamp and probe layouts, and raises if the cell is already initialized. |
214
+ | `cell.init_state(batch_size=None)` | Use after declaring mechanisms and recordings. It lowers declarations, allocates evolving model State, and raises if the cell is already initialized. |
219
215
  | `cell.node_tree` | Use after initialization to inspect the point-and-edge execution topology derived from the CV tree. |
220
216
  | `cell.layouts` | Use after initialization to inspect each lowered mechanism layout, including its kind, target, active count, source CVs, and runtime point indices. |
221
- | `cell.sample_probe(name)` | Use after initialization to read the current value of one probe by its resolved name. |
222
- | `cell.sample_probes()` | Use after initialization to read all current probe values and discover the exact probe-key surface. |
223
217
 
224
218
  ```python
225
219
  cell.init_state()
226
220
 
227
- samples = cell.sample_probes()
228
- print("probe keys:", sorted(samples))
221
+ assert cell.V.value.shape == cell.pop_size + (cell.n_cv,)
229
222
  print("runtime nodes:", len(cell.node_tree.nodes))
230
223
  for layout in cell.layouts:
231
224
  print(layout.kind, layout.target, layout.n_active)
232
225
  ```
233
226
 
234
- Inspect `cell.cvs` before initialization; inspect `cell.node_tree`, `cell.layouts`, and probes afterward. Runtime surfaces raise in DECLARING; call `reset()` before changing `paint()` or `place()` rules.
227
+ Inspect `cell.cvs` before initialization and runtime voltage and mechanism layouts afterward. In BrainCell 0.2.0 the unbatched voltage has population axes followed by the CV axis, even for a singleton population.
235
228
 
236
229
  Open `references/multicompartment/topology-building-and-visualization.md` to visualize CV, branch, node, or placement topology; open `references/multicompartment/probe-reference.md` for sampling failures.
237
230
 
238
231
  ## Run and interpret the result
239
232
 
240
- `run()` advances the initialized cell from its current time and samples every placed probe at each step, so repeated calls continue the same simulation unless State is reset.
233
+ `run()` advances from the current cell time. Each recording block carries the times for its own sample schedule.
241
234
 
242
235
  | API | Description |
243
236
  |---|---|
244
- | `cell.run(dt=..., duration=...)` | Use with positive time quantities to advance the cell; it calls `init_state()` only when still DECLARING and raises `ValueError` when no probe is placed. |
237
+ | `cell.run(dt=..., duration=...)` | Use with positive time quantities and a duration divisible by `dt`. It initializes a standalone cell on first use. |
245
238
  | `braincell.RunResult.time` | Use as the unit-aware `(n_steps,)` time axis spanning `[start_t, start_t + duration)`. |
246
- | `braincell.RunResult.traces` | Use as the probe-name to trace mapping; every trace has the same leading time dimension as `RunResult.time`. |
239
+ | `braincell.RunResult.samples` | Look up a named recording block and use its `time`, `values`, and `schema` together. |
247
240
  | `cell.current_time` | Use after a run to inspect the endpoint from which the next `run()` call will continue. |
248
241
  | `Quantity.to_decimal(unit)` | Use only at plotting, serialization, or external-library boundaries to obtain values in an explicit compatible unit. |
249
242
 
@@ -253,12 +246,10 @@ result = cell.run(
253
246
  duration=100.0 * u.ms,
254
247
  )
255
248
 
256
- voltage_key = next(key for key in result.traces if key.endswith("_v"))
257
- voltage = result.traces[voltage_key]
258
-
259
- assert result.time.shape[0] == voltage.shape[0]
260
- times_ms = result.time.to_decimal(u.ms)
261
- voltage_mV = voltage.to_decimal(u.mV)
249
+ voltage = result.samples["soma_v"]
250
+ assert voltage.values.shape == (voltage.time.size, 1)
251
+ times_ms = voltage.time.to_decimal(u.ms)
252
+ voltage_mV = voltage.values[:, 0].to_decimal(u.mV)
262
253
  ```
263
254
 
264
255
  Keep quantities unit-aware and convert only at external boundaries. Validate `dt` by comparing the target observable at `dt / 2`.
@@ -267,7 +258,7 @@ Open `references/solver-library-with-effects.md` for cable-solver choice or meth
267
258
 
268
259
  ## Canonical end-to-end workflow
269
260
 
270
- This current-clamp pattern uses an explicit passive baseline, `DLambda` with staggered integration, somatic active channels, runtime target checks, and one voltage probe.
261
+ This current-clamp pattern uses an explicit passive baseline, `DLambda` with staggered integration, somatic active channels, runtime target checks, and one voltage recording. Supply a valid SWC file containing a soma at `neuron.swc`.
271
262
 
272
263
  ```python
273
264
  import braincell
@@ -331,7 +322,7 @@ cell.place(
331
322
  amplitudes=0.2 * u.nA,
332
323
  ),
333
324
  )
334
- cell.place(soma_midpoint, mech.StateProbe())
325
+ cell.loc(soma_midpoint).record("soma_v", braincell.observe.state("v"))
335
326
 
336
327
  # 5. Inspect the final spatial layout before allocating runtime State.
337
328
  print("n_cv:", cell.n_cv)
@@ -340,25 +331,21 @@ for cv in cell.cvs[:3]:
340
331
 
341
332
  # 6. Lower declarations, verify resolved targets, and run.
342
333
  cell.init_state()
343
- initial_samples = cell.sample_probes()
344
- assert len(initial_samples) == 1
345
- voltage_key = next(iter(initial_samples))
346
- assert voltage_key.endswith("_v")
334
+ assert cell.V.value.shape == (1, cell.n_cv)
347
335
 
348
336
  for layout in cell.layouts:
349
337
  print(layout.kind, layout.target, layout.n_active)
350
338
 
351
339
  result = cell.run(dt=0.05 * u.ms, duration=100.0 * u.ms)
352
- voltage = result.traces[voltage_key]
353
-
354
- assert result.time.shape[0] == voltage.shape[0]
355
- times_ms = result.time.to_decimal(u.ms)
356
- voltage_mV = voltage.to_decimal(u.mV)
340
+ voltage = result.samples["soma_v"]
341
+ assert voltage.values.shape == (voltage.time.size, 1)
342
+ times_ms = voltage.time.to_decimal(u.ms)
343
+ voltage_mV = voltage.values[:, 0].to_decimal(u.mV)
357
344
  ```
358
345
 
359
346
  Replace the example morphology, mechanisms, stimulus, readout, `dt`, and CV policy, then validate the target observable under numerical refinement.
360
347
 
361
- Open `references/scripts/cell_multicompartment_reference.py` for the full tutorial with CV, node-tree, layout, policy, and plotting inspection.
348
+ Open `references/scripts/cell_multicompartment_reference.py` for the full tutorial with CV, node-tree, layout, policy, and plotting inspection. Pass the path to a soma-and-dendrite SWC as the script's first argument.
362
349
 
363
350
  ## Reset, continue, or revise
364
351
 
@@ -368,20 +355,21 @@ Use continuation, State reset, declaration reset, or a new cell according to wha
368
355
  |---|---|---|
369
356
  | Continue the same trajectory | Call `cell.run(...)` again. | The next run starts at `cell.current_time`; the cell is not reinitialized. |
370
357
  | Repeat the same declaration from reset State | Call `cell.reset_state()`, then `cell.run(...)`. | The cell remains INITIALIZED while voltage, spike, time, and mechanism State are reseeded through their reset hooks. |
371
- | Change mechanisms, regions, locsets, or probes | Call `cell.reset()`, edit with `paint()` or `place()`, then call `init_state()`. | Runtime State is discarded and the cell returns to DECLARING while its declaration rules remain available for revision. |
358
+ | Change the declaration | Call `cell.reset()` to reopen declaration before adding mechanisms or recordings. Build a fresh cell when replacing an existing recording name. | Runtime State is discarded. Existing declarations are retained. |
372
359
  | Compare CV policies or independent numerical trials | Construct separate cells from one model-building function. | Each comparison has independent declarations, runtime State, and time. |
373
360
 
374
361
  ## Reference routing
375
362
 
376
- Open the smallest child for the next decision; `skills/package-skills/braincell/SKILL.md` routes multicompartment work here before these children.
363
+ Open the smallest child for the next decision.
377
364
 
378
365
  | Reference | Open when |
379
366
  |---|---|
380
367
  | `references/multicompartment/morphology-io-loading-validation.md` | Loading SWC, ASC, NeuroML2, NeuroMorpho.Org, or checkpoint data; configuring validation; or checking loaded geometry. |
381
368
  | `references/multicompartment/braincell-manual-morphology-construction.md` | Constructing branches, points, radii, types, and parent-child topology without an existing morphology file. |
382
369
  | `references/multicompartment/filter-function-library.md` | Selecting or composing non-canonical regions and locsets for `paint()` and `place()`. |
383
- | `references/multicompartment/cv-policy-reference.md` | Selecting advanced CV policies or evaluating spatial resolution, cost, probe mapping, and convergence. |
384
- | `references/multicompartment/probe-reference.md` | Selecting State, mechanism, or current probes; stabilizing trace keys; or resolving empty and ambiguous traces. |
370
+ | `references/multicompartment/cv-policy-reference.md` | Selecting advanced CV policies or evaluating spatial resolution, cost, recording-site mapping, and convergence. |
371
+ | `references/multicompartment/probe-reference.md` | Selecting voltage, mechanism State, or current, checking sampling schedules and result rows, or migrating legacy probes. |
372
+ | `references/multicompartment/network-workflow.md` | Delivering events to spatially placed synapses, registering populations, or running and resetting connected cells. |
385
373
  | `references/multicompartment/topology-building-and-visualization.md` | Inspecting and visualizing morphology, branch, CV, node, region, locset, or runtime topology. |
386
374
  | `references/ion-library.md` | Choosing fixed, Nernst, or dynamic ion declarations and concentration behavior. |
387
375
  | `references/channel-library.md` | Choosing registered sodium, potassium, calcium, leak, HCN, or mixed-ion density channels. |
@@ -0,0 +1,49 @@
1
+ # Connect detailed cells
2
+
3
+ Use `braincell.Network` when sources must deliver events to synapses placed at explicit locations on detailed cells. The network owns registration, connection pairing, event delivery, integration time, and population-keyed outputs.
4
+
5
+ | API | Description |
6
+ |---|---|
7
+ | `cell.place(locset, braincell.mech.Synapse(...))` | Declare a named synapse on the detailed cell before network initialization. |
8
+ | `network.add_population(name, model)` | Register each declaring cell or event source. Keep the population handles for connections. |
9
+ | `network.connect(name, source=..., synapse=..., weight=..., delay=...)` | Connect a source to selected synapse endpoints. Check the resolved pairs and attach physical units appropriate to the synapse and the delay. |
10
+ | `network.run(dt=..., duration=...)` | Initialize the network on first use and advance all registered populations on one clock. Read regular samples and sparse events from their separate result mappings. |
11
+
12
+ ```python
13
+ import braincell
14
+ import brainunit as u
15
+ from braincell.filter import AllRegion, RootLocation
16
+
17
+ branch = braincell.Branch.from_lengths(
18
+ lengths=[20.0] * u.um, radii=[5.0, 5.0] * u.um,
19
+ )
20
+ cell = braincell.Cell(braincell.Morphology.from_root(branch), pop_size=2)
21
+ cell.paint(
22
+ AllRegion(), braincell.mech.Channel("IL", g_max=0.1 * u.mS / u.cm**2, E=-65.0 * u.mV),
23
+ )
24
+ midpoint = RootLocation(0.5)
25
+ cell.place(midpoint, braincell.mech.Synapse("ExpSyn", name="ampa", tau=2.0 * u.ms))
26
+ cell.loc(midpoint).record("v", braincell.observe.state("v"))
27
+
28
+ network = braincell.Network("demo", seed=7)
29
+ source = network.add_population("drive", braincell.NetStim(size=2, start=0.1 * u.ms))
30
+ target = network.add_population("post", cell)
31
+ edges = network.connect(
32
+ "input", source=source, synapse=target.synapses["ampa"], weight=0.001 * u.uS,
33
+ )
34
+ assert len(edges) == 2
35
+
36
+ result = network.run(dt=0.025 * u.ms, duration=0.5 * u.ms)
37
+ assert result.samples["post"]["v"].values.shape == (20, 2)
38
+ assert result.events["drive"]["spike"].source_id.shape == (2,)
39
+ ```
40
+
41
+ After registration, use `network.run()` to advance time and `network.init_state()` for explicit initialization. Calls to `cell.run()`, `cell.init_state()`, `cell.reset_state()`, or `cell.reset()` on a network-managed cell raise `RuntimeError`.
42
+
43
+ Check connection views before the first run. Initialization can invalidate them, so select a fresh view for later inspection. Before a large run, check the resolved source and target indices, synapse placement, delay and weight units, and one small event-delivery response.
44
+
45
+ Use `network.reset_state()` to replay from the initial State with the same scheduled input. A noisy `NetStim` replays the same event times after this reset. For independent noisy inputs, build a fresh network and source per trial with a distinct recorded `NetStim(seed=...)`. Keep the network seed and connection declarations fixed when the study varies input noise with matched wiring.
46
+
47
+ - [BrainCell 0.2.0 Network API and minimal example](https://github.com/chaobrain/braincell/blob/v0.2.0/docs/design/network/current/api.md)
48
+ - [BrainCell 0.2.0 event sources and seeds](https://github.com/chaobrain/braincell/blob/v0.2.0/docs/design/network/current/connections.md)
49
+ - [BrainCell 0.2.0 network examples](https://github.com/chaobrain/braincell/tree/v0.2.0/examples/network)
@@ -1,128 +1,40 @@
1
- # Probe reference
1
+ # Record cell observables
2
2
 
3
- Use this reference after opening `references/multicompartment/multicompartment-cell-workflow.md` when a multicompartment `Cell` must record membrane voltage, mechanism or ion State, or membrane current, or when a probe produces a missing or unexpected trace.
3
+ Open this reference when a multicompartment workflow needs a sample schedule, a mechanism or current readout, or migration from legacy probes. A recording binds a spatial selection and an observable to one named result block.
4
4
 
5
- ## Choose the observed value
5
+ ## Choose the observation
6
6
 
7
- Probes are point declarations that read State or current already owned by the initialized runtime; they do not allocate evolving State of their own.
8
-
9
- | API | Use when | Important behavior and result |
10
- |---|---|---|
11
- | `StateProbe(name=None, field="v")` | Record cell-owned membrane voltage at a locset. | The current multicompartment implementation supports only `field="v"` and produces one voltage probe per resolved point. |
12
- | `MechanismProbe(mechanism, field, name=None)` | Record a runtime `brainstate.State` field owned by a named channel or ion. | Use for gate variables such as `Na_HH1952.p` or dynamic ion State such as `ca_dyn.Ci`; static parameters and derived properties are not probeable fields. |
13
- | `CurrentProbe(ion=None, mechanism=None, name=None)` | Record one mechanism current or the total current owned by one ion. | Set `mechanism` for a mechanism current, `ion` for an ion total, or both to select a mechanism under a named ion. |
14
- | `cell.place(locset, *probes)` | Attach probes to concrete morphology locations before initialization. | A locset resolving to several points creates one resolved probe at each point. |
15
- | `cell.sample_probe(name)` | Read one placed probe after `init_state()`. | It returns the current snapshot for the exact resolved probe name. |
16
- | `cell.sample_probes()` | Read every placed probe after `init_state()`. | It returns `{probe_name: current_value}`. |
17
- | `cell.run(dt=..., duration=...)` | Record the same probes at every integration step. | It returns `RunResult(time=..., traces=...)`, where `traces` is keyed by resolved probe name. |
18
-
19
- Use `StateProbe` for cell voltage. Use `MechanismProbe` only for stored runtime State. Use `CurrentProbe` when the requested observable is computed current rather than stored State.
20
-
21
- ## Place and read probes
7
+ | API | Description |
8
+ |---|---|
9
+ | `cell.loc(locset).record(name, observable, period=...)` | Register a unique name before initialization. Use a locset for spatial sampling or call `record()` on another cell view to keep its existing population and CV selection. |
10
+ | `braincell.observe.state("v")` | Record membrane voltage at the selected CVs. |
11
+ | `braincell.observe.channel(name=...).state(field)` | Record a stored channel State such as a gate. Match the declared name and choose a view where the channel is present. |
12
+ | `braincell.observe.ion(species=...).current()` | Record the total current for the selected ion species. Use a named channel's `current()` for a specific contributor. |
13
+ | `braincell.observe.membrane_current()` | Record total membrane current density at the selected CVs. |
22
14
 
23
- Place probes with the mechanisms they observe, initialize once, inspect snapshot keys, then use the same declarations for time-series recording.
15
+ Choose `period` or `frequency`, or omit both to sample every integration step. The resolved period and `start` must align with `dt`. Use the block's own time axis for plotting and its schema to identify the result columns.
24
16
 
25
17
  ```python
26
- import braincell
27
- import braincell.mech as mech
28
- import brainunit as u
29
- from braincell.filter import AllRegion, at
30
-
31
-
32
- morphology = braincell.Morphology.from_swc("neuron.swc")
33
- cell = braincell.Cell(morphology, solver="staggered")
34
-
35
- cell.paint(
36
- AllRegion(),
37
- mech.Channel(
38
- "IL",
39
- g_max=0.03 * u.mS / u.cm**2,
40
- E=-54.387 * u.mV,
41
- ),
42
- mech.Channel(
43
- "Na_HH1952",
44
- g_max=120.0 * u.mS / u.cm**2,
45
- ),
18
+ # Reuse the declaring Cell and RootLocation from the multicompartment workflow.
19
+ cell.loc(RootLocation(0.5)).record(
20
+ "voltage_2kHz", braincell.observe.state("v"), frequency=2.0 * u.kHz,
46
21
  )
47
- cell.place(
48
- at("soma", 0.5),
49
- mech.StateProbe(),
50
- mech.MechanismProbe(mechanism="Na_HH1952", field="p"),
51
- mech.CurrentProbe(mechanism="IL"),
52
- )
53
-
54
- cell.init_state()
55
- samples = cell.sample_probes()
56
-
57
- assert "soma(0.5)_v" in samples
58
- assert "soma(0.5)_Na_HH1952_p" in samples
59
- assert "soma(0.5)_IL_current" in samples
60
-
61
- result = cell.run(dt=0.05 * u.ms, duration=12.0 * u.ms)
62
- assert result.traces["soma(0.5)_v"].shape[0] == result.time.shape[0]
22
+ result = cell.run(dt=0.1 * u.ms, duration=10.0 * u.ms)
23
+ block = result.samples["voltage_2kHz"]
24
+ assert block.values.shape == (20, 1)
25
+ assert block.time.shape == (20,)
26
+ assert len(block.schema.rows) == 1
63
27
  ```
64
28
 
65
- Declare probes before `init_state()`. Call `reset()` before adding or changing a probe on an initialized cell; `reset_state()` only reseeds the existing runtime and does not reopen declaration.
66
-
67
- ## Predict probe names
68
-
69
- When `name` is omitted, the lowerer combines the resolved location with the observed target.
70
-
71
- | Probe declaration | Generated key pattern | Documented example |
72
- |---|---|---|
73
- | `StateProbe()` | `<location>_v` | `soma(0.5)_v` |
74
- | `MechanismProbe(mechanism=M, field=F)` | `<location>_<M>_<F>` | `soma(0.5)_Na_HH1952_p` |
75
- | `CurrentProbe(mechanism=M)` | `<location>_<M>_current` | `soma(0.5)_IL_current` |
76
- | `CurrentProbe(ion=I)` | `<location>_<I>_current` | `soma(0.5)_na_current` |
77
-
78
- Use `sorted(cell.sample_probes())` after initialization to discover the actual keys instead of reconstructing them from memory. If `name=...` is supplied, keep it globally unique; duplicate names make snapshot and run results ambiguous.
79
-
80
- A multi-point locset expands into separate concrete names. For example, `RootLocation(0.5) | Terminals()` creates one voltage key for the root midpoint and one for each terminal selected by the morphology.
81
-
82
- ## Probe mechanism and ion State
83
-
84
- `MechanismProbe` resolves a named runtime owner, then reads one field that is stored as `brainstate.State`.
85
-
86
- | Request | Use | Do not use |
87
- |---|---|---|
88
- | Channel gate | `MechanismProbe(mechanism="Na_HH1952", field="p")` | A parameter such as `g_max`; it is not evolving State. |
89
- | Dynamic ion concentration | `MechanismProbe(mechanism="ca_dyn", field="Ci")` | A derived Nernst property such as `E` when it is computed rather than stored. |
90
- | Cell voltage | `StateProbe(field="v")` | `MechanismProbe` without a mechanism owner. |
91
-
92
- The mechanism or ion must exist at the selected runtime point. A valid field on a mechanism painted elsewhere is still invalid at the probe location.
93
-
94
- ## Probe current ownership
95
-
96
- Choose between one mechanism current and an ion owner's total current:
97
-
98
- | Request | Probe |
99
- |---|---|
100
- | One ion-bound mechanism | `CurrentProbe(ion="na", mechanism="Na_HH1952")` |
101
- | One mechanism that can evaluate current without an explicit ion selector | `CurrentProbe(mechanism="IL")` |
102
- | Sum of currents owned by an ion | `CurrentProbe(ion="na")` |
103
-
104
- An ion total may equal a mechanism current when that ion owns only one channel. Do not rely on that equality: adding another channel changes the ion total but not the individual mechanism trace.
105
-
106
- For mixed-ion channels, distinguish the current owner from ions that only modulate gating. Use `CurrentProbe(mechanism=...)` for the channel's own current and `CurrentProbe(ion=...)` for the owning ion's aggregate current.
107
-
108
- ## Diagnose missing or wrong traces
29
+ Use `result.samples[population_name][recording_name]` for a `Network` result. Open `references/multicompartment/network-workflow.md` for population registration and sparse events.
109
30
 
110
- Check failures in declaration-to-runtime order:
31
+ ## Diagnose missing or misaligned samples
111
32
 
112
- 1. Confirm that the probe was placed before `init_state()` and that `run()` has at least one placed probe.
113
- 2. Resolve the locset with `morphology.select(locset)` and inspect its `points` and `display_names`.
114
- 3. Inspect `sorted(cell.sample_probes())`; do not guess the trace key.
115
- 4. Confirm that the named mechanism or ion is painted at the resolved point.
116
- 5. For `MechanismProbe`, confirm that the field is stored runtime State rather than a parameter or derived property.
117
- 6. For `CurrentProbe`, confirm whether the request means one mechanism current or an ion-owner total.
118
- 7. Check explicit names for global uniqueness and multi-point locsets for automatic expansion.
119
- 8. Compare `result.time.shape[0]` with every requested trace length after `run()`.
33
+ Check the recording name and declaration phase, then inspect the selected cells and CVs, the observed mechanism at those sites, and the time window. Read the block's schema before comparing positions across CV policies. For a layout mismatch, open `references/multicompartment/topology-building-and-visualization.md`.
120
34
 
121
- Open `references/multicompartment/topology-building-and-visualization.md` when the locset-to-CV mapping or runtime placement remains uncertain.
35
+ ## Migrate legacy probes
122
36
 
123
- ## Sources
37
+ BrainCell 0.2.0 retains `StateProbe`, `MechanismProbe`, and `CurrentProbe` for existing declarations. Read their values by resolved key from `sample_probes()` after initialization or `RunResult.traces` after a run. For new recordings, give each view and observable an explicit name. Compare resolved sample locations, units, and time axes before treating a legacy point probe and a CV recording as equivalent.
124
38
 
125
- - [Mechanisms in BrainCell](https://brainx.chaobrain.com/braincell/tutorials/mech.html)
126
- - [StateProbe API](https://brainx.chaobrain.com/braincell/apis/generated/braincell.mech.StateProbe.html)
127
- - [MechanismProbe API](https://brainx.chaobrain.com/braincell/apis/generated/braincell.mech.MechanismProbe.html)
128
- - [CurrentProbe API](https://brainx.chaobrain.com/braincell/apis/generated/braincell.mech.CurrentProbe.html)
39
+ - [BrainCell 0.2.0 recording API](https://github.com/chaobrain/braincell/blob/v0.2.0/docs/design/network/current/recording.md)
40
+ - [BrainCell 0.2.0 recording examples](https://github.com/chaobrain/braincell/blob/v0.2.0/examples/cell/recording.ipynb)
@@ -1,6 +1,6 @@
1
1
  # Topology building and visualization
2
2
 
3
- Use this reference after `references/multicompartment/multicompartment-cell-workflow.md` when branch topology, CV coverage, runtime nodes, selector placement, or spatial values must be visualized. Keep morphology construction and validation, selector design, CV-policy choice, probe behavior, and simulation in their owning references.
3
+ Use this reference after `references/multicompartment/multicompartment-cell-workflow.md` when branch topology, CV coverage, runtime nodes, selector placement, or spatial values must be visualized. Keep morphology construction and validation, selector design, CV-policy choice, recording behavior, and simulation in their owning references.
4
4
 
5
5
  ## Choose the view
6
6
 
@@ -10,21 +10,21 @@ Morphology branches, CVs, and runtime nodes are different layers of one cell; vi
10
10
  |---|---|---|
11
11
  | `morphology.topo()` | Check the named parent-child branch tree before discretization. | It does not show CVs or runtime nodes. |
12
12
  | `morphology.select(expr)` | Confirm region intervals or locset points before plotting. | Use the filter reference when the selection itself is wrong. |
13
- | `cell.vis_branch(...)` | Inspect compact branch topology or region coverage. | It supports regions, not locsets or values. |
14
- | `cell.vis_cv(...)` | Inspect discretization, region coverage, locset ownership, or CV values. | Region/locset highlight mode is exclusive with value mode. |
15
- | `cell.vis_node(...)` | Inspect the full runtime point graph, lowered placement, or point values. | Call `cell.init_state()` first. |
16
- | `cell.vis_topology(level=...)` | Dispatch dynamically among `"branch"`, `"cv"`, and `"node"`. | Branch level rejects locset and value arguments. |
13
+ | `braincell.vis.plot_cell_topology(cell, level="branch", ...)` | Inspect compact branch topology or region coverage. | Supports region highlights. |
14
+ | `braincell.vis.plot_cell_topology(cell, level="cv", ...)` | Inspect discretization, region coverage, locset ownership, or CV values. | Initialize before reading runtime values. |
15
+ | `braincell.vis.plot_cell_topology(cell, level="node", ...)` | Inspect the runtime point graph, lowered placement, or point values. | Initialize before rendering runtime nodes. |
17
16
  | `braincell.vis.plot2d()` / `plot3d()` | Inspect physical morphology geometry. | Use these instead of topology layouts when length, radius, or 3D position matters. |
18
17
 
19
18
  The morphology defines continuous cable, the CV policy defines isopotential intervals, and `init_state()` lowers them into the execution-oriented `NodeTree`. Do not equate morphology points, branches, CVs, and runtime nodes.
20
19
 
21
20
  ## Prepare the visualization context
22
21
 
23
- Reuse the validated morphology, selectors, CV policy, and declarations from the multicompartment workflow. This minimal setup exists only to make the visualization snippets executable.
22
+ Supply a validated `neuron.swc` with a soma and dendrite and use an environment with Matplotlib and NetworkX, available with the BrainCell `vis` extra. Graphviz layouts require PyGraphviz. When a Graphviz layout is unavailable, the plot warns and falls back to `kamada_kawai`. Choose `layout="kamada_kawai"` directly when only NetworkX is available.
24
23
 
25
24
  ```python
26
25
  import braincell
27
26
  import braincell.mech as mech
27
+ import braincell.vis as vis
28
28
  import brainunit as u
29
29
  import matplotlib.pyplot as plt
30
30
  from braincell.filter import AllRegion, RootLocation, Terminals, branch_in
@@ -67,39 +67,43 @@ Render one selection across structural levels, then show a locset at runtime lev
67
67
  ```python
68
68
  fig, axes = plt.subplots(2, 2, figsize=(10, 9), dpi=140)
69
69
 
70
- cell.vis_branch(
70
+ vis.plot_cell_topology(
71
+ cell,
72
+ level="branch",
71
73
  region=target_region,
72
74
  coverage_mode="fraction",
73
75
  layout="dot",
74
76
  ax=axes[0, 0],
75
- show=False,
76
77
  )
77
78
  axes[0, 0].set_title("Branch region")
78
79
 
79
- cell.vis_cv(
80
+ vis.plot_cell_topology(
81
+ cell,
82
+ level="cv",
80
83
  region=target_region,
81
84
  coverage_mode="fraction",
82
85
  layout="dot",
83
86
  ax=axes[0, 1],
84
- show=False,
85
87
  )
86
88
  axes[0, 1].set_title(f"CV region: n={cell.n_cv}")
87
89
 
88
- cell.vis_node(
90
+ vis.plot_cell_topology(
91
+ cell,
92
+ level="node",
89
93
  region=target_region,
90
94
  coverage_mode="fraction",
91
95
  layout="dot",
92
96
  ax=axes[1, 0],
93
- show=False,
94
97
  )
95
98
  axes[1, 0].set_title("Runtime region")
96
99
 
97
- cell.vis_node(
100
+ vis.plot_cell_topology(
101
+ cell,
102
+ level="node",
98
103
  locset=target_sites,
99
104
  highlight_color="#f97316",
100
105
  layout="dot",
101
106
  ax=axes[1, 1],
102
- show=False,
103
107
  )
104
108
  axes[1, 1].set_title("Runtime locset")
105
109
 
@@ -116,25 +120,28 @@ Hold the initialized cell and data fixed while choosing the layout that makes to
116
120
  ```python
117
121
  fig, axes = plt.subplots(1, 3, figsize=(13, 4), dpi=140)
118
122
 
119
- cell.vis_node(
123
+ vis.plot_cell_topology(
124
+ cell,
125
+ level="node",
120
126
  preset="dendrotweaks",
121
127
  ax=axes[0],
122
- show=False,
123
128
  )
124
129
  axes[0].set_title("dendrotweaks")
125
130
 
126
- cell.vis_node(
131
+ vis.plot_cell_topology(
132
+ cell,
133
+ level="node",
127
134
  layout="dot",
128
135
  ax=axes[1],
129
- show=False,
130
136
  )
131
137
  axes[1].set_title("dot")
132
138
 
133
- cell.vis_node(
139
+ vis.plot_cell_topology(
140
+ cell,
141
+ level="node",
134
142
  layout="kamada_kawai",
135
143
  layout_scale=1.5,
136
144
  ax=axes[2],
137
- show=False,
138
145
  )
139
146
  axes[2].set_title("kamada_kawai")
140
147
 
@@ -153,23 +160,25 @@ Use value mode on an initialized or already simulated cell. Named selectors avoi
153
160
  ```python
154
161
  fig, axes = plt.subplots(1, 2, figsize=(10, 4), dpi=140)
155
162
 
156
- cell.vis_node(
163
+ vis.plot_cell_topology(
164
+ cell,
165
+ level="node",
157
166
  value="V",
158
167
  cmap="viridis",
159
168
  vmin=-80.0,
160
169
  vmax=-40.0,
161
170
  value_label="Voltage",
162
171
  ax=axes[0],
163
- show=False,
164
172
  )
165
173
  axes[0].set_title("Membrane voltage")
166
174
 
167
- cell.vis_node(
175
+ vis.plot_cell_topology(
176
+ cell,
177
+ level="node",
168
178
  value=("channel", "IL", "g_max"),
169
179
  cmap="magma",
170
180
  value_label="IL g_max",
171
181
  ax=axes[1],
172
- show=False,
173
182
  )
174
183
  axes[1].set_title("Leak conductance")
175
184
 
@@ -212,18 +221,19 @@ assert depth.shape == (len(cell.node_tree.nodes),)
212
221
  assert not np.isnan(depth).any()
213
222
 
214
223
  fig, ax = plt.subplots(figsize=(7, 7), dpi=140)
215
- cell.vis_node(
224
+ vis.plot_cell_topology(
225
+ cell,
226
+ level="node",
216
227
  value=depth,
217
228
  cmap="magma",
218
229
  value_label="Runtime graph depth",
219
230
  ax=ax,
220
- show=False,
221
231
  )
222
232
  fig.tight_layout()
223
233
  plt.show()
224
234
  ```
225
235
 
226
- A point-space array must have length `n_point`. A CV-space array must have length `n_cv`; `vis_node()` scatters it into point space. Other shapes raise `ValueError`.
236
+ Pass one population member as a one-dimensional array of length `n_point` or `n_cv`. In node mode the function scatters CV values into point space. Named runtime selectors handle a singleton population directly.
227
237
 
228
238
  ## Lookup
229
239
 
@@ -248,12 +258,14 @@ A point-space array must have length `n_point`. A CV-space array must have lengt
248
258
  | `cmap`, `vmin`, `vmax`, `norm` | Control value normalization. |
249
259
  | `value_label`, `show_colorbar` | Control the colorbar. |
250
260
  | `node_color`, `edge_color`, `root_color` | Style topology without entering value mode. |
251
- | `ax=...`, `show=False` | Compose subplots; call `plt.show()` or `fig.savefig(...)` once afterward. |
261
+ | `ax=...` | Compose subplots; call `plt.show()` or `fig.savefig(...)` once afterward. |
252
262
 
253
263
  Highlight mode and value mode are mutually exclusive. Fix selectors in `filter-function-library.md`, discretization in `cv-policy-reference.md`, morphology geometry in the IO or manual-construction reference, and recorded-trace mismatches in `probe-reference.md`.
254
264
 
255
265
  ## Sources
256
266
 
267
+ - [Cell topology API](https://brainx.chaobrain.com/braincell/apis/vis.html#cell-topology-plots)
268
+ - [BrainCell 0.2.0 migration](https://github.com/chaobrain/braincell/releases/tag/v0.2.0)
257
269
  - [Point tree visualization](https://brainx.chaobrain.com/braincell/tutorials/vis.html)
258
270
  - [Region and locset filters](https://brainx.chaobrain.com/braincell/tutorials/filter.html)
259
271
  - [Morphology](https://brainx.chaobrain.com/braincell/concepts/morphology.html)