The package is the Base package of SpikingNeuralNetworks.jl. It contains model types and core functionalities for the SpikingNeuralNetworks.jl ecosystem.
The package defines models and parameters for Population, Connection, and Stimulus:
Population <: AbstractPopulationConnection <: AbstractConnectionStimulus <: AbstractStimulusPopulationParameter <: AbstractPopulationParameterConnectionParameter <: AbstractConnectionParameterStimulusParameter <: AbstractStimulusParameterSpikeTimes = Vector{Vector{Float32}}.
Populations, connections, and stimuli are defined under the respective folders in src
Under src/utils, the package defines macros and functions that support the functionalities of the SpikingNeuralNetwork.jl ecosystem:
struct.jldefines the abstract model types.main.jldefines thesim!andtrain!functions that run the network simulations.io.jldefines functions to save and load models using.jld2format.record.jlimplements the recording ofthe model's variables during simulation time.macros.jlimplements useful macros to define model types and update parameter structs.spatial.jldefines functions to create spatial network arrangements.unit.jldefines convenient shortcut for cgm unit system.util.jladd functions to manipulate sparse matrix representations.
The library leverages Julia multidispatching to run models of types <: AbstractPopulation,
<: AbstractConnection, and AbstractStimulus.
function sim!(p::Vector{AbstractPopulation}, c::Vector{AbstractConnection}, duration<:Real) end
function train!(p::Vector{AbstractConnection}, c:Vector{AbstractConnection}, duration<:Real) endThe functions support simulation with and without neural plasticity: sim! propagates spikes with frozen weights, train! additionally calls update_traces! and plasticity! (STDP, iSTDP, vSTDP, STP). A synapse with an LTPParam does not learn under sim!. The model is defined within the arguments passed to the functions.
Models are composed of 'AbstractPopulation' and 'AbstractConnection' arrays.
Any elements of AbstractPopulation must implement the methods:
function integrate!(p, p.param, dt) end
function plasticity!(p, p.param, dt, T) end
AbstractConnection must implement the methods:
function forward!(p, p.param) end
function plasticity!(c, c.param, dt) endAbstractStimulus must implement the methods:
function stimulate!(p, p.param) endLong-term plasticity rules are passed to SpikingSynapse with the LTPParam keyword and run under train!.
| Rule | Description |
|---|---|
STDPGerstner |
additive pair STDP, all-to-all, signed amplitudes A_pre, A_post (default A_post < 0) |
STDPTriplet |
minimal triplet rule of Pfister & Gerstner (2006), all-to-all (Auryn MinimalTriplet) |
STDPWeightDependent |
soft-bound pair STDP of Gütig et al. (2003) (Auryn STDPwd) |
STDPConfavreux2025 |
pair STDP with rate terms |
STDPMexicanHat, STDPSymmetric, STDPAntiSymmetric |
kernels with zero integral / structured inhibition (Euler traces) |
iSTDPRate, iSTDPPotential |
inhibitory STDP of Vogels et al. (2011) |
vSTDPParameter, vSTDPDenseParameter |
voltage-based STDP of Clopath et al. (2010), event-driven (default, lazy weights: plasticity_value(syn, :W)) and clock-driven reference |
The trace-based pair and triplet rules are event-driven with Auryn's ordering (pre spike: LTD
from the postsynaptic trace over outgoing synapses; post spike: LTP from the presynaptic trace
over incoming synapses; traces read before the current step's spikes). They agree with Brian2
(2e-6) and Auryn (2e-7). Details: src/connections/sparse_plasticity/STDP_kernels.jl.
- Bug fix,
get_git_commit_hash. Outside a git repository (e.g. cluster jobs run from a copied directory) it threw, sowrite_configaborted the run. It now warns once and records"unknown";GIT_DIR/GIT_WORK_TREEare still honoured.
- Bug fix,
CurrentStimuluson a neuron subset. WithCurrentNoiseand aneuronssubset whose ids exceedlength(neurons)(e.g.neurons = 51:100on a 100-neuron population), the random cache was indexed by neuron id and read past its end: wrong noise values without bounds checking, aBoundsErrorwith it.neurons = :ALLwas not affected. - Bug fix,
MultiReceptorSynapse(syn). The positional constructor referenced undefined names; it now matches the keyword formMultiReceptorSynapse(; syn). - Clean-up,
SomaNMDA. A first definition withb = 3.57, k = -0.062was always overridden byNMDAVoltageDependency()(b = 3.36, k = -0.077); the dead definition is removed. The effective value is unchanged.
- Bug fix, iSTDP. In
iSTDPRate(and the formeriSTDPTime) the potentiation at a postsynaptic spike was applied to the wrong synapses (a@turboloop with a reassigned loop variable). Affected: SNNModels 1.5.0 - 1.8.1 and SpikingNeuralNetworks.jl 1.0.0 onwards. Results obtained with these versions change; rerun simulations that used them. - Behaviour change,
STDPGerstner. The amplitudesA_pre/A_postwere applied twice (effectiveA^2, sign lost). They are now applied once, and the defaultA_postis-1e-4. - New rules:
STDPTriplet,STDPWeightDependent. - Behaviour change,
sparse_matrix. Built directly in CSC form (no denseNpost x Nprematrix); seeded networks no longer reproduce earlier realisations (identical statistics); autapses are removed structurally. The old generator isSNNModels.sparse_matrix_dense_legacy. - Float32 by default, Float64 by the population type. Synaptic data (weights, delays, STP
ρ, plasticity state) take the precision of the target population at the constructor boundary:Identity(N = 10, VFT = Vector{Float64})orIF(N = 10, VFT = Vector{Float64})make everything built on themFloat64(seefloat_type). - Event-driven STDP is 18-83x faster than the clock-driven implementation (see
claude/performance.md).