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
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
# Copyright 2026 BrainX Ecosystem Limited. Apache 2.0.
|
|
3
3
|
"""Brunel (2000) random balanced network with delta synapses — NEST-style port.
|
|
4
4
|
|
|
5
|
-
Port of NEST's ``brunel_delta_nest.py`` onto
|
|
5
|
+
Port of NEST's ``brunel_delta_nest.py`` onto brainspike's explicit Simulator
|
|
6
6
|
API, driving the real ``iaf_psc_delta`` / ``poisson_generator`` / ``spike_recorder``
|
|
7
7
|
models. Unlike the alpha variant, delta synapses deliver an instantaneous
|
|
8
8
|
membrane-voltage jump, so connection weights are voltages (mV) and ``J_ex = J``
|
|
9
9
|
directly — there is no ComputePSPnorm current-to-voltage rescaling.
|
|
10
10
|
|
|
11
|
-
Run: python
|
|
11
|
+
Run: python references/nest-compatible/scripts/brunel_delta.py
|
|
12
12
|
"""
|
|
13
13
|
import jax
|
|
14
14
|
import brainstate
|
|
@@ -19,10 +19,7 @@ import numpy as np
|
|
|
19
19
|
import brainunit as u
|
|
20
20
|
import braintools
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
Simulator, fixed_indegree, all_to_all,
|
|
24
|
-
iaf_psc_delta, poisson_generator, spike_recorder,
|
|
25
|
-
)
|
|
22
|
+
import brainspike
|
|
26
23
|
|
|
27
24
|
|
|
28
25
|
def build(order=2500, simtime=1000.0, comm='sparse'):
|
|
@@ -43,19 +40,19 @@ def build(order=2500, simtime=1000.0, comm='sparse'):
|
|
|
43
40
|
E_L=0. * u.mV, V_reset=0. * u.mV, V_th=theta * u.mV,
|
|
44
41
|
V_initializer=braintools.init.Constant(0. * u.mV))
|
|
45
42
|
|
|
46
|
-
sim = Simulator(dt=dt * u.ms)
|
|
47
|
-
ne = sim.create(iaf_psc_delta, NE, params=npar)
|
|
48
|
-
ni = sim.create(iaf_psc_delta, NI, params=npar)
|
|
49
|
-
noise = sim.create(poisson_generator, rate=p_rate * u.Hz)
|
|
50
|
-
esr = sim.create(spike_recorder)
|
|
51
|
-
isr = sim.create(spike_recorder)
|
|
43
|
+
sim = brainspike.Simulator(dt=dt * u.ms)
|
|
44
|
+
ne = sim.create(brainspike.iaf_psc_delta, NE, params=npar)
|
|
45
|
+
ni = sim.create(brainspike.iaf_psc_delta, NI, params=npar)
|
|
46
|
+
noise = sim.create(brainspike.poisson_generator, rate=p_rate * u.Hz)
|
|
47
|
+
esr = sim.create(brainspike.spike_recorder)
|
|
48
|
+
isr = sim.create(brainspike.spike_recorder)
|
|
52
49
|
|
|
53
|
-
sim.connect(noise, ne, weight=J_ex * u.mV, delay=delay * u.ms, rule=all_to_all)
|
|
54
|
-
sim.connect(noise, ni, weight=J_ex * u.mV, delay=delay * u.ms, rule=all_to_all)
|
|
50
|
+
sim.connect(noise, ne, weight=J_ex * u.mV, delay=delay * u.ms, rule=brainspike.all_to_all)
|
|
51
|
+
sim.connect(noise, ni, weight=J_ex * u.mV, delay=delay * u.ms, rule=brainspike.all_to_all)
|
|
55
52
|
sim.connect(ne, ne + ni, weight=J_ex * u.mV, delay=delay * u.ms,
|
|
56
|
-
rule=fixed_indegree(CE), comm=comm, allow_multapses=True, seed=1)
|
|
53
|
+
rule=brainspike.fixed_indegree(CE), comm=comm, allow_multapses=True, seed=1)
|
|
57
54
|
sim.connect(ni, ne + ni, weight=J_in * u.mV, delay=delay * u.ms,
|
|
58
|
-
rule=fixed_indegree(CI), comm=comm, allow_multapses=True, seed=2)
|
|
55
|
+
rule=brainspike.fixed_indegree(CI), comm=comm, allow_multapses=True, seed=2)
|
|
59
56
|
sim.connect(ne[:N_rec], esr)
|
|
60
57
|
sim.connect(ni[:N_rec], isr)
|
|
61
58
|
return sim, esr, isr, N_rec, simtime
|
|
@@ -70,7 +67,7 @@ def main():
|
|
|
70
67
|
res = sim.simulate(simtime * u.ms)
|
|
71
68
|
erate = res.rate(esr.segments[0].population)
|
|
72
69
|
irate = res.rate(isr.segments[0].population)
|
|
73
|
-
print("Brunel network (
|
|
70
|
+
print("Brunel network (brainspike, delta synapses)")
|
|
74
71
|
print(f" Excitatory rate : {erate:.2f} spks/s")
|
|
75
72
|
print(f" Inhibitory rate : {irate:.2f} spks/s")
|
|
76
73
|
|
|
@@ -83,8 +80,8 @@ def main():
|
|
|
83
80
|
plt.xlabel("time (ms)"); plt.ylabel("exc neuron")
|
|
84
81
|
plt.title("Brunel network — excitatory raster (delta synapses)")
|
|
85
82
|
plt.tight_layout()
|
|
86
|
-
plt.savefig("
|
|
87
|
-
print(" wrote
|
|
83
|
+
plt.savefig("brunel_delta_raster.png", dpi=100)
|
|
84
|
+
print(" wrote brunel_delta_raster.png")
|
|
88
85
|
except ImportError:
|
|
89
86
|
print(" (matplotlib not installed; skipping raster)")
|
|
90
87
|
|
|
@@ -16,7 +16,7 @@ are the cluster-07 ones (LTD near-exact, LTP within 5 %). The presynaptic train
|
|
|
16
16
|
relays through a ``spike_generator`` directly into the plastic edge (in NEST a
|
|
17
17
|
``parrot_neuron`` relays it, since a device cannot drive a plastic synapse).
|
|
18
18
|
|
|
19
|
-
Run: python
|
|
19
|
+
Run: python references/nest-compatible/scripts/clopath_synapse_spike_pairing.py
|
|
20
20
|
"""
|
|
21
21
|
import jax
|
|
22
22
|
import brainstate
|
|
@@ -27,8 +27,7 @@ import numpy as np
|
|
|
27
27
|
import brainunit as u
|
|
28
28
|
import braintools
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
static_synapse, aeif_psc_delta_clopath)
|
|
30
|
+
import brainspike
|
|
32
31
|
|
|
33
32
|
# -- canonical cluster-07 spike-pairing protocol (NEST pynest example) ------------
|
|
34
33
|
DT = 0.1 # ms, resolution
|
|
@@ -75,7 +74,7 @@ LTP_TRAINS = range(5, 10)
|
|
|
75
74
|
def clopath_neuron(sim, n=1):
|
|
76
75
|
"""Create ``n`` ``aeif_psc_delta_clopath`` neurons with the canonical parameters."""
|
|
77
76
|
return sim.create(
|
|
78
|
-
aeif_psc_delta_clopath, n,
|
|
77
|
+
brainspike.aeif_psc_delta_clopath, n,
|
|
79
78
|
E_L=-70.6 * u.mV, V_peak=33.0 * u.mV, C_m=281.0 * u.pF, theta_minus=-70.6 * u.mV,
|
|
80
79
|
theta_plus=-45.3 * u.mV, A_LTD=14.0e-5, A_LTP=8.0e-5, tau_u_bar_minus=10.0 * u.ms,
|
|
81
80
|
tau_u_bar_plus=7.0 * u.ms, delay_u_bars=DELAY_UBARS * u.ms, a=4.0 * u.nS,
|
|
@@ -91,13 +90,13 @@ def pairing_weight(s_pre, s_post):
|
|
|
91
90
|
clamps the post with an 80 mV ``spike_generator`` at the postsynaptic times, and
|
|
92
91
|
reads the final stored weight with ``res.weight_trace``.
|
|
93
92
|
"""
|
|
94
|
-
sim = Simulator(dt=DT * u.ms)
|
|
93
|
+
sim = brainspike.Simulator(dt=DT * u.ms)
|
|
95
94
|
post = clopath_neuron(sim)
|
|
96
|
-
sg_pre = sim.create(spike_generator, spike_times=np.asarray(s_pre) * u.ms)
|
|
97
|
-
sg_post = sim.create(spike_generator, spike_times=np.asarray(s_post) * u.ms)
|
|
98
|
-
sim.connect(sg_post, post, synapse=static_synapse(weight=DRIVE_W * u.mV),
|
|
95
|
+
sg_pre = sim.create(brainspike.spike_generator, spike_times=np.asarray(s_pre) * u.ms)
|
|
96
|
+
sg_post = sim.create(brainspike.spike_generator, spike_times=np.asarray(s_post) * u.ms)
|
|
97
|
+
sim.connect(sg_post, post, synapse=brainspike.static_synapse(weight=DRIVE_W * u.mV),
|
|
99
98
|
delay=RELAY_D * u.ms)
|
|
100
|
-
proj = sim.connect(sg_pre, post, synapse=clopath_synapse(weight=INIT_W * u.mV),
|
|
99
|
+
proj = sim.connect(sg_pre, post, synapse=brainspike.clopath_synapse(weight=INIT_W * u.mV),
|
|
101
100
|
delay=RELAY_D * u.ms)
|
|
102
101
|
sim.record_weight(proj)
|
|
103
102
|
res = sim.simulate((10.0 + max(s_pre[-1], s_post[-1])) * u.ms)
|
|
@@ -149,7 +148,7 @@ def run():
|
|
|
149
148
|
|
|
150
149
|
def main():
|
|
151
150
|
rho, post_pre, pre_post, weights = run()
|
|
152
|
-
print("Clopath spike-pairing (
|
|
151
|
+
print("Clopath spike-pairing (brainspike, aeif_psc_delta_clopath, w in mV)")
|
|
153
152
|
for r, a, b in zip(rho, post_pre, pre_post):
|
|
154
153
|
print(f" {r:4.0f} Hz: post-pre {a:7.2f} % pre-post {b:7.2f} %")
|
|
155
154
|
|
|
@@ -161,8 +160,8 @@ def main():
|
|
|
161
160
|
plt.xlabel("rho (Hz)"); plt.ylabel("normalized weight change (%)")
|
|
162
161
|
plt.title("Clopath synapse -- spike pairing")
|
|
163
162
|
plt.legend(); plt.tight_layout()
|
|
164
|
-
plt.savefig("
|
|
165
|
-
print(" wrote
|
|
163
|
+
plt.savefig("clopath_synapse_spike_pairing.png", dpi=100)
|
|
164
|
+
print(" wrote clopath_synapse_spike_pairing.png")
|
|
166
165
|
except ImportError:
|
|
167
166
|
print(" (matplotlib not installed; skipping plot)")
|
|
168
167
|
|
|
@@ -16,7 +16,7 @@ the train); on the ``Simulator`` API a ``spike_generator`` drives the plastic ed
|
|
|
16
16
|
directly. Parameters follow ``pynest/examples/evaluate_tsodyks2_synapse.py`` and the
|
|
17
17
|
cluster-01 STP parity drive. ``tsodyks2_synapse`` delivers ``w_eff = x*u*weight``.
|
|
18
18
|
|
|
19
|
-
Run: python
|
|
19
|
+
Run: python references/nest-compatible/scripts/evaluate_tsodyks2_synapse.py
|
|
20
20
|
"""
|
|
21
21
|
import jax
|
|
22
22
|
import brainstate
|
|
@@ -27,8 +27,7 @@ import braintools
|
|
|
27
27
|
import numpy as np
|
|
28
28
|
import brainunit as u
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
tsodyks2_synapse)
|
|
30
|
+
import brainspike
|
|
32
31
|
|
|
33
32
|
#: Resolution (ms).
|
|
34
33
|
DT = 0.1
|
|
@@ -48,7 +47,7 @@ REGIMES = {
|
|
|
48
47
|
def _post(sim):
|
|
49
48
|
"""Build the linear, never-spiking ``iaf_psc_exp`` post (V_m == PSC train)."""
|
|
50
49
|
return sim.create(
|
|
51
|
-
iaf_psc_exp, 1, C_m=250. * u.pF, tau_m=20. * u.ms,
|
|
50
|
+
brainspike.iaf_psc_exp, 1, C_m=250. * u.pF, tau_m=20. * u.ms,
|
|
52
51
|
tau_syn_ex=3. * u.ms, tau_syn_in=3. * u.ms, t_ref=2. * u.ms,
|
|
53
52
|
E_L=0. * u.mV, V_reset=0. * u.mV, V_th=1e4 * u.mV,
|
|
54
53
|
V_initializer=braintools.init.Constant(0. * u.mV))
|
|
@@ -76,13 +75,13 @@ def run(regime="depression", weight=WEIGHT, train=TRAIN, t_sim=T_SIM):
|
|
|
76
75
|
Post membrane potential (mV) -- the PSC-amplitude train.
|
|
77
76
|
"""
|
|
78
77
|
p = REGIMES[regime]
|
|
79
|
-
sim = Simulator(dt=DT * u.ms)
|
|
78
|
+
sim = brainspike.Simulator(dt=DT * u.ms)
|
|
80
79
|
post = _post(sim)
|
|
81
|
-
sg = sim.create(spike_generator, spike_times=np.asarray(train) * u.ms)
|
|
82
|
-
sim.connect(sg, post, synapse=tsodyks2_synapse(
|
|
80
|
+
sg = sim.create(brainspike.spike_generator, spike_times=np.asarray(train) * u.ms)
|
|
81
|
+
sim.connect(sg, post, synapse=brainspike.tsodyks2_synapse(
|
|
83
82
|
weight=weight * u.pA, U=p["U"], u=p["u"], x=p["x"],
|
|
84
83
|
tau_rec=p["tau_rec"] * u.ms, tau_fac=p["tau_fac"] * u.ms))
|
|
85
|
-
mm = sim.create(multimeter, record_from=["V_m"], interval=DT * u.ms)
|
|
84
|
+
mm = sim.create(brainspike.multimeter, record_from=["V_m"], interval=DT * u.ms)
|
|
86
85
|
sim.connect(mm, post) # reversed: the multimeter observes the neuron
|
|
87
86
|
res = sim.simulate(t_sim * u.ms)
|
|
88
87
|
times = np.asarray(u.get_mantissa(res.times / u.ms))
|
|
@@ -120,7 +119,7 @@ def burst_peak_ratio(vm, train=TRAIN, dt=DT):
|
|
|
120
119
|
|
|
121
120
|
|
|
122
121
|
def main():
|
|
123
|
-
print("Tsodyks-2 STP (
|
|
122
|
+
print("Tsodyks-2 STP (brainspike, iaf_psc_exp post, V_m = PSC train)")
|
|
124
123
|
traces = {}
|
|
125
124
|
for regime in REGIMES:
|
|
126
125
|
t, v = run(regime)
|
|
@@ -137,8 +136,8 @@ def main():
|
|
|
137
136
|
plt.xlabel("time (ms)"); plt.ylabel("V_m (mV)")
|
|
138
137
|
plt.title("tsodyks2_synapse -- depression vs facilitation")
|
|
139
138
|
plt.legend(); plt.tight_layout()
|
|
140
|
-
plt.savefig("
|
|
141
|
-
print(" wrote
|
|
139
|
+
plt.savefig("evaluate_tsodyks2_synapse.png", dpi=100)
|
|
140
|
+
print(" wrote evaluate_tsodyks2_synapse.png")
|
|
142
141
|
except ImportError:
|
|
143
142
|
print(" (matplotlib not installed; skipping plot)")
|
|
144
143
|
|
|
@@ -9,17 +9,17 @@ source->target distance,
|
|
|
9
9
|
|
|
10
10
|
clipped to a circular mask of ``radius``. This is
|
|
11
11
|
``spatial.spatial_pairwise_bernoulli(p=spatial.gaussian(spatial.distance, std=...),
|
|
12
|
-
mask=spatial.circular(...))`` riding the ordinary :meth:`~
|
|
12
|
+
mask=spatial.circular(...))`` riding the ordinary :meth:`~brainspike.Simulator.connect`
|
|
13
13
|
-- the same call any non-spatial rule uses. The realized footprint of the central source
|
|
14
|
-
neuron is read back with :func:`~
|
|
14
|
+
neuron is read back with :func:`~brainspike.spatial.target_positions` (NEST
|
|
15
15
|
``GetTargetPositions``).
|
|
16
16
|
|
|
17
17
|
The per-distance connection probability is a fixed law, so the validation
|
|
18
|
-
(``
|
|
18
|
+
(``brainspike/_nest_validation/spatial_gaussian_kernel_test.py``) asserts the empirical
|
|
19
19
|
``p(d)`` follows the Gaussian (NEST-free) and matches live NEST's empirical curve within a
|
|
20
20
|
distributional band (PRNG draws diverge sample-by-sample; the law does not).
|
|
21
21
|
|
|
22
|
-
Run: PYTHONPATH=. python
|
|
22
|
+
Run: PYTHONPATH=. python references/nest-compatible/scripts/spatial_gaussex.py
|
|
23
23
|
"""
|
|
24
24
|
import jax
|
|
25
25
|
import brainstate
|
|
@@ -30,7 +30,7 @@ brainstate.environ.set(precision=64)
|
|
|
30
30
|
import numpy as np
|
|
31
31
|
import brainunit as u
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
import brainspike
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
def run(shape=(30, 30), extent=(3.0, 3.0), std=0.5, radius=3.0, seed=0):
|
|
@@ -68,18 +68,18 @@ def run(shape=(30, 30), extent=(3.0, 3.0), std=0.5, radius=3.0, seed=0):
|
|
|
68
68
|
>>> bool(tgt.shape[0] >= 1) # the centre connects to at least itself-at-distance-0
|
|
69
69
|
True
|
|
70
70
|
"""
|
|
71
|
-
sim =
|
|
72
|
-
pos =
|
|
73
|
-
a = sim.create(
|
|
74
|
-
b = sim.create(
|
|
71
|
+
sim = brainspike.Simulator(dt=0.1 * u.ms)
|
|
72
|
+
pos = brainspike.spatial.grid(list(shape), extent=list(extent))
|
|
73
|
+
a = sim.create(brainspike.iaf_psc_alpha, positions=pos)
|
|
74
|
+
b = sim.create(brainspike.iaf_psc_alpha, positions=pos)
|
|
75
75
|
sim.connect(
|
|
76
76
|
a, b,
|
|
77
|
-
rule=
|
|
78
|
-
p=
|
|
79
|
-
mask=
|
|
77
|
+
rule=brainspike.spatial.spatial_pairwise_bernoulli(
|
|
78
|
+
p=brainspike.spatial.gaussian(brainspike.spatial.distance, std=std),
|
|
79
|
+
mask=brainspike.spatial.circular(radius)),
|
|
80
80
|
weight=1.0 * u.pA, delay=1.0 * u.ms, seed=seed)
|
|
81
|
-
ctr =
|
|
82
|
-
target_pos =
|
|
81
|
+
ctr = brainspike.spatial.center_element(pos)
|
|
82
|
+
target_pos = brainspike.spatial.target_positions(sim, a[ctr], b)[0]
|
|
83
83
|
return sim.get_position(a), ctr, target_pos
|
|
84
84
|
|
|
85
85
|
|
|
@@ -87,7 +87,7 @@ def main():
|
|
|
87
87
|
coords, ctr, target_pos = run()
|
|
88
88
|
xy = np.asarray(u.get_magnitude(coords.to(u.um)))
|
|
89
89
|
tgt = np.asarray(u.get_magnitude(target_pos.to(u.um)))
|
|
90
|
-
print('spatial_gaussex (
|
|
90
|
+
print('spatial_gaussex (brainspike)')
|
|
91
91
|
print(f' {xy.shape[0]} nodes; centre node {ctr} has {tgt.shape[0]} realized targets')
|
|
92
92
|
try:
|
|
93
93
|
import matplotlib.pyplot as plt
|
|
@@ -102,10 +102,10 @@ def main():
|
|
|
102
102
|
plt.axis([-2.0, 2.0, -2.0, 2.0])
|
|
103
103
|
plt.grid(True)
|
|
104
104
|
plt.legend(loc='upper right')
|
|
105
|
-
plt.title('Connection targets, Gaussian kernel (
|
|
105
|
+
plt.title('Connection targets, Gaussian kernel (brainspike)')
|
|
106
106
|
plt.tight_layout()
|
|
107
|
-
plt.savefig('
|
|
108
|
-
print(' wrote
|
|
107
|
+
plt.savefig('spatial_gaussex.png', dpi=100)
|
|
108
|
+
print(' wrote spatial_gaussex.png')
|
|
109
109
|
|
|
110
110
|
|
|
111
111
|
if __name__ == '__main__':
|
|
@@ -8,14 +8,14 @@ distributions, retrieves the connections with ``nest.GetConnections()`` (a
|
|
|
8
8
|
``SynapseCollection``), and reads / sets ``.source``, ``.target``, ``.weight`` to
|
|
9
9
|
build weight matrices. This port reproduces every idiom with
|
|
10
10
|
:meth:`Simulator.get_connections` and
|
|
11
|
-
:class:`~
|
|
11
|
+
:class:`~brainspike.SynapseCollection`:
|
|
12
12
|
|
|
13
13
|
* ``get(['source', 'target', 'weight'])`` — read several attributes at once;
|
|
14
14
|
* ``set('weight', values)`` — per-edge write-back, round-tripped through ``get``;
|
|
15
15
|
* ``get_connections()`` — every edge; ``get_connections(src, tgt)`` — a
|
|
16
16
|
source/target slice; ``get_connections(synapse=model)`` — one synapse model.
|
|
17
17
|
|
|
18
|
-
Three faithful adaptations to ``
|
|
18
|
+
Three faithful adaptations to ``brainspike``:
|
|
19
19
|
|
|
20
20
|
* **one_to_one is per-edge here.** NEST's ``one_to_one`` uses the per-edge-settable
|
|
21
21
|
default ``static_synapse``; the homogeneous ``one_to_one`` *EventProjection*
|
|
@@ -24,7 +24,7 @@ Three faithful adaptations to ``brainpy.state``:
|
|
|
24
24
|
(same realized connectivity, per-edge weights).
|
|
25
25
|
* **Distributional weights are sampled at connect on the static path.** The
|
|
26
26
|
``all_to_all`` block draws ``Uniform(0.5, 4.5)`` pA with the ``dist`` API (the
|
|
27
|
-
|
|
27
|
+
brainspike ``Parameter`` analogue, sampled once at ``connect``). The plastic
|
|
28
28
|
``stdp_synapse`` connects take a concrete initial weight (the rule evolves it
|
|
29
29
|
during ``simulate``), so the complex block uses fixed initial weights there.
|
|
30
30
|
* **Population-local indices.** ``source`` / ``target`` index within their
|
|
@@ -32,7 +32,7 @@ Three faithful adaptations to ``brainpy.state``:
|
|
|
32
32
|
|
|
33
33
|
The demo is pure introspection — it never calls ``simulate()``.
|
|
34
34
|
|
|
35
|
-
Run: PYTHONPATH=. python
|
|
35
|
+
Run: PYTHONPATH=. python references/nest-compatible/scripts/synapsecollection.py
|
|
36
36
|
"""
|
|
37
37
|
import jax
|
|
38
38
|
import brainstate
|
|
@@ -42,10 +42,7 @@ brainstate.environ.set(precision=64)
|
|
|
42
42
|
import numpy as np
|
|
43
43
|
import brainunit as u
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
pairwise_bernoulli, fixed_total_number, fixed_indegree,
|
|
47
|
-
static_synapse, stdp_synapse)
|
|
48
|
-
from brainpy.state import dist
|
|
45
|
+
import brainspike
|
|
49
46
|
|
|
50
47
|
DT = 0.1 # resolution [ms]
|
|
51
48
|
|
|
@@ -91,10 +88,10 @@ def build_one_to_one(n=10):
|
|
|
91
88
|
plastic path (not the homogeneous ``one_to_one`` EventProjection), so the
|
|
92
89
|
upstream's per-edge weight ``set`` round-trips.
|
|
93
90
|
"""
|
|
94
|
-
sim = Simulator(dt=DT * u.ms)
|
|
95
|
-
nrns = sim.create(iaf_psc_alpha, n)
|
|
96
|
-
sim.connect(nrns, nrns, rule=one_to_one,
|
|
97
|
-
synapse=static_synapse(weight=1. * u.pA))
|
|
91
|
+
sim = brainspike.Simulator(dt=DT * u.ms)
|
|
92
|
+
nrns = sim.create(brainspike.iaf_psc_alpha, n)
|
|
93
|
+
sim.connect(nrns, nrns, rule=brainspike.one_to_one,
|
|
94
|
+
synapse=brainspike.static_synapse(weight=1. * u.pA))
|
|
98
95
|
return sim, nrns
|
|
99
96
|
|
|
100
97
|
|
|
@@ -104,11 +101,11 @@ def build_all_to_all(n_pre=10, n_post=5, seed=0):
|
|
|
104
101
|
Returns ``(sim, pre, post)``. Weights are drawn once at ``connect`` from the
|
|
105
102
|
``dist`` Parameter API (the static path samples distributions eagerly).
|
|
106
103
|
"""
|
|
107
|
-
sim = Simulator(dt=DT * u.ms)
|
|
108
|
-
pre = sim.create(iaf_psc_alpha, n_pre)
|
|
109
|
-
post = sim.create(iaf_psc_alpha, n_post)
|
|
110
|
-
sim.connect(pre, post, rule=all_to_all,
|
|
111
|
-
weight=dist.Uniform(0.5 * u.pA, 4.5 * u.pA), comm='sparse', seed=seed)
|
|
104
|
+
sim = brainspike.Simulator(dt=DT * u.ms)
|
|
105
|
+
pre = sim.create(brainspike.iaf_psc_alpha, n_pre)
|
|
106
|
+
post = sim.create(brainspike.iaf_psc_alpha, n_post)
|
|
107
|
+
sim.connect(pre, post, rule=brainspike.all_to_all,
|
|
108
|
+
weight=brainspike.dist.Uniform(0.5 * u.pA, 4.5 * u.pA), comm='sparse', seed=seed)
|
|
112
109
|
return sim, pre, post
|
|
113
110
|
|
|
114
111
|
|
|
@@ -120,23 +117,23 @@ def build_complex(n=15, seed=0):
|
|
|
120
117
|
``fixed_total_number`` static block, an ``all_to_all`` ``stdp_synapse``, and a
|
|
121
118
|
``fixed_indegree`` static block.
|
|
122
119
|
"""
|
|
123
|
-
sim = Simulator(dt=DT * u.ms)
|
|
124
|
-
nrns = sim.create(iaf_psc_alpha, n)
|
|
125
|
-
sim.connect(nrns[:5], nrns[:5], rule=one_to_one,
|
|
126
|
-
synapse=stdp_synapse(weight=5. * u.pA))
|
|
127
|
-
sim.connect(nrns[:10], nrns[5:12], rule=pairwise_bernoulli(0.4),
|
|
120
|
+
sim = brainspike.Simulator(dt=DT * u.ms)
|
|
121
|
+
nrns = sim.create(brainspike.iaf_psc_alpha, n)
|
|
122
|
+
sim.connect(nrns[:5], nrns[:5], rule=brainspike.one_to_one,
|
|
123
|
+
synapse=brainspike.stdp_synapse(weight=5. * u.pA))
|
|
124
|
+
sim.connect(nrns[:10], nrns[5:12], rule=brainspike.pairwise_bernoulli(0.4),
|
|
128
125
|
weight=4. * u.pA, comm='sparse', seed=seed)
|
|
129
|
-
sim.connect(nrns[5:10], nrns[:5], rule=fixed_total_number(5),
|
|
126
|
+
sim.connect(nrns[5:10], nrns[:5], rule=brainspike.fixed_total_number(5),
|
|
130
127
|
weight=3. * u.pA, comm='sparse', seed=seed)
|
|
131
|
-
sim.connect(nrns[10:], nrns[:12], rule=all_to_all,
|
|
132
|
-
synapse=stdp_synapse(weight=4. * u.pA))
|
|
133
|
-
sim.connect(nrns, nrns[12:], rule=fixed_indegree(3),
|
|
128
|
+
sim.connect(nrns[10:], nrns[:12], rule=brainspike.all_to_all,
|
|
129
|
+
synapse=brainspike.stdp_synapse(weight=4. * u.pA))
|
|
130
|
+
sim.connect(nrns, nrns[12:], rule=brainspike.fixed_indegree(3),
|
|
134
131
|
weight=1. * u.pA, comm='sparse', seed=seed)
|
|
135
132
|
return sim, nrns
|
|
136
133
|
|
|
137
134
|
|
|
138
135
|
def main():
|
|
139
|
-
print("synapsecollection: SynapseCollection introspection tour (
|
|
136
|
+
print("synapsecollection: SynapseCollection introspection tour (brainspike)")
|
|
140
137
|
|
|
141
138
|
# 1. one_to_one: identity, then a per-edge weight set.
|
|
142
139
|
sim, nrns = build_one_to_one(10)
|
|
@@ -188,8 +185,8 @@ def main():
|
|
|
188
185
|
"stdp_synapse only")
|
|
189
186
|
_plot(axes[1, 1], ftn, "fixed_total_number, set weight")
|
|
190
187
|
fig.tight_layout()
|
|
191
|
-
fig.savefig("
|
|
192
|
-
print(" wrote
|
|
188
|
+
fig.savefig("synapsecollection.png", dpi=100)
|
|
189
|
+
print(" wrote synapsecollection.png")
|
|
193
190
|
except ImportError:
|
|
194
191
|
print(" (matplotlib not installed; skipping plot)")
|
|
195
192
|
|
package/skills/package-skills/brainspike/references/nest-compatible/synapse-and-connectivity.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Synapse and connectivity
|
|
2
|
+
|
|
3
|
+
Use this reference when selecting a NEST-compatible synapse or plasticity rule, choosing canonical connectivity, constructing a unitful synapse spec, or reading and writing realized edges. Use `references/nest-compatible/network-building.md` for the complete connection-rule and projection-class map, and `references/nest-compatible/divergence-and-parity.md` for STDP parameter relocation and numerical bands.
|
|
4
|
+
|
|
5
|
+
## Connection rules
|
|
6
|
+
|
|
7
|
+
Use these APIs to choose realized source-target pairs; choose the synapse spec separately to define what each realized edge does.
|
|
8
|
+
|
|
9
|
+
| API | Use when |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `brainspike.all_to_all` | Use when every source must connect to every target, including the default generator fan-out. |
|
|
12
|
+
| `brainspike.one_to_one` | Use when source `i` must connect to target `i`; source and target views must have equal-size pairings. |
|
|
13
|
+
| `brainspike.fixed_indegree(k)` | Use when every target must receive exactly `k` randomly drawn presynaptic edges. |
|
|
14
|
+
| `brainspike.spatial.spatial_pairwise_bernoulli(p, mask=None, allow_autapses=True)` | Use when connection probability or eligibility depends on distance. |
|
|
15
|
+
|
|
16
|
+
Set `seed` to reproduce a BrainSpike random realization. For `fixed_indegree`, set `allow_multapses=True` to match NEST's default and use `comm="sparse"` for large event fan-in. Open `references/nest-compatible/network-building.md` for the remaining rule constructors.
|
|
17
|
+
|
|
18
|
+
## Static synapses
|
|
19
|
+
|
|
20
|
+
Use these constructors when edge weights do not change through activity-dependent learning.
|
|
21
|
+
|
|
22
|
+
| Constructor | Use when |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `brainspike.static_synapse(*args, **kwargs)` | Use the default fixed-weight, fixed-delay synapse spec. |
|
|
25
|
+
| `brainspike.static_synapse_hom_w(*args, **kwargs)` | Use one homogeneous weight shared across all realized connections. |
|
|
26
|
+
| `brainspike.bernoulli_synapse(*args, **kwargs)` | Use fixed structural edges with stochastic Bernoulli transmission. |
|
|
27
|
+
| `brainspike.cont_delay_synapse(*args, **kwargs)` | Use a continuous sub-timestep delay. |
|
|
28
|
+
|
|
29
|
+
Pass `synapse=None` to `Simulator.connect()` for the ordinary static event path; instantiate a static spec only when its specialized behavior is required.
|
|
30
|
+
|
|
31
|
+
## Gap junctions and special connections
|
|
32
|
+
|
|
33
|
+
Use these constructors for electrical, diffusion, rate, or astrocyte slow-inward-current coupling rather than ordinary static spike transmission.
|
|
34
|
+
|
|
35
|
+
| Constructor | Use when |
|
|
36
|
+
|---|---|
|
|
37
|
+
| `brainspike.gap_junction(*args, **kwargs)` | Use electrical synaptic coupling with a compatible gap-junction neuron. |
|
|
38
|
+
| `brainspike.diffusion_connection(*args, **kwargs)` | Use the NEST-compatible diffusion connection. |
|
|
39
|
+
| `brainspike.rate_connection_instantaneous(*args, **kwargs)` | Use rate coupling without a connection delay. |
|
|
40
|
+
| `brainspike.rate_connection_delayed(*args, **kwargs)` | Use delayed rate coupling. |
|
|
41
|
+
| `brainspike.sic_connection(*args, **kwargs)` | Use astrocyte-to-neuron slow inward current coupling. |
|
|
42
|
+
|
|
43
|
+
## Short-term plasticity
|
|
44
|
+
|
|
45
|
+
Use these constructors for transient, reversible efficacy changes on the timescale of individual spikes.
|
|
46
|
+
|
|
47
|
+
| Constructor | Use when |
|
|
48
|
+
|---|---|
|
|
49
|
+
| `brainspike.tsodyks_synapse(*args, **kwargs)` | Use the Tsodyks-Uziel-Markram short-term-plasticity rule. |
|
|
50
|
+
| `brainspike.tsodyks_synapse_hom(*args, **kwargs)` | Use the homogeneous shared-parameter Tsodyks form. |
|
|
51
|
+
| `brainspike.tsodyks2_synapse(*args, **kwargs)` | Use the two-variable Tsodyks form. |
|
|
52
|
+
| `brainspike.quantal_stp_synapse(*args, **kwargs)` | Use the quantal/binomial short-term-plasticity form. |
|
|
53
|
+
|
|
54
|
+
## Spike-timing-dependent plasticity
|
|
55
|
+
|
|
56
|
+
Use these constructors for long-term weight changes driven by pre-post spike timing; select the pairing, weight-dependence, triplet, hardware, or dopamine rule explicitly.
|
|
57
|
+
|
|
58
|
+
| Constructor | Use when |
|
|
59
|
+
|---|---|
|
|
60
|
+
| `brainspike.stdp_synapse(*args, **kwargs)` | Use pair-based STDP. |
|
|
61
|
+
| `brainspike.stdp_synapse_hom(*args, **kwargs)` | Use pair-based STDP with homogeneous shared parameters. |
|
|
62
|
+
| `brainspike.stdp_pl_synapse_hom(*args, **kwargs)` | Use power-law STDP. |
|
|
63
|
+
| `brainspike.stdp_facetshw_synapse_hom(*args, **kwargs)` | Use the FACETS/BrainScaleS hardware-emulating rule. |
|
|
64
|
+
| `brainspike.stdp_nn_pre_centered_synapse(*args, **kwargs)` | Use presynaptic-centered nearest-neighbour pairing. |
|
|
65
|
+
| `brainspike.stdp_nn_restr_synapse(*args, **kwargs)` | Use restricted symmetric nearest-neighbour pairing. |
|
|
66
|
+
| `brainspike.stdp_nn_symm_synapse(*args, **kwargs)` | Use symmetric nearest-neighbour pairing. |
|
|
67
|
+
| `brainspike.stdp_triplet_synapse(*args, **kwargs)` | Use triplet STDP. |
|
|
68
|
+
| `brainspike.stdp_dopamine_synapse(*args, **kwargs)` | Use dopamine-modulated STDP with a `volume_transmitter`. |
|
|
69
|
+
|
|
70
|
+
Open `references/nest-compatible/divergence-and-parity.md` before porting `tau_minus`, Clopath parameters, dopamine State, or a nearest-neighbour pairing rule.
|
|
71
|
+
|
|
72
|
+
## Voltage-based and specialized learning
|
|
73
|
+
|
|
74
|
+
Use these constructors when the weight update depends on voltage trajectories, dendritic prediction, inhibitory timing, or the Hill-Tononi vesicle pool.
|
|
75
|
+
|
|
76
|
+
| Constructor | Use when |
|
|
77
|
+
|---|---|
|
|
78
|
+
| `brainspike.clopath_synapse(*args, **kwargs)` | Use voltage-based Clopath plasticity with a compatible `_clopath` neuron. |
|
|
79
|
+
| `brainspike.jonke_synapse(*args, **kwargs)` | Use exponential weight-dependence STDP. |
|
|
80
|
+
| `brainspike.urbanczik_synapse(*args, **kwargs)` | Use dendritic prediction-error plasticity with `pp_cond_exp_mc_urbanczik`. |
|
|
81
|
+
| `brainspike.vogels_sprekeler_synapse(*args, **kwargs)` | Use symmetric inhibitory plasticity. |
|
|
82
|
+
| `brainspike.ht_synapse(*args, **kwargs)` | Use Hill-Tononi vesicle-pool depression. |
|
|
83
|
+
|
|
84
|
+
## Synapse specification
|
|
85
|
+
|
|
86
|
+
Use these `Simulator.connect()` arguments to attach a selected rule to realized edges.
|
|
87
|
+
|
|
88
|
+
| Argument | Use |
|
|
89
|
+
|---|---|
|
|
90
|
+
| `weight=<quantity>` | Use signed current such as `pA` for current-based event input; use voltage such as `mV` for the instantaneous jump of `iaf_psc_delta`. |
|
|
91
|
+
| `delay=<time quantity>` | Use for a homogeneous axonal delay. |
|
|
92
|
+
| `weight=[...] * unit` | Use for a multi-channel generator with one signed weight per channel. |
|
|
93
|
+
| `seed=<int>` | Use to reproduce the BrainSpike random edge realization. |
|
|
94
|
+
| `allow_multapses=<bool>` | Use to permit or forbid repeated source-target edges under a random rule. |
|
|
95
|
+
| `comm="dense"` or `comm="sparse"` | Use to select the communication backend without changing the rule. |
|
|
96
|
+
| `synapse=<spec>` | Use to attach any constructor from the synapse families above. |
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
projection = sim.connect(
|
|
100
|
+
exc,
|
|
101
|
+
exc + inh,
|
|
102
|
+
rule=brainspike.fixed_indegree(80),
|
|
103
|
+
weight=0.1 * u.pA,
|
|
104
|
+
delay=1.5 * u.ms,
|
|
105
|
+
seed=1,
|
|
106
|
+
allow_multapses=True,
|
|
107
|
+
comm="sparse",
|
|
108
|
+
)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Invariant:** Do not copy one weight unit across neuron families. `iaf_psc_delta` consumes a voltage jump, while canonical alpha- and exponential-current events consume current.
|
|
112
|
+
|
|
113
|
+
## Plastic connection workflow
|
|
114
|
+
|
|
115
|
+
Use `synapse=` when the edge needs State or behavior beyond static weight and delay.
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
plasticity = brainspike.tsodyks2_synapse(
|
|
119
|
+
weight=250.0 * u.pA,
|
|
120
|
+
U=0.67,
|
|
121
|
+
tau_rec=450.0 * u.ms,
|
|
122
|
+
tau_fac=0.0 * u.ms,
|
|
123
|
+
)
|
|
124
|
+
projection = sim.connect(spike_source, post, synapse=plasticity)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Invariant:** A BrainSpike `spike_generator` can drive a plastic edge directly. Do not add a `parrot_neuron` solely because the NEST version required one.
|
|
128
|
+
|
|
129
|
+
## Realized-connectivity inspection
|
|
130
|
+
|
|
131
|
+
Use these methods after construction to inspect or update the live edges selected by the rule.
|
|
132
|
+
|
|
133
|
+
| API | Use when |
|
|
134
|
+
|---|---|
|
|
135
|
+
| `sim.get_connections(source=None, target=None, synapse=None)` | Use to obtain an empty or populated lazy `SynapseCollection` filtered by source, target, or synapse name. |
|
|
136
|
+
| `connections.get(key)` | Use one key to read live `source`, `target`, `weight`, or `delay`, or a sequence to return several attributes as a dictionary; weights and delays retain units. |
|
|
137
|
+
| `connections.set(key, value)` | Use to write supported static `weight` or `delay` values; homogeneous, plastic, and other weight-evolving projections can reject the write. |
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
connections = sim.get_connections(source=exc, target=inh)
|
|
141
|
+
edge_data = connections.get(["source", "target", "weight", "delay"])
|
|
142
|
+
|
|
143
|
+
assert edge_data["source"].shape == edge_data["target"].shape
|
|
144
|
+
assert edge_data["weight"].shape == edge_data["source"].shape
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`SynapseCollection` re-reads live weights and delays, so a collection created before simulation reflects later plastic changes. Source and target indices are population-local, not global NEST node IDs.
|
|
148
|
+
|
|
149
|
+
## Official sources
|
|
150
|
+
|
|
151
|
+
- https://brainx.chaobrain.com/brainspike/apis/nest-synapses.html
|
|
152
|
+
- https://brainx.chaobrain.com/brainspike/apis/nest-plasticity.html
|
|
153
|
+
- https://brainx.chaobrain.com/brainspike/nest-style/connectivity.html
|
|
154
|
+
|
|
155
|
+
## Assign distinct delays to target subsets
|
|
156
|
+
|
|
157
|
+
Use separate connection calls when target groups need different delays. Preserve the source population and the target slice identity:
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
sim.connect(source, targets[:1], weight=30*u.mV, delay=0.5*u.ms)
|
|
161
|
+
sim.connect(source, targets[1:2], weight=30*u.mV, delay=1.5*u.ms)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
This delta-synapse fixture uses voltage-valued weights. With `dt=0.1 ms`, one generated spike produces target arrivals ten steps apart for these two delays; verify relative arrivals instead of assuming a legacy ring-buffer timestamp convention. This verifies heterogeneous delays across separate projections, not arbitrary per-edge delay arrays in one projection.
|
|
165
|
+
|
|
166
|
+
Open `references/nest-delay-boundaries.md` before generalizing the scalar examples to delay arrays, explicit specs, or fractional delays. It records tested default-path forms and a BrainSpikes 0.2.0 explicit-spec amplitude anomaly that a spike-time-only test misses.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Select a verified NEST delay path
|
|
2
|
+
|
|
3
|
+
In BrainSpikes 0.2.0, delay support differs between the default static projection, explicit synapse specifications, and mutable connection setters. Verify actual transmission before replacing one path with another.
|
|
4
|
+
|
|
5
|
+
## Choose the construction path
|
|
6
|
+
|
|
7
|
+
| API | Verified use or limit |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `sim.connect(pre, post, weight=..., delay=array)` | The default static path accepts the tested one-source/two-target vector and delivers at distinct delays. |
|
|
10
|
+
| Separate scalar-delay `connect()` calls | The tested two-by-two source/target delay matrix works when expressed as four scalar connections. |
|
|
11
|
+
| Matrix delay in one `connect()` | The tested ordinary-neuron two-by-two matrix changes target State shape and fails with a scan carry-type error. Do not assume arbitrary array shapes are supported. |
|
|
12
|
+
| `static_synapse(delay=array)` / `cont_delay_synapse(delay=array)` | Both tested explicit-spec array paths fail scalar conversion. |
|
|
13
|
+
| `get_connections().set("delay", ...)` on the tested static-synapse spec | Rejected because the underlying spec projection fixes delay at construction. This does not establish every setter path's behavior. |
|
|
14
|
+
|
|
15
|
+
Open `scripts/nest_boundary_workflows.py` for `delay_arrivals` and `neuron_delay_matrix`. The two-by-two grouping fixture preserves the specified edge pairs and delays; it is a correctness fallback, not a scalable implementation of arbitrary large delay matrices.
|
|
16
|
+
|
|
17
|
+
## Verify fractional transmission with continuous traces
|
|
18
|
+
|
|
19
|
+
The current-based `iaf_psc_exp` fixture uses one source spike, a `0.1 ms` integration step, and a `250 pA` connection. For delay `0.24 ms`, both the default path and `cont_delay_synapse` produce the weighted trajectory `0.6*V(0.2 ms)+0.4*V(0.3 ms)`, with maximum error about `4.4e-16 mV` against default-path endpoints.
|
|
20
|
+
|
|
21
|
+
This verifies a grid-level fractional-amplitude interpolation for that continuous observable. It is not an exact continuously timed binary event. A high-amplitude delta target can report only one later grid spike while the underlying drive spans two bins; spike time alone is insufficient to establish fractional behavior.
|
|
22
|
+
|
|
23
|
+
**Release-scoped anomaly:** with the same source/current target at delay `0.3 ms`, the explicit `static_synapse` and `cont_delay_synapse` traces differ markedly from the default static connection. The observed maximum discrepancies are approximately `1.331` and `1.323 mV`; the explicit-spec peak is about twice the default peak. Do not treat all scalar spec delays as interchangeable or assume this is only timestamp quantization. Use the default path for the verified fixture and require an impulse/amplitude check at the intended delay before choosing another spec. No package implementation was modified to hide this behavior.
|
|
24
|
+
|
|
25
|
+
Open `scripts/nest_boundary_workflows.py` for `voltage_trace` and the executable counterexample. The pinned regression records these failures as boundaries, not as capabilities that should be generalized to every later release.
|
|
26
|
+
|
|
27
|
+
Open `references/native-delays.md` for integer native buffer integration, and `references/nest-compatible/divergence-and-parity.md` before claiming parity with live NEST or its precise-spiking models.
|
|
28
|
+
|
|
29
|
+
## Source
|
|
30
|
+
|
|
31
|
+
[Continuous-delay synapse](https://brainx.chaobrain.com/brainspike/apis/generated/brainspike.cont_delay_synapse.html). This live page describes the intended delay scheme; the local release-scoped experiments establish the narrower tested behavior and counterexample above.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Share nonlinear synaptic State conditionally
|
|
2
|
+
|
|
3
|
+
Share a source trace only when the represented outgoing receptor dynamics have the same kinetic parameters, initial State, and input history at the times being compared. Nonlinearity does not forbid source sharing, but it generally forbids aggregating independent source drives before applying the nonlinear dynamics.
|
|
4
|
+
|
|
5
|
+
## Compare against an edge reference
|
|
6
|
+
|
|
7
|
+
| API | Use |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `brainspike.Synapse` | Define a native receptor state with its own update equation and explicit shape. |
|
|
10
|
+
| `SaturatingSynapse` in `scripts/advanced_native_patterns.py` | Use the verified exact constant-drive step for `dr/dt = alpha*s*(1-r)-beta*r`. |
|
|
11
|
+
| Source-shaped State `(N_pre,)` | Use when the outgoing trace-sharing conditions hold; apply connectivity after evaluating receptor State. |
|
|
12
|
+
| Edge-shaped State `(N_pre,N_post)` | Keep distinct kinetics or input histories when the source-sharing conditions fail. |
|
|
13
|
+
|
|
14
|
+
The fixture assumes nonnegative input/alpha, positive beta, and initial receptor occupancy in `[0,1]`. It solves one step analytically with physical time; it is a mechanics model, not a claim to reproduce every AMPA/NMDA implementation.
|
|
15
|
+
|
|
16
|
+
For homogeneous outgoing kinetics, the Docker check computes source traces and a separate per-edge reference, then applies the same conductance weights. Their target conductances agree exactly in the tested sequence. A second check changes outgoing edge kinetics and demonstrates that reusing the original source trace changes the target response. Another counterexample sums two source drives before saturation and produces a different result from summing independently saturated traces.
|
|
17
|
+
|
|
18
|
+
Open `scripts/advanced_native_patterns.py` for the canonical class. Instantiate a source-shaped and an edge-shaped filter, initialize their State, advance both with the same source events broadcast appropriately, and compare weighted target outputs before optimizing storage.
|
|
19
|
+
|
|
20
|
+
Do not reuse a current source trace for edge-specific arrival histories without representing those delays. Do not describe target-aligned nonlinear aggregation as an exact replacement for the original network. Keep separate source, receptor, or edge State where the model requires it; preserve all scientifically distinct parameters.
|
|
21
|
+
|
|
22
|
+
Open `references/native-projections.md` for the complete chemical-current order and linear target-alignment conditions. Open `references/native-delays.md` before adding signal history. The native implementation replaces the modeling capability without restoring retired AlignPre/AlignPost wrapper APIs.
|
|
23
|
+
|
|
24
|
+
## Source
|
|
25
|
+
|
|
26
|
+
[BrainSpike Synapse contract](https://brainx.chaobrain.com/brainspike/apis/generated/brainspike.Synapse.html). Equivalence and counterexamples are checked in the pinned BrainSpikes 0.2.0 Docker runtime.
|