brainx-skill 1.0.15 → 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.
- package/README.md +17 -1
- package/manifest.json +1 -1
- package/mcp-servers/codex/skills.json +1 -1
- package/package.json +1 -1
- package/skills/bio-neuro-lit/SKILL.md +4 -2
- package/skills/bio-neuro-lit/references/required-supplements.md +27 -0
- package/skills/brainx-acceleration/SKILL.md +30 -437
- package/skills/brainx-acceleration/references/audit-and-rewrite-patterns.md +326 -0
- package/skills/brainx-general-guard/SKILL.md +24 -8
- package/skills/brainx-install/SKILL.md +3 -3
- package/skills/brainx-install/references/compatibility-and-release-matching.md +28 -20
- package/skills/brainx-install/references/uninstall-and-cleanup.md +11 -4
- package/skills/brainx-modeling-loop/SKILL.md +117 -36
- package/skills/brainx-modeling-loop/agents/openai.yaml +2 -2
- package/skills/brainx-modeling-loop/references/mechanism-comparison.md +62 -0
- package/skills/brainx-modeling-loop/references/multiscale-coupling.md +16 -0
- package/skills/brainx-modeling-loop/references/paper-reproduction.md +42 -0
- package/skills/brainx-modeling-loop/references/parameter-fitting-workflow.md +14 -14
- package/skills/brainx-modeling-loop/references/run-experiment.md +1 -1
- package/skills/brainx-modeling-loop/references/training-workflow.md +10 -8
- package/skills/brainx-visualization/SKILL.md +6 -2
- package/skills/brainx-visualization/references/neural-data-visualization.md +1 -1
- package/skills/brainx-visualization/references/statistical-and-model-visualization.md +1 -1
- package/skills/package-skills/braincell/SKILL.md +23 -14
- package/skills/package-skills/braincell/references/braintools/input-current.md +1 -1
- package/skills/package-skills/braincell/references/braintools/metric.md +72 -46
- package/skills/package-skills/braincell/references/mixions-for-adaptation.md +1 -1
- package/skills/package-skills/braincell/references/multicompartment/braincell-manual-morphology-construction.md +1 -1
- package/skills/package-skills/braincell/references/multicompartment/cv-policy-reference.md +1 -1
- package/skills/package-skills/braincell/references/multicompartment/filter-function-library.md +3 -3
- package/skills/package-skills/braincell/references/multicompartment/morphology-io-loading-validation.md +1 -1
- package/skills/package-skills/braincell/references/multicompartment/multicompartment-cell-workflow.md +31 -43
- package/skills/package-skills/braincell/references/multicompartment/network-workflow.md +49 -0
- package/skills/package-skills/braincell/references/multicompartment/probe-reference.md +26 -114
- package/skills/package-skills/braincell/references/multicompartment/topology-building-and-visualization.md +40 -28
- package/skills/package-skills/braincell/references/scripts/cell_multicompartment_reference.py +13 -17
- package/skills/package-skills/brainevent/SKILL.md +0 -3
- package/skills/package-skills/brainevent/references/synaptic-plasticity.md +1 -1
- package/skills/package-skills/brainmass/SKILL.md +5 -3
- package/skills/package-skills/brainmass/references/brainstate/parameter-constraints-regularization.md +9 -7
- package/skills/package-skills/brainmass/references/brainstate/parameter-transforms-regularizers-catalog.md +4 -4
- package/skills/package-skills/brainmass/references/braintools/data-preprocessing.md +15 -7
- package/skills/package-skills/brainmass/references/braintools/metric.md +72 -46
- package/skills/package-skills/brainmass/references/coupling-network-api.md +3 -1
- package/skills/package-skills/brainmass/references/fitting-with-objectives-api.md +6 -6
- package/skills/package-skills/brainmass/references/horn-task-training.md +9 -9
- package/skills/package-skills/brainmass/references/modellibrary.md +12 -10
- package/skills/package-skills/brainmass/references/scripts/resting-state-meg-whole-brain-pipeline.py +5 -3
- package/skills/package-skills/brainmass/references/scripts/wilson-cowan-ei-dynamics.py +10 -6
- package/skills/package-skills/brainmass/references/simulator-input-monitor-api.md +3 -1
- package/skills/package-skills/brainmass/references/visualization-analysis-api.md +17 -9
- package/skills/package-skills/brainspike/SKILL.md +201 -0
- package/skills/package-skills/brainspike/references/braintools/connectivity.md +40 -0
- package/skills/package-skills/brainspike/references/braintools/data-preprocessing.md +39 -0
- package/skills/package-skills/brainspike/references/braintools/input-current.md +55 -0
- package/skills/package-skills/brainspike/references/braintools/metric.md +36 -0
- package/skills/package-skills/brainspike/references/braintools/optimizer.md +50 -0
- package/skills/package-skills/brainspike/references/braintools/parameter-initializer.md +43 -0
- package/skills/package-skills/brainspike/references/braintools/surrogate.md +40 -0
- package/skills/package-skills/brainspike/references/migration-boundary.md +38 -0
- package/skills/package-skills/brainspike/references/model-and-readout-selection.md +41 -0
- package/skills/package-skills/brainspike/references/multirate-coupling.md +31 -0
- package/skills/package-skills/brainspike/references/multiscale-composition.md +28 -0
- package/skills/package-skills/brainspike/references/native-composition.md +52 -0
- package/skills/package-skills/brainspike/references/native-delays.md +34 -0
- package/skills/package-skills/brainspike/references/native-projections.md +43 -0
- package/skills/package-skills/brainspike/references/native-training.md +36 -0
- package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/devices.md +33 -33
- package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/divergence-and-parity.md +15 -15
- package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/integration-categories.md +1 -1
- package/skills/package-skills/brainspike/references/nest-compatible/model-library.md +200 -0
- package/skills/package-skills/brainspike/references/nest-compatible/network-building.md +276 -0
- package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/scripts/brette_et_al_2007.py +23 -26
- package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/scripts/brunel_alpha.py +18 -21
- package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/scripts/brunel_delta.py +16 -19
- package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/scripts/clopath_synapse_spike_pairing.py +11 -12
- package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/scripts/evaluate_tsodyks2_synapse.py +10 -11
- package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/scripts/spatial_gaussex.py +18 -18
- package/skills/package-skills/{brainpy-state → brainspike}/references/nest-compatible/scripts/synapsecollection.py +26 -29
- package/skills/package-skills/brainspike/references/nest-compatible/synapse-and-connectivity.md +166 -0
- package/skills/package-skills/brainspike/references/nest-delay-boundaries.md +31 -0
- package/skills/package-skills/brainspike/references/nonlinear-state-sharing.md +26 -0
- package/skills/package-skills/{brainpy-state → brainspike}/references/perturbation-experiment-validity.md +2 -2
- package/skills/package-skills/brainspike/references/simulator-training.md +61 -0
- package/skills/package-skills/brainspike/references/temporal-task-training.md +36 -0
- package/skills/package-skills/brainspike/scripts/advanced_native_patterns.py +76 -0
- package/skills/package-skills/brainspike/scripts/delay_workflow.py +44 -0
- package/skills/package-skills/brainspike/scripts/delayed_cue_training.py +78 -0
- package/skills/package-skills/brainspike/scripts/lif_smoke.py +31 -0
- package/skills/package-skills/brainspike/scripts/multiscale_workflow.py +35 -0
- package/skills/package-skills/brainspike/scripts/native_ei_network.py +47 -0
- package/skills/package-skills/brainspike/scripts/native_workflows.py +77 -0
- package/skills/package-skills/brainspike/scripts/nest_boundary_workflows.py +108 -0
- package/skills/package-skills/brainspike/scripts/train_native_snn.py +65 -0
- package/skills/package-skills/brainspike/scripts/train_nest_simulator.py +69 -0
- package/skills/package-skills/brainspike/scripts/train_nest_simulator_two_weights.py +220 -0
- package/skills/package-skills/brainstate/SKILL.md +16 -21
- package/skills/package-skills/brainstate/references/brainstate/brainstate-control-flow-patterns.md +1 -138
- package/skills/package-skills/brainstate/references/brainstate/brainstate-transformed-diagnostics.md +1 -1
- package/skills/package-skills/brainstate/references/brainstate/delay-buffers.md +45 -0
- package/skills/package-skills/brainstate/references/brainstate/parameter-constraints-regularization.md +9 -7
- package/skills/package-skills/brainstate/references/brainstate/parameter-transforms-regularizers-catalog.md +4 -4
- package/skills/package-skills/brainstate/references/brainstate/randomness-and-reproducibility.md +6 -4
- package/skills/package-skills/brainstate/references/brainstate/transformation-grad-expansion.md +4 -4
- package/skills/package-skills/brainstate/references/brainstate/transformation-vmap-expansion.md +1 -1
- package/skills/package-skills/brainstate/references/braintools-optimizer-reference.md +16 -0
- package/skills/package-skills/brainstate/references/libraries/prebuilt-layer-library.md +1 -1
- package/skills/package-skills/brainstate/references/simulation-environment.md +5 -5
- package/skills/package-skills/braintrace/SKILL.md +17 -38
- package/skills/package-skills/braintrace/references/Drtrl.md +9 -26
- package/skills/package-skills/braintrace/references/algorithm selection.md +7 -12
- package/skills/package-skills/braintrace/references/batching.md +15 -35
- package/skills/package-skills/braintrace/references/compiler_internal.md +1 -1
- package/skills/package-skills/braintrace/references/custom algorithms.md +1 -2
- package/skills/package-skills/braintrace/references/customizing_primitive_transforms.md +26 -15
- package/skills/package-skills/braintrace/references/pp_pprop workflow.md +5 -139
- package/skills/package-skills/brainunit/SKILL.md +7 -2
- package/skills/package-skills/brainunit/references/array-mechanics/functional-structural-api.md +1 -1
- package/skills/package-skills/brainunit/references/math-function-library.md +2 -2
- package/skills/package-skills/brainunit/references/typing-and-runtime-validation.md +5 -2
- package/skills/package-skills/brainevent/references/scripts/102_EI_net_1996.py +0 -107
- package/skills/package-skills/brainevent/references/scripts/204_joglekar_2018_propagation.py +0 -168
- package/skills/package-skills/brainevent/references/scripts/coba_ei_teaching.py +0 -356
- package/skills/package-skills/brainpy-state/SKILL.md +0 -247
- package/skills/package-skills/brainpy-state/references/array-creation.md +0 -158
- package/skills/package-skills/brainpy-state/references/brain-dynamics-delay-protocol.md +0 -147
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/analysis.md +0 -150
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/brainpy legacy workflow.md +0 -373
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/built-in dynamic neuron model.md +0 -150
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/connecting neurons.md +0 -175
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/customize neuron and synpase.md +0 -286
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/infrastructure/Input generation.md +0 -111
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/infrastructure/More about simulation.md +0 -163
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/infrastructure/Multi-device array sharding.md +0 -113
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/infrastructure/Parallel experiment execution.md +0 -136
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/infrastructure/array creation and mechanics.md +0 -222
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/infrastructure/brainpy math environment setting.md +0 -123
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/infrastructure/delays.md +0 -107
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/infrastructure/object oriented transformations and control flows.md +0 -185
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/integrators.md +0 -181
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/route activity through connectivity.md +0 -102
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/synaptic projections.md +0 -147
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/synpase properties.md +0 -159
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/training/loss library.md +0 -127
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/training/optimizers.md +0 -167
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/training/parameter initializers.md +0 -107
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/training/prebuilt neural network layers.md +0 -186
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/training/surrogate gradients.md +0 -104
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/training/trainer library.md +0 -89
- package/skills/package-skills/brainpy-state/references/brainPy(legacy)/training/trainingworkflows.md +0 -253
- package/skills/package-skills/brainpy-state/references/braintools/brainstate-control-flow-patterns.md +0 -334
- package/skills/package-skills/brainpy-state/references/braintools/connectivity.md +0 -206
- package/skills/package-skills/brainpy-state/references/braintools/data-preprocessing.md +0 -79
- package/skills/package-skills/brainpy-state/references/braintools/input-current.md +0 -199
- package/skills/package-skills/brainpy-state/references/braintools/metric.md +0 -152
- package/skills/package-skills/brainpy-state/references/braintools/optimizer.md +0 -179
- package/skills/package-skills/brainpy-state/references/braintools/parameter-initializer.md +0 -183
- package/skills/package-skills/brainpy-state/references/braintools/surrogate.md +0 -147
- package/skills/package-skills/brainpy-state/references/component-selection.md +0 -288
- package/skills/package-skills/brainpy-state/references/nest-compatible/model-library.md +0 -200
- package/skills/package-skills/brainpy-state/references/nest-compatible/nest-workflow.md +0 -156
- package/skills/package-skills/brainpy-state/references/nest-compatible/network-building.md +0 -264
- package/skills/package-skills/brainpy-state/references/nest-compatible/synapse-and-connectivity.md +0 -153
- package/skills/package-skills/brainpy-state/references/projection-patterns.md +0 -127
- package/skills/package-skills/brainpy-state/references/scripts/103_COBA_2005.py +0 -86
- package/skills/package-skills/brainpy-state/references/scripts/106_COBA_HH_2007.py +0 -181
- package/skills/package-skills/brainpy-state/references/scripts/107_gamma_oscillation_1996.py +0 -156
- package/skills/package-skills/brainpy-state/references/scripts/109_fast_global_oscillation.py +0 -111
- package/skills/package-skills/brainpy-state/references/scripts/201_surrogate_grad_lif_fashion_mnist.py +0 -221
- package/skills/package-skills/brainpy-state/references/scripts/sound_localization.py +0 -240
- package/skills/package-skills/brainpy-state/references/scripts/training-snn.py +0 -119
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Model library
|
|
2
|
+
|
|
3
|
+
Use this reference when selecting a NEST-compatible neuron family, locating an exact `brainspike` model name, or recognizing the model-specific capability that changes construction or routing. Use upstream NEST documentation for equations, parameter meanings, physiology, and scientific references.
|
|
4
|
+
|
|
5
|
+
All constructor rows use the canonical `Simulator.create()` surface. Pass a reusable NEST-style parameter mapping with `params=parameters`, or replace it with explicit keyword parameters.
|
|
6
|
+
|
|
7
|
+
## Current-based IAF neurons
|
|
8
|
+
|
|
9
|
+
Use these models for linear integrate-and-fire dynamics driven by postsynaptic currents; choose delta, alpha, exponential, precise-spiking, or multisynapse behavior from the requested NEST model.
|
|
10
|
+
|
|
11
|
+
| Constructor | Use when |
|
|
12
|
+
|---|---|
|
|
13
|
+
| `sim.create(brainspike.iaf_psc_delta, size, params=parameters)` | Use delta-shaped input that produces an instantaneous membrane-voltage jump. |
|
|
14
|
+
| `sim.create(brainspike.iaf_psc_delta_ps, size, params=parameters)` | Use delta input with precise spike timing between grid points. |
|
|
15
|
+
| `sim.create(brainspike.iaf_psc_alpha, size, params=parameters)` | Use alpha-shaped excitatory and inhibitory current kernels. |
|
|
16
|
+
| `sim.create(brainspike.iaf_psc_alpha_multisynapse, size, params=parameters)` | Use alpha currents with multiple receptor ports or time constants. |
|
|
17
|
+
| `sim.create(brainspike.iaf_psc_alpha_ps, size, params=parameters)` | Use alpha currents with precise spike timing. |
|
|
18
|
+
| `sim.create(brainspike.iaf_psc_exp, size, params=parameters)` | Use exponential postsynaptic-current kernels. |
|
|
19
|
+
| `sim.create(brainspike.iaf_psc_exp_multisynapse, size, params=parameters)` | Use exponential currents with multiple receptor ports or time constants. |
|
|
20
|
+
| `sim.create(brainspike.iaf_psc_exp_htum, size, params=parameters)` | Use the NEST `iaf_psc_exp_htum` variant required by the model being ported. |
|
|
21
|
+
| `sim.create(brainspike.iaf_psc_exp_ps, size, params=parameters)` | Use exponential currents with precise spike timing. |
|
|
22
|
+
| `sim.create(brainspike.iaf_psc_exp_ps_lossless, size, params=parameters)` | Use exponential precise-spiking dynamics with lossless spike detection. |
|
|
23
|
+
|
|
24
|
+
**Invariant:** Use voltage weights such as `mV` for `iaf_psc_delta`; alpha and exponential current-event examples use current weights such as `pA`.
|
|
25
|
+
|
|
26
|
+
## Conductance-based IAF neurons
|
|
27
|
+
|
|
28
|
+
Use these models when synaptic input changes conductance rather than adding a postsynaptic current.
|
|
29
|
+
|
|
30
|
+
| Constructor | Use when |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `sim.create(brainspike.iaf_cond_alpha, size, params=parameters)` | Use alpha-shaped synaptic conductances. |
|
|
33
|
+
| `sim.create(brainspike.iaf_cond_alpha_mc, size, params=parameters)` | Use the multi-compartment alpha-conductance variant; check parity coverage before claiming NEST validation. |
|
|
34
|
+
| `sim.create(brainspike.iaf_cond_beta, size, params=parameters)` | Use beta-shaped synaptic conductances. |
|
|
35
|
+
| `sim.create(brainspike.iaf_cond_exp, size, params=parameters)` | Use exponential synaptic conductances. |
|
|
36
|
+
| `sim.create(brainspike.iaf_cond_exp_sfa_rr, size, params=parameters)` | Use exponential conductances with spike-frequency adaptation and relative refractory dynamics. |
|
|
37
|
+
|
|
38
|
+
## Specialized IAF neurons
|
|
39
|
+
|
|
40
|
+
Use these APIs only when the requested paper or source NEST model names the specialized variant.
|
|
41
|
+
|
|
42
|
+
| Constructor | Use when |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `sim.create(brainspike.iaf_bw_2001, size, params=parameters)` | Use the NEST-compatible `iaf_bw_2001` model. |
|
|
45
|
+
| `sim.create(brainspike.iaf_bw_2001_exact, size, params=parameters)` | Use the exact per-synapse NMDA form of `iaf_bw_2001`. |
|
|
46
|
+
| `sim.create(brainspike.iaf_chs_2007, size, params=parameters)` | Use the `iaf_chs_2007` spike-response model. |
|
|
47
|
+
| `sim.create(brainspike.iaf_chxk_2008, size, params=parameters)` | Use alpha synapses with the `iaf_chxk_2008` precise AHP timing. |
|
|
48
|
+
| `sim.create(brainspike.iaf_tum_2000, size, params=parameters)` | Use the `iaf_tum_2000` neuron required by the port. |
|
|
49
|
+
|
|
50
|
+
## Adaptive exponential IF neurons
|
|
51
|
+
|
|
52
|
+
Use these APIs for Brette-Gerstner adaptive exponential dynamics, selecting current versus conductance input and any required astrocyte, multisynapse, or Clopath interface.
|
|
53
|
+
|
|
54
|
+
| Constructor | Use when |
|
|
55
|
+
|---|---|
|
|
56
|
+
| `sim.create(brainspike.aeif_cond_alpha, size, params=parameters)` | Use adaptive exponential dynamics with alpha-shaped conductances. |
|
|
57
|
+
| `sim.create(brainspike.aeif_cond_alpha_astro, size, params=parameters)` | Use the astrocyte-compatible alpha-conductance variant. |
|
|
58
|
+
| `sim.create(brainspike.aeif_cond_alpha_multisynapse, size, params=parameters)` | Use alpha conductances with multiple receptor ports. |
|
|
59
|
+
| `sim.create(brainspike.aeif_cond_beta_multisynapse, size, params=parameters)` | Use beta conductances with multiple receptor ports. |
|
|
60
|
+
| `sim.create(brainspike.aeif_cond_exp, size, params=parameters)` | Use adaptive exponential dynamics with exponential conductances. |
|
|
61
|
+
| `sim.create(brainspike.aeif_psc_alpha, size, params=parameters)` | Use adaptive exponential dynamics with alpha-shaped currents. |
|
|
62
|
+
| `sim.create(brainspike.aeif_psc_delta, size, params=parameters)` | Use adaptive exponential dynamics with delta input. |
|
|
63
|
+
| `sim.create(brainspike.aeif_psc_delta_clopath, size, params=parameters)` | Use delta input while exposing the voltage filters consumed by `clopath_synapse`. |
|
|
64
|
+
| `sim.create(brainspike.aeif_psc_exp, size, params=parameters)` | Use adaptive exponential dynamics with exponential currents. |
|
|
65
|
+
|
|
66
|
+
## Generalized IF neurons
|
|
67
|
+
|
|
68
|
+
Use these APIs for generalized integrate-and-fire dynamics, choosing current versus conductance input, population dynamics, or multiple synaptic time constants.
|
|
69
|
+
|
|
70
|
+
| Constructor | Use when |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `sim.create(brainspike.gif_cond_exp, size, params=parameters)` | Use conductance-based GIF dynamics with exponential synapses. |
|
|
73
|
+
| `sim.create(brainspike.gif_cond_exp_multisynapse, size, params=parameters)` | Use conductance-based GIF dynamics with multiple synaptic time constants. |
|
|
74
|
+
| `sim.create(brainspike.gif_pop_psc_exp, size, params=parameters)` | Use population GIF dynamics with exponential postsynaptic currents. |
|
|
75
|
+
| `sim.create(brainspike.gif_psc_exp, size, params=parameters)` | Use current-based GIF dynamics with exponential postsynaptic currents. |
|
|
76
|
+
| `sim.create(brainspike.gif_psc_exp_multisynapse, size, params=parameters)` | Use current-based GIF dynamics with multiple synaptic time constants. |
|
|
77
|
+
|
|
78
|
+
## Generalized LIF neurons
|
|
79
|
+
|
|
80
|
+
Use these APIs for Allen Institute generalized leaky integrate-and-fire dynamics.
|
|
81
|
+
|
|
82
|
+
| Constructor | Use when |
|
|
83
|
+
|---|---|
|
|
84
|
+
| `sim.create(brainspike.glif_cond, size, params=parameters)` | Use conductance-based GLIF dynamics. |
|
|
85
|
+
| `sim.create(brainspike.glif_psc, size, params=parameters)` | Use current-based GLIF dynamics. |
|
|
86
|
+
| `sim.create(brainspike.glif_psc_double_alpha, size, params=parameters)` | Use current-based GLIF dynamics with double-alpha postsynaptic currents. |
|
|
87
|
+
|
|
88
|
+
## Multi-timescale adaptive-threshold neurons
|
|
89
|
+
|
|
90
|
+
Use these APIs when the requested NEST model uses MAT or adaptive MAT threshold dynamics.
|
|
91
|
+
|
|
92
|
+
| Constructor | Use when |
|
|
93
|
+
|---|---|
|
|
94
|
+
| `sim.create(brainspike.mat2_psc_exp, size, params=parameters)` | Use the two-timescale MAT model with exponential currents. |
|
|
95
|
+
| `sim.create(brainspike.amat2_psc_exp, size, params=parameters)` | Use the adaptive MAT variant with exponential currents. |
|
|
96
|
+
|
|
97
|
+
## Hodgkin-Huxley neurons
|
|
98
|
+
|
|
99
|
+
Use these APIs for biophysical conductance-based dynamics, selecting Clopath or gap-junction support only when the network requires it.
|
|
100
|
+
|
|
101
|
+
| Constructor | Use when |
|
|
102
|
+
|---|---|
|
|
103
|
+
| `sim.create(brainspike.hh_psc_alpha, size, params=parameters)` | Use Hodgkin-Huxley dynamics with alpha-shaped postsynaptic currents. |
|
|
104
|
+
| `sim.create(brainspike.hh_psc_alpha_clopath, size, params=parameters)` | Use alpha currents while exposing voltage State required by `clopath_synapse`. |
|
|
105
|
+
| `sim.create(brainspike.hh_psc_alpha_gap, size, params=parameters)` | Use alpha currents in a gap-junction network. |
|
|
106
|
+
| `sim.create(brainspike.hh_cond_exp_traub, size, params=parameters)` | Use the Traub Hodgkin-Huxley model with exponential conductances. |
|
|
107
|
+
| `sim.create(brainspike.hh_cond_beta_gap_traub, size, params=parameters)` | Use Traub dynamics with beta conductances and gap junctions. |
|
|
108
|
+
| `sim.create(brainspike.ht_neuron, size, params=parameters)` | Use the Hill-Tononi thalamocortical neuron. |
|
|
109
|
+
|
|
110
|
+
## Izhikevich neurons
|
|
111
|
+
|
|
112
|
+
Use this family when the source model explicitly requires NEST-compatible Izhikevich dynamics.
|
|
113
|
+
|
|
114
|
+
| Constructor | Use when |
|
|
115
|
+
|---|---|
|
|
116
|
+
| `sim.create(brainspike.izhikevich, size, params=parameters)` | Use the NEST-compatible Izhikevich neuron. |
|
|
117
|
+
|
|
118
|
+
## Point-process neurons
|
|
119
|
+
|
|
120
|
+
Use these APIs for delta point-process dynamics or the two-compartment interface required by Urbanczik-Senn learning.
|
|
121
|
+
|
|
122
|
+
| Constructor | Use when |
|
|
123
|
+
|---|---|
|
|
124
|
+
| `sim.create(brainspike.pp_psc_delta, size, params=parameters)` | Use a point-process neuron with leaky integration of delta-shaped currents. |
|
|
125
|
+
| `sim.create(brainspike.pp_cond_exp_mc_urbanczik, size, params=parameters)` | Use the two-compartment conductance model read by `urbanczik_synapse`. |
|
|
126
|
+
|
|
127
|
+
## Rate neurons
|
|
128
|
+
|
|
129
|
+
Use these APIs for vectorized rate, noisy-rate, template, or mean-field dynamics rather than spike-resolved neurons.
|
|
130
|
+
|
|
131
|
+
| Constructor | Use when |
|
|
132
|
+
|---|---|
|
|
133
|
+
| `sim.create(brainspike.lin_rate_ipn, size, params=parameters)` | Use a linear rate unit with input noise. |
|
|
134
|
+
| `sim.create(brainspike.lin_rate_opn, size, params=parameters)` | Use a linear rate unit with output noise. |
|
|
135
|
+
| `sim.create(brainspike.tanh_rate_ipn, size, params=parameters)` | Use a tanh rate unit with input noise. |
|
|
136
|
+
| `sim.create(brainspike.tanh_rate_opn, size, params=parameters)` | Use a tanh rate unit with output noise. |
|
|
137
|
+
| `sim.create(brainspike.sigmoid_rate_ipn, size, params=parameters)` | Use a sigmoid rate unit with input noise. |
|
|
138
|
+
| `sim.create(brainspike.sigmoid_rate_gg_1998_ipn, size, params=parameters)` | Use the `sigmoid_rate_gg_1998_ipn` nonlinear-rate variant with input noise. |
|
|
139
|
+
| `sim.create(brainspike.gauss_rate_ipn, size, params=parameters)` | Use a Gaussian rate unit with input noise. |
|
|
140
|
+
| `sim.create(brainspike.threshold_lin_rate_ipn, size, params=parameters)` | Use threshold-linear rate dynamics with input noise. |
|
|
141
|
+
| `sim.create(brainspike.threshold_lin_rate_opn, size, params=parameters)` | Use threshold-linear rate dynamics with output noise. |
|
|
142
|
+
| `sim.create(brainspike.rate_neuron_ipn, size, params=parameters)` | Use the input-noise rate-neuron template. |
|
|
143
|
+
| `sim.create(brainspike.rate_neuron_opn, size, params=parameters)` | Use the output-noise rate-neuron template. |
|
|
144
|
+
| `sim.create(brainspike.rate_transformer_node, size, params=parameters)` | Use the NEST-compatible rate-transformer template. |
|
|
145
|
+
| `sim.create(brainspike.siegert_neuron, size, params=parameters)` | Use the Siegert mean-field diffusion-rate model. |
|
|
146
|
+
|
|
147
|
+
## Binary neurons
|
|
148
|
+
|
|
149
|
+
Use these APIs for deterministic or stochastic binary-state dynamics.
|
|
150
|
+
|
|
151
|
+
| Constructor | Use when |
|
|
152
|
+
|---|---|
|
|
153
|
+
| `sim.create(brainspike.mcculloch_pitts_neuron, size, params=parameters)` | Use deterministic binary activation with a Heaviside gain. |
|
|
154
|
+
| `sim.create(brainspike.ginzburg_neuron, size, params=parameters)` | Use stochastic binary activation with a sigmoidal or affine gain. |
|
|
155
|
+
| `sim.create(brainspike.erfc_neuron, size, params=parameters)` | Use stochastic binary activation with a complementary error-function gain. |
|
|
156
|
+
|
|
157
|
+
## Relay and utility neurons
|
|
158
|
+
|
|
159
|
+
Use these APIs to relay spikes without transforming them or to emit fixed-interval spikes.
|
|
160
|
+
|
|
161
|
+
| Constructor | Use when |
|
|
162
|
+
|---|---|
|
|
163
|
+
| `sim.create(brainspike.parrot_neuron, size, params=parameters)` | Use a one-to-one spike relay, including ports that need an intermediate neuron. |
|
|
164
|
+
| `sim.create(brainspike.ignore_and_fire, size, params=parameters)` | Use a fixed-interval spike source. |
|
|
165
|
+
|
|
166
|
+
## Canonical construction
|
|
167
|
+
|
|
168
|
+
Use NEST parameter names with BrainUnit quantities. The same `Simulator.create()` pattern applies across all families.
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
import brainunit as u
|
|
172
|
+
import brainspike
|
|
173
|
+
|
|
174
|
+
sim = brainspike.Simulator(dt=0.1 * u.ms)
|
|
175
|
+
parameters = {
|
|
176
|
+
"C_m": 250.0 * u.pF,
|
|
177
|
+
"tau_m": 20.0 * u.ms,
|
|
178
|
+
"V_th": -55.0 * u.mV,
|
|
179
|
+
"I_e": 350.0 * u.pA,
|
|
180
|
+
}
|
|
181
|
+
population = sim.create(brainspike.iaf_psc_alpha, 100, params=parameters)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Invariant:** Preserve NEST parameter names but never strip their physical units. This directory identifies the BrainSpike API surface; use upstream NEST documentation for model physiology.
|
|
185
|
+
|
|
186
|
+
## Selection boundaries
|
|
187
|
+
|
|
188
|
+
- Choose `iaf_psc_delta`, `iaf_psc_alpha`, or `iaf_psc_exp` from the requested postsynaptic response; when the response shape is unspecified, preserve the upstream NEST model rather than guessing a substitute.
|
|
189
|
+
- Do not replace a `psc` model with a `cond` model during a port.
|
|
190
|
+
- Choose a `_ps` variant only when sub-grid spike timing matters; route its validation to event-count and spike-time parity.
|
|
191
|
+
- Choose a multisynapse variant when receptor ports or multiple time constants are part of the model; do not silently collapse channels.
|
|
192
|
+
- Use `aeif_psc_delta_clopath` or `hh_psc_alpha_clopath` with `clopath_synapse`.
|
|
193
|
+
- Use `pp_cond_exp_mc_urbanczik` with `urbanczik_synapse`.
|
|
194
|
+
- Open `references/nest-compatible/integration-categories.md` after selecting a family when numerical behavior matters.
|
|
195
|
+
- Open `references/nest-compatible/divergence-and-parity.md` before claiming parity for multi-compartment, stochastic, precise-spiking, plastic, or network-level behavior.
|
|
196
|
+
|
|
197
|
+
## Official sources
|
|
198
|
+
|
|
199
|
+
- https://brainx.chaobrain.com/brainspike/nest-style/models.html
|
|
200
|
+
- https://brainx.chaobrain.com/brainspike/apis/nest-neurons.html
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
# Network building
|
|
2
|
+
|
|
3
|
+
Use this reference when the canonical `Simulator` workflow needs lifecycle control, `NodeView` composition, `SimulationResult`, `SynapseCollection`, connection-rule or concrete-projection lookup, or spatially structured populations and connectivity.
|
|
4
|
+
|
|
5
|
+
## Network construction
|
|
6
|
+
|
|
7
|
+
Use these APIs to create the network's populations, devices, and connections.
|
|
8
|
+
|
|
9
|
+
| API | Use when | Important result |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `brainspike.Simulator(*, dt)` | Use for the NEST-flavored create/connect/run workflow. | Owns the graph, timestep, rollout State, recording, and result construction. |
|
|
12
|
+
| `sim.create(model_cls, size=1, *, params=None, positions=None, **kw)` | Use to instantiate a population or device. | Returns a `NodeView`; spatial `positions` attach coordinates. |
|
|
13
|
+
| `sim.connect(pre, post, *, rule=brainspike.all_to_all, weight=None, delay=None, comm="dense", receptor_type=None, synapse=None, vt=None, allow_autapses=True, allow_multapses=True, seed=None)` | Use to create a projection, attach a source, or register a recorder. | Returns a projection handle, a list for multi-segment fan-out, or `None` for taps/injectors. |
|
|
14
|
+
|
|
15
|
+
BrainSpikes `0.2.0` exposes no public `network.Network` or `network.Builder`
|
|
16
|
+
base. Build the network through one `Simulator`; do not subclass a network
|
|
17
|
+
container from older `brainpy.state` examples.
|
|
18
|
+
|
|
19
|
+
## Simulation execution
|
|
20
|
+
|
|
21
|
+
Use these methods to choose whether a run starts from fresh State or continues a persistent biological timeline.
|
|
22
|
+
|
|
23
|
+
| API | Use when | Important result |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| `sim.simulate(duration, *, dt=None)` | Use for an independent run. | Reinitializes all State, starts at time zero, and returns `SimulationResult`. |
|
|
26
|
+
| `sim.cont(duration, *, dt=None)` | Use to continue biological time across host-controlled windows. | Preserves State and returns a window result with absolute times. |
|
|
27
|
+
| `sim.reset_rollout(*, dt=None)` | Use before restarting a persistent `cont()` workflow. | Reinitializes all State and resets accumulated time and step index to zero. |
|
|
28
|
+
|
|
29
|
+
Do not interchange `simulate()` and `cont()` casually. Use `simulate()` for independent trials; use `cont()` only when State and biological time must persist across windows.
|
|
30
|
+
|
|
31
|
+
## NodeView composition
|
|
32
|
+
|
|
33
|
+
Use `NodeView` composition when one connection or recording operation must address a full population, a slice, or several preserved population segments.
|
|
34
|
+
|
|
35
|
+
| Operation | Use |
|
|
36
|
+
|---|---|
|
|
37
|
+
| `left + right` | Concatenate views while preserving segment boundaries, such as `exc + inh` for a common target. |
|
|
38
|
+
| `view[start:stop]` | Slice one population segment for recording or partial connectivity. |
|
|
39
|
+
| `brainspike.network.NodeView.of(population)` | Build a full-population view over an existing population. |
|
|
40
|
+
| `view.segments` | Inspect the population-and-local-index segments when an API needs the concrete underlying population. |
|
|
41
|
+
|
|
42
|
+
Source and target indices reported by connectivity inspection are population-local. Do not reinterpret them as NEST global node IDs.
|
|
43
|
+
|
|
44
|
+
## Connection-rule lookup
|
|
45
|
+
|
|
46
|
+
Pass rule objects to `Simulator.connect()`; let the rule select edges and the synapse spec select edge behavior.
|
|
47
|
+
|
|
48
|
+
| Rule helper | Choose when |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `brainspike.all_to_all` | Every source-target pair must exist. |
|
|
51
|
+
| `brainspike.one_to_one` | Source `i` must connect to target `i`. |
|
|
52
|
+
| `brainspike.fixed_indegree(k)` | Every target must receive exactly `k` incoming edges. |
|
|
53
|
+
| `brainspike.fixed_total_number(n)` | Exactly `n` edges must be drawn over the source-target grid. |
|
|
54
|
+
| `brainspike.pairwise_bernoulli(p)` | Every possible pair must receive an independent Bernoulli draw. |
|
|
55
|
+
| `brainspike.explicit_edges(pre_idx, post_idx)` | The exact source and target edge-index arrays are already known. |
|
|
56
|
+
| `brainspike.third_factor_bernoulli_with_pool(p=..., pool_size=..., pool_type=...)` | A tripartite pre-post-third-factor network needs Bernoulli pairing with an astrocyte pool. |
|
|
57
|
+
|
|
58
|
+
Use `seed` to reproduce one BrainSpike realization, `allow_autapses` and `allow_multapses` to control self and repeated edges, and `comm="sparse"` for memory-light event communication.
|
|
59
|
+
|
|
60
|
+
## Concrete projection lookup
|
|
61
|
+
|
|
62
|
+
For standard construction, pass a rule or synapse spec to `Simulator.connect()` and inspect the returned handle. Use the classes below only when reading the event-transmission layer directly.
|
|
63
|
+
|
|
64
|
+
| Projection class | Represents |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `brainspike.network.EventProjection(*args, **kwargs)` | Delayed, weighted static event transmission. |
|
|
67
|
+
| `brainspike.network.EventPlasticProj(*args, **kwargs)` | Event-driven plastic transmission. |
|
|
68
|
+
| `brainspike.network.VoltageCoupledPlasticProj(*args, **kwargs)` | Plasticity coupled to postsynaptic voltage State. |
|
|
69
|
+
|
|
70
|
+
BrainSpikes `0.2.0` does not provide fixed-connectivity classes such as
|
|
71
|
+
`AllToAllProj` or `FixedIndegreeProj`. Express those patterns with the rule
|
|
72
|
+
helpers above, which select the edges before edge transmission.
|
|
73
|
+
|
|
74
|
+
| Older `brainpy.state` class | BrainSpikes `0.2.0` route |
|
|
75
|
+
|---|---|
|
|
76
|
+
| `AllToAllProj`, `OneToOneProj`, `PairwiseBernoulliProj`, `FixedIndegreeProj`, `FixedTotalNumberProj` | Use the matching rule helper in the table above. |
|
|
77
|
+
| `Network`, `Builder` | Use `Simulator.create()` and `Simulator.connect()`; no public network-container base is exported. |
|
|
78
|
+
| `SymmetricPairwiseBernoulliProj`, `FixedOutdegreeProj`, `PairwisePoissonProj` | No public rule constructor; verify a supported formulation before porting. |
|
|
79
|
+
|
|
80
|
+
## Canonical sparse E/I construction
|
|
81
|
+
|
|
82
|
+
Use `NodeView` algebra and a seeded fixed-indegree rule to express Brunel-style wiring without materializing a dense edge list.
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
import brainunit as u
|
|
86
|
+
import brainspike
|
|
87
|
+
|
|
88
|
+
sim = brainspike.Simulator(dt=0.1 * u.ms)
|
|
89
|
+
params = {
|
|
90
|
+
"C_m": 1.0 * u.pF,
|
|
91
|
+
"tau_m": 20.0 * u.ms,
|
|
92
|
+
"t_ref": 2.0 * u.ms,
|
|
93
|
+
"E_L": 0.0 * u.mV,
|
|
94
|
+
"V_reset": 0.0 * u.mV,
|
|
95
|
+
"V_th": 20.0 * u.mV,
|
|
96
|
+
}
|
|
97
|
+
exc = sim.create(brainspike.iaf_psc_delta, 400, params=params)
|
|
98
|
+
inh = sim.create(brainspike.iaf_psc_delta, 100, params=params)
|
|
99
|
+
all_neurons = exc + inh
|
|
100
|
+
|
|
101
|
+
sim.connect(
|
|
102
|
+
exc,
|
|
103
|
+
all_neurons,
|
|
104
|
+
rule=brainspike.fixed_indegree(40),
|
|
105
|
+
weight=0.1 * u.mV,
|
|
106
|
+
delay=1.5 * u.ms,
|
|
107
|
+
comm="sparse",
|
|
108
|
+
allow_multapses=True,
|
|
109
|
+
seed=1,
|
|
110
|
+
)
|
|
111
|
+
sim.connect(
|
|
112
|
+
inh,
|
|
113
|
+
all_neurons,
|
|
114
|
+
rule=brainspike.fixed_indegree(10),
|
|
115
|
+
weight=-0.5 * u.mV,
|
|
116
|
+
delay=1.5 * u.ms,
|
|
117
|
+
comm="sparse",
|
|
118
|
+
allow_multapses=True,
|
|
119
|
+
seed=2,
|
|
120
|
+
)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Invariant:** Delta-neuron weights are voltage jumps in `mV`. Do not reuse current weights from an alpha- or exponential-PSC network.
|
|
124
|
+
|
|
125
|
+
## Result readback
|
|
126
|
+
|
|
127
|
+
Use these APIs after simulation to read the common time axis, spike observables, analog traces, or registered plastic-weight trajectories.
|
|
128
|
+
|
|
129
|
+
| API | Use |
|
|
130
|
+
|---|---|
|
|
131
|
+
| `result.times` | Read the common time axis. |
|
|
132
|
+
| `result.spikes(node)` | Read a per-step spike matrix. |
|
|
133
|
+
| `result.rate(node)` | Read the mean population firing rate. |
|
|
134
|
+
| `result.trace(recorder, recordable="V_m")` | Read a registered analog trace. |
|
|
135
|
+
| `sim.record_weight(proj)` | Register the returned plastic projection for per-step weight capture. |
|
|
136
|
+
| `result.weight_trace(proj)` | Read the registered `(n_steps, n_edges)` weight trajectory. |
|
|
137
|
+
|
|
138
|
+
## Realized-connection inspection
|
|
139
|
+
|
|
140
|
+
Use these APIs after construction to obtain a lazy view over realized edges and read or update supported live connection attributes.
|
|
141
|
+
|
|
142
|
+
| API | Use |
|
|
143
|
+
|---|---|
|
|
144
|
+
| `sim.get_connections(source=None, target=None, synapse=None)` | Obtain a filtered, lazy `SynapseCollection` over realized edges. |
|
|
145
|
+
| `connections.get(key)` | Read live `source`, `target`, `weight`, or `delay` values. |
|
|
146
|
+
| `connections.set(key, value)` | Write supported static weight or delay values; plastic and homogeneous constraints can reject the write. |
|
|
147
|
+
|
|
148
|
+
## Spatial layouts
|
|
149
|
+
|
|
150
|
+
Use these constructors to build concrete or deferred 2-D/3-D node positions.
|
|
151
|
+
|
|
152
|
+
| Constructor | Use when |
|
|
153
|
+
|---|---|
|
|
154
|
+
| `brainspike.spatial.Layer(coords, ndim, shape=None, extent=None, center=None, sampler=None)` | Use when constructing a layer directly from coordinates or a sampler. |
|
|
155
|
+
| `brainspike.spatial.grid(shape, extent=None, center=None)` | Use a regular cell-centered lattice. |
|
|
156
|
+
| `brainspike.spatial.free(positions, extent=None, num_dimensions=None)` | Use explicit or sampled free positions. |
|
|
157
|
+
|
|
158
|
+
## Spatial position expressions
|
|
159
|
+
|
|
160
|
+
Use these expression roots when a kernel depends on absolute, source, or target coordinates.
|
|
161
|
+
|
|
162
|
+
| API | Use when |
|
|
163
|
+
|---|---|
|
|
164
|
+
| `brainspike.spatial.pos` | Use `.x`, `.y`, or `.z` for the current position expression. |
|
|
165
|
+
| `brainspike.spatial.source_pos` | Use `.x`, `.y`, or `.z` for source-coordinate expressions. |
|
|
166
|
+
| `brainspike.spatial.target_pos` | Use `.x`, `.y`, or `.z` for target-coordinate expressions. |
|
|
167
|
+
|
|
168
|
+
## Spatial distance and displacement
|
|
169
|
+
|
|
170
|
+
Use these APIs to compute pairwise geometric relationships between source and target nodes or layers.
|
|
171
|
+
|
|
172
|
+
| API | Use when |
|
|
173
|
+
|---|---|
|
|
174
|
+
| `brainspike.spatial.displacement(pre_pos, post_pos)` | Use the vector displacement `post - pre`. |
|
|
175
|
+
| `brainspike.spatial.pairwise_distance(pre_pos, post_pos)` | Use pairwise Euclidean distance between coordinate arrays. |
|
|
176
|
+
| `brainspike.spatial.Distance(layer_a, layer_b)` | Use a reusable distance expression between two layers. |
|
|
177
|
+
|
|
178
|
+
## Spatial probability kernels
|
|
179
|
+
|
|
180
|
+
Use these constructors to map distance or displacement to connection probability.
|
|
181
|
+
|
|
182
|
+
| Constructor | Use when |
|
|
183
|
+
|---|---|
|
|
184
|
+
| `brainspike.spatial.gaussian(x=brainspike.spatial.distance, mean=0.0, std=1.0)` | Use a Gaussian probability profile. |
|
|
185
|
+
| `brainspike.spatial.exponential(x=brainspike.spatial.distance, beta=1.0)` | Use an exponential probability profile. |
|
|
186
|
+
| `brainspike.spatial.gamma(x=brainspike.spatial.distance, kappa=1.0, theta=1.0)` | Use a gamma probability profile. |
|
|
187
|
+
| `brainspike.spatial.gabor(x=None, y=None, theta=0.0, gamma=1.0, std=1.0, lam=1.0, psi=0.0)` | Use a rectified Gabor profile over 2-D displacement. |
|
|
188
|
+
| `brainspike.spatial.gaussian2D(x=None, y=None, mean_x=0.0, mean_y=0.0, std_x=1.0, std_y=1.0, rho=0.0)` | Use a correlated bivariate-Gaussian profile. |
|
|
189
|
+
|
|
190
|
+
## Spatial masks
|
|
191
|
+
|
|
192
|
+
Use these constructors to restrict candidate targets to a 2-D or 3-D region.
|
|
193
|
+
|
|
194
|
+
| Constructor | Use when |
|
|
195
|
+
|---|---|
|
|
196
|
+
| `brainspike.spatial.circular(radius)` | Use a circular 2-D cutoff. |
|
|
197
|
+
| `brainspike.spatial.spherical(radius)` | Use a spherical 3-D cutoff. |
|
|
198
|
+
| `brainspike.spatial.box(lower_left, upper_right)` | Use an axis-aligned 2-D or 3-D box. |
|
|
199
|
+
| `brainspike.spatial.rectangular(lower_left, upper_right, azimuth_angle=0.0)` | Use a rotated 2-D rectangle. |
|
|
200
|
+
| `brainspike.spatial.doughnut(inner_radius, outer_radius)` | Use a 2-D annulus. |
|
|
201
|
+
| `brainspike.spatial.elliptical(major_axis, minor_axis, azimuth_angle=0.0, anchor=None)` | Use a rotated 2-D ellipse. |
|
|
202
|
+
| `brainspike.spatial.ellipsoidal(major_axis, minor_axis, polar_axis, azimuth_angle=0.0, polar_angle=0.0, anchor=None)` | Use a rotated 3-D ellipsoid. |
|
|
203
|
+
|
|
204
|
+
## Spatial connection rules
|
|
205
|
+
|
|
206
|
+
Use these constructors to combine a probability law with an optional mask before passing the rule to `Simulator.connect()`.
|
|
207
|
+
|
|
208
|
+
| Constructor | Use when |
|
|
209
|
+
|---|---|
|
|
210
|
+
| `brainspike.spatial.SpatialConnRule(p, mask=None, allow_autapses=True, _pre_pos=None, _post_pos=None)` | Use the concrete spatial rule type when positions are already bound. |
|
|
211
|
+
| `brainspike.spatial.spatial_pairwise_bernoulli(p, mask=None, allow_autapses=True)` | Use the public distance-dependent pairwise-Bernoulli builder. |
|
|
212
|
+
|
|
213
|
+
## Spatial node selection and introspection
|
|
214
|
+
|
|
215
|
+
Use these APIs to select nodes by geometry or inspect realized spatial targets.
|
|
216
|
+
|
|
217
|
+
| API | Use when |
|
|
218
|
+
|---|---|
|
|
219
|
+
| `brainspike.spatial.center_element(layer)` | Use the node nearest the layer centroid. |
|
|
220
|
+
| `brainspike.spatial.nearest_element(layer, locations, find_all=False)` | Use the node nearest each query location. |
|
|
221
|
+
| `brainspike.spatial.select_nodes_by_mask(layer, anchor, mask)` | Use local indices inside a mask anchored at a position. |
|
|
222
|
+
| `brainspike.spatial.target_nodes(sim, source, target)` | Use realized target indices for each source. |
|
|
223
|
+
| `brainspike.spatial.target_positions(sim, source, target)` | Use coordinates of each source node's realized targets. |
|
|
224
|
+
|
|
225
|
+
## Spatial export and visualization
|
|
226
|
+
|
|
227
|
+
Use these APIs to export layer data or visualize positions, realized edges, and probability fields.
|
|
228
|
+
|
|
229
|
+
| API | Use when |
|
|
230
|
+
|---|---|
|
|
231
|
+
| `brainspike.spatial.dump_layer_nodes(sim, pop, outname)` | Use to write local node indices and coordinates. |
|
|
232
|
+
| `brainspike.spatial.dump_layer_connections(sim, source, target, outname)` | Use to write realized edges, weights, delays, and displacement. |
|
|
233
|
+
| `brainspike.spatial.plot_layer(layer, fig=None, nodecolor="b", nodesize=20)` | Use to plot layer positions. |
|
|
234
|
+
| `brainspike.spatial.plot_targets(sim, src_node, target, fig=None, src_color="red", src_size=50, tgt_color="b", tgt_size=20)` | Use to highlight one source node's realized targets. |
|
|
235
|
+
| `brainspike.spatial.plot_sources(sim, source, tgt_node, fig=None, src_color="b", src_size=20, tgt_color="red", tgt_size=50)` | Use to highlight one target node's realized sources. |
|
|
236
|
+
| `brainspike.spatial.plot_probability_parameter(kernel, mask=None, extent=(-0.5, 0.5, -0.5, 0.5), shape=(100, 100), fig=None, cmap="Greys")` | Use to plot a 2-D probability field. |
|
|
237
|
+
|
|
238
|
+
## Spatial workflow
|
|
239
|
+
|
|
240
|
+
Use the same `Simulator.create()` and `Simulator.connect()` lifecycle after selecting the layout, kernel, mask, and spatial rule.
|
|
241
|
+
|
|
242
|
+
```python
|
|
243
|
+
positions = brainspike.spatial.grid([4, 3], extent=[2.0, 1.5])
|
|
244
|
+
source = sim.create(brainspike.iaf_psc_alpha, positions=positions)
|
|
245
|
+
target = sim.create(brainspike.iaf_psc_alpha, positions=positions)
|
|
246
|
+
|
|
247
|
+
rule = brainspike.spatial.spatial_pairwise_bernoulli(
|
|
248
|
+
p=brainspike.spatial.gaussian(brainspike.spatial.distance, std=0.5),
|
|
249
|
+
mask=brainspike.spatial.circular(3.0),
|
|
250
|
+
)
|
|
251
|
+
sim.connect(
|
|
252
|
+
source,
|
|
253
|
+
target,
|
|
254
|
+
rule=rule,
|
|
255
|
+
weight=1.0 * u.pA,
|
|
256
|
+
delay=1.0 * u.ms,
|
|
257
|
+
seed=0,
|
|
258
|
+
)
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Spatial random draws differ between NEST and JAX even when the probability law matches. Validate the empirical probability-versus-distance curve distributionally, not edge by edge.
|
|
262
|
+
|
|
263
|
+
## Official sources
|
|
264
|
+
|
|
265
|
+
- https://brainx.chaobrain.com/brainspike/nest-style/tutorials/03-connect-network.html
|
|
266
|
+
- https://brainx.chaobrain.com/brainspike/apis/nest-network.html
|
|
267
|
+
- https://brainx.chaobrain.com/brainspike/apis/nest-spatial.html
|
|
268
|
+
- https://brainx.chaobrain.com/brainspike/nest-style/spatial.html
|
|
269
|
+
|
|
270
|
+
## Schedule a custom autonomous model
|
|
271
|
+
|
|
272
|
+
The Simulator calls a model's zero-argument `update()` during its rollout. The custom `LIF` fixture expects `current`, so placing it in `create()` without adaptation raises `TypeError`. `AutonomousLIF` in `scripts/nest_boundary_workflows.py` supplies a declared constant current in its own zero-argument update and produces recorded spikes under Simulator scheduling.
|
|
273
|
+
|
|
274
|
+
This validates autonomous custom scheduling, not a universal incoming-connection adapter. Preserve input hooks, physical units, recording, and spike semantics before attaching an arbitrary custom model to NEST projections. Keep a native graph when those contracts are not established.
|
|
275
|
+
|
|
276
|
+
Open `references/nest-delay-boundaries.md` before selecting an explicit-spec delay or per-edge array representation.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Copyright 2026 BrainX Ecosystem Limited. Apache 2.0.
|
|
3
3
|
"""Brette et al. 2007 (Vogels-Abbott) COBA + CUBA benchmarks — NEST-style port.
|
|
4
4
|
|
|
5
|
-
Port of NEST's ``brette_et_al_2007/{coba,cuba}.py`` onto
|
|
5
|
+
Port of NEST's ``brette_et_al_2007/{coba,cuba}.py`` onto brainspike's explicit
|
|
6
6
|
``Simulator`` API. Both are the Vogels & Abbott (2005) [1]_ sparse self-sustained
|
|
7
7
|
excitatory/inhibitory network — the FACETS simulator-review benchmarks [2]_:
|
|
8
8
|
|
|
@@ -22,10 +22,10 @@ self-sustains in an asynchronous-irregular state. The spike output of ``Nrec=500
|
|
|
22
22
|
neurons per population is recorded; the reported observable is the mean per-neuron
|
|
23
23
|
population firing rate.
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
For a point-HH model, use the public NEST model directory; for explicit ionic
|
|
26
|
+
mechanisms, open the BrainCell skill. This file does not ship an HH network variant.
|
|
27
27
|
|
|
28
|
-
Run: python
|
|
28
|
+
Run: python references/nest-compatible/scripts/brette_et_al_2007.py
|
|
29
29
|
|
|
30
30
|
References
|
|
31
31
|
----------
|
|
@@ -44,10 +44,7 @@ import numpy as np
|
|
|
44
44
|
import brainunit as u
|
|
45
45
|
import braintools
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
Simulator, fixed_indegree, one_to_one,
|
|
49
|
-
iaf_cond_exp, iaf_psc_exp, poisson_generator, spike_recorder,
|
|
50
|
-
)
|
|
47
|
+
import brainspike
|
|
51
48
|
|
|
52
49
|
# --- Shared Vogels-Abbott architecture -------------------------------------------
|
|
53
50
|
NE, NI = 3200, 800 # excitatory / inhibitory population sizes
|
|
@@ -162,25 +159,25 @@ def build_coba(seed, *, ne=NE, ni=NI, dt=DT, comm='sparse'):
|
|
|
162
159
|
tau_syn_ex=COBA_PARAMS['tau_syn_ex'] * u.ms, tau_syn_in=COBA_PARAMS['tau_syn_in'] * u.ms,
|
|
163
160
|
V_initializer=braintools.init.Constant(COBA_PARAMS['E_L'] * u.mV))
|
|
164
161
|
|
|
165
|
-
sim = Simulator(dt=dt * u.ms)
|
|
166
|
-
e = sim.create(iaf_cond_exp, ne, params=params)
|
|
167
|
-
i = sim.create(iaf_cond_exp, ni, params=params)
|
|
168
|
-
kick = sim.create(poisson_generator, NSTIM, rate=KICK_RATE * u.Hz,
|
|
162
|
+
sim = brainspike.Simulator(dt=dt * u.ms)
|
|
163
|
+
e = sim.create(brainspike.iaf_cond_exp, ne, params=params)
|
|
164
|
+
i = sim.create(brainspike.iaf_cond_exp, ni, params=params)
|
|
165
|
+
kick = sim.create(brainspike.poisson_generator, NSTIM, rate=KICK_RATE * u.Hz,
|
|
169
166
|
start=KICK_START * u.ms, stop=KICK_STOP * u.ms, rng_seed=seed)
|
|
170
|
-
esr = sim.create(spike_recorder)
|
|
171
|
-
isr = sim.create(spike_recorder)
|
|
167
|
+
esr = sim.create(brainspike.spike_recorder)
|
|
168
|
+
isr = sim.create(brainspike.spike_recorder)
|
|
172
169
|
|
|
173
170
|
# Recurrent: every neuron gets CE excitatory (receptor 1 -> g_ex) and CI
|
|
174
171
|
# inhibitory (receptor 2 -> g_in) inputs; inhibitory weight is a positive nS.
|
|
175
172
|
sim.connect(e, e + i, weight=COBA_W_E * u.nS, delay=DELAY * u.ms,
|
|
176
|
-
rule=fixed_indegree(ce), comm=comm, receptor_type=1,
|
|
173
|
+
rule=brainspike.fixed_indegree(ce), comm=comm, receptor_type=1,
|
|
177
174
|
allow_multapses=True, seed=10 * seed + 1)
|
|
178
175
|
sim.connect(i, e + i, weight=COBA_W_I * u.nS, delay=DELAY * u.ms,
|
|
179
|
-
rule=fixed_indegree(ci), comm=comm, receptor_type=2,
|
|
176
|
+
rule=brainspike.fixed_indegree(ci), comm=comm, receptor_type=2,
|
|
180
177
|
allow_multapses=True, seed=10 * seed + 2)
|
|
181
178
|
# Ignition kick: independent 300 Hz trains -> first NSTIM excitatory neurons.
|
|
182
179
|
sim.connect(kick, e[:NSTIM], weight=COBA_W_E * u.nS, delay=DELAY * u.ms,
|
|
183
|
-
rule=one_to_one, receptor_type=1)
|
|
180
|
+
rule=brainspike.one_to_one, receptor_type=1)
|
|
184
181
|
sim.connect(e[:NREC], esr)
|
|
185
182
|
sim.connect(i[:NREC], isr)
|
|
186
183
|
return sim, esr, isr
|
|
@@ -217,21 +214,21 @@ def build_cuba(seed, *, ne=NE, ni=NI, dt=DT, comm='sparse'):
|
|
|
217
214
|
tau_syn_in=CUBA_PARAMS['tau_syn_in'] * u.ms, t_ref=CUBA_PARAMS['t_ref'] * u.ms,
|
|
218
215
|
V_initializer=braintools.init.Constant(CUBA_VINIT * u.mV))
|
|
219
216
|
|
|
220
|
-
sim = Simulator(dt=dt * u.ms)
|
|
221
|
-
e = sim.create(iaf_psc_exp, ne, params=params)
|
|
222
|
-
i = sim.create(iaf_psc_exp, ni, params=params)
|
|
223
|
-
kick = sim.create(poisson_generator, NSTIM, rate=KICK_RATE * u.Hz,
|
|
217
|
+
sim = brainspike.Simulator(dt=dt * u.ms)
|
|
218
|
+
e = sim.create(brainspike.iaf_psc_exp, ne, params=params)
|
|
219
|
+
i = sim.create(brainspike.iaf_psc_exp, ni, params=params)
|
|
220
|
+
kick = sim.create(brainspike.poisson_generator, NSTIM, rate=KICK_RATE * u.Hz,
|
|
224
221
|
start=KICK_START * u.ms, stop=KICK_STOP * u.ms, rng_seed=seed)
|
|
225
|
-
esr = sim.create(spike_recorder)
|
|
226
|
-
isr = sim.create(spike_recorder)
|
|
222
|
+
esr = sim.create(brainspike.spike_recorder)
|
|
223
|
+
isr = sim.create(brainspike.spike_recorder)
|
|
227
224
|
|
|
228
225
|
# Recurrent: excitatory weight positive, inhibitory weight negative (sign-routed).
|
|
229
226
|
sim.connect(e, e + i, weight=CUBA_W_E * u.pA, delay=DELAY * u.ms,
|
|
230
|
-
rule=fixed_indegree(ce), comm=comm, allow_multapses=True, seed=10 * seed + 1)
|
|
227
|
+
rule=brainspike.fixed_indegree(ce), comm=comm, allow_multapses=True, seed=10 * seed + 1)
|
|
231
228
|
sim.connect(i, e + i, weight=CUBA_W_I * u.pA, delay=DELAY * u.ms,
|
|
232
|
-
rule=fixed_indegree(ci), comm=comm, allow_multapses=True, seed=10 * seed + 2)
|
|
229
|
+
rule=brainspike.fixed_indegree(ci), comm=comm, allow_multapses=True, seed=10 * seed + 2)
|
|
233
230
|
sim.connect(kick, e[:NSTIM], weight=CUBA_W_E * u.pA, delay=DELAY * u.ms,
|
|
234
|
-
rule=one_to_one)
|
|
231
|
+
rule=brainspike.one_to_one)
|
|
235
232
|
sim.connect(e[:NREC], esr)
|
|
236
233
|
sim.connect(i[:NREC], isr)
|
|
237
234
|
return sim, esr, isr
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
# Copyright 2026 BrainX Ecosystem Limited. Apache 2.0.
|
|
3
3
|
"""Brunel (2000) random balanced network with alpha synapses — NEST-style port.
|
|
4
4
|
|
|
5
|
-
Port of NEST's ``brunel_alpha_nest.py`` onto
|
|
5
|
+
Port of NEST's ``brunel_alpha_nest.py`` onto brainspike's explicit Simulator
|
|
6
6
|
API, driving the real ``iaf_psc_alpha`` / ``poisson_generator`` / ``spike_recorder``
|
|
7
|
-
models. Default ``order=
|
|
8
|
-
a
|
|
7
|
+
models. Default ``order=2500`` creates 10,000 excitatory and 2,500 inhibitory
|
|
8
|
+
neurons with sparse communication; use a smaller order for a smoke run.
|
|
9
9
|
|
|
10
|
-
Run: python
|
|
10
|
+
Run: python references/nest-compatible/scripts/brunel_alpha.py
|
|
11
11
|
"""
|
|
12
12
|
import jax
|
|
13
13
|
import brainstate
|
|
@@ -19,10 +19,7 @@ import scipy.special as sp
|
|
|
19
19
|
import brainunit as u
|
|
20
20
|
import braintools
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
Simulator, fixed_indegree, all_to_all,
|
|
24
|
-
iaf_psc_alpha, poisson_generator, spike_recorder,
|
|
25
|
-
)
|
|
22
|
+
import brainspike
|
|
26
23
|
|
|
27
24
|
|
|
28
25
|
def LambertWm1(x):
|
|
@@ -58,19 +55,19 @@ def build(order=2500, simtime=1000.0, comm='sparse'):
|
|
|
58
55
|
V_reset=0. * u.mV, V_th=theta * u.mV,
|
|
59
56
|
V_initializer=braintools.init.Constant(0. * u.mV))
|
|
60
57
|
|
|
61
|
-
sim = Simulator(dt=dt * u.ms)
|
|
62
|
-
ne = sim.create(iaf_psc_alpha, NE, params=npar)
|
|
63
|
-
ni = sim.create(iaf_psc_alpha, NI, params=npar)
|
|
64
|
-
noise = sim.create(poisson_generator, rate=p_rate * u.Hz)
|
|
65
|
-
esr = sim.create(spike_recorder)
|
|
66
|
-
isr = sim.create(spike_recorder)
|
|
58
|
+
sim = brainspike.Simulator(dt=dt * u.ms)
|
|
59
|
+
ne = sim.create(brainspike.iaf_psc_alpha, NE, params=npar)
|
|
60
|
+
ni = sim.create(brainspike.iaf_psc_alpha, NI, params=npar)
|
|
61
|
+
noise = sim.create(brainspike.poisson_generator, rate=p_rate * u.Hz)
|
|
62
|
+
esr = sim.create(brainspike.spike_recorder)
|
|
63
|
+
isr = sim.create(brainspike.spike_recorder)
|
|
67
64
|
|
|
68
|
-
sim.connect(noise, ne, weight=J_ex * u.pA, delay=delay * u.ms, rule=all_to_all)
|
|
69
|
-
sim.connect(noise, ni, weight=J_ex * u.pA, delay=delay * u.ms, rule=all_to_all)
|
|
65
|
+
sim.connect(noise, ne, weight=J_ex * u.pA, delay=delay * u.ms, rule=brainspike.all_to_all)
|
|
66
|
+
sim.connect(noise, ni, weight=J_ex * u.pA, delay=delay * u.ms, rule=brainspike.all_to_all)
|
|
70
67
|
sim.connect(ne, ne + ni, weight=J_ex * u.pA, delay=delay * u.ms,
|
|
71
|
-
rule=fixed_indegree(CE), comm=comm, allow_multapses=True, seed=1)
|
|
68
|
+
rule=brainspike.fixed_indegree(CE), comm=comm, allow_multapses=True, seed=1)
|
|
72
69
|
sim.connect(ni, ne + ni, weight=J_in * u.pA, delay=delay * u.ms,
|
|
73
|
-
rule=fixed_indegree(CI), comm=comm, allow_multapses=True, seed=2)
|
|
70
|
+
rule=brainspike.fixed_indegree(CI), comm=comm, allow_multapses=True, seed=2)
|
|
74
71
|
sim.connect(ne[:N_rec], esr)
|
|
75
72
|
sim.connect(ni[:N_rec], isr)
|
|
76
73
|
return sim, esr, isr, N_rec, simtime
|
|
@@ -85,7 +82,7 @@ def main():
|
|
|
85
82
|
res = sim.simulate(simtime * u.ms)
|
|
86
83
|
erate = res.rate(esr.segments[0].population)
|
|
87
84
|
irate = res.rate(isr.segments[0].population)
|
|
88
|
-
print("Brunel network (
|
|
85
|
+
print("Brunel network (brainspike, alpha synapses)")
|
|
89
86
|
print(f" Excitatory rate : {erate:.2f} spks/s")
|
|
90
87
|
print(f" Inhibitory rate : {irate:.2f} spks/s")
|
|
91
88
|
|
|
@@ -98,8 +95,8 @@ def main():
|
|
|
98
95
|
plt.xlabel("time (ms)"); plt.ylabel("exc neuron")
|
|
99
96
|
plt.title("Brunel network — excitatory raster")
|
|
100
97
|
plt.tight_layout()
|
|
101
|
-
plt.savefig("
|
|
102
|
-
print(" wrote
|
|
98
|
+
plt.savefig("brunel_alpha_raster.png", dpi=100)
|
|
99
|
+
print(" wrote brunel_alpha_raster.png")
|
|
103
100
|
except ImportError:
|
|
104
101
|
print(" (matplotlib not installed; skipping raster)")
|
|
105
102
|
|