Stimuli
Basic types
SNNModels.AbstractConnectionParameter — Type
AbstractConnectionParameter <: AbstractParameterSNNModels.AbstractParameter — Type
AbstractParameterAn abstract type representing a parameter.
SpikeTime Stimulus
SNNModels.SpikeTimeStimulusParameter — Type
SpikeTimeStimulusParameter{VFT, VIT} <: AbstractStimulusParameterA parameter structure for spike time stimulus in spiking neural networks. Users are encouraged to create instances of this struct using the provided constructors rather than directly instantiating it. This will ensure that the spike times and neuron indices are properly sorted and with the correct types.
Fields
spiketimes::VFT: Vector of spike times (default:Float32[])neurons::VIT: Vector of neuron indices corresponding to each spike time (default:Int[])
Constructors
SpikeTimeStimulusParameter(spiketimes, neurons): Creates a parameter structure with given spike times and neuron indices.SpikeTimeStimulusParameter(): Creates an empty parameter structure with default empty vectors.SpikeTimeParameter(spiketimes, neurons): Alternative constructor that sorts spike times and neuron indices by spike time.SpikeTimeParameter(;spiketimes, neurons): Keyword argument constructor that sorts spike times and neuron indices by spike time.SpikeTimeParameter(spiketimes::Spiketimes): Converts aSpiketimesobject to aSpikeTimeStimulusParameterby flattening the spike times and neuron indices.
Notes
- The spike times and neuron indices are automatically sorted by spike time in the constructors that accept them.
- The
Spiketimestype is expected to be a collection of spike times for each neuron.
SNNModels.SpikeTimeStimulus — Type
SpikeTimeStimulus{FT, VFT, VBT, DT, VIT} <: AbstractStimulusA spike time stimulus structure for spiking neural networks. This stimulus type delivers spikes to postsynaptic neurons at specified times.
Fields
N::Int: Number of presynaptic neuronsname::String: Name of the stimulus (default: "SpikeTime")id::String: Unique identifier for the stimulus (default: random 12-character string)param::SpikeTimeStimulusParameter: Parameter structure containing spike times and neuron indicesrowptr::VIT: Row pointer of sparse weight matrixcolptr::VIT: Column pointer of sparse weight matrixI::VIT: Postsynaptic indices of weight matrixJ::VIT: Presynaptic indices of weight matrixindex::VIT: Index mapping for weight matrixW::VFT: Synaptic weightsg::VFT: Rise conductancenext_spike::VFT: Next spike time (default: [0])next_index::VIT: Index of next spike (default: [0])fire::VBT: Boolean vector indicating which neurons fired (default: falses(N))records::Dict: Dictionary for recording datatargets::Dict: Dictionary specifying stimulus targets
Constructors
SpikeTimeStimulus(post::AbstractPopulation, sym::Symbol, target; kwargs...): Creates a spike time stimulus with specified parameters.SpikeTimeStimulusIdentity(post::AbstractPopulation, sym::Symbol, target; kwargs...): Creates an identity spike time stimulus where each presynaptic neuron connects to a corresponding postsynaptic neuron.
Keyword Arguments
p::Real: Connection probability (default: 0.05)μ: Mean of synaptic weight distribution (default: 1.0)σ: Standard deviation of synaptic weight distribution (default: 0.0)w: Synaptic weight matrix (default: generated based on distribution parameters)dist::Symbol: Distribution type for synaptic weights (default: :Normal)rule::Symbol: Connection rule (default: :Fixed)N::Int: Number of presynaptic neurons (default: determined from parameters)param::SpikeTimeStimulusParameter: Spike time parameters (required)
Notes
- The stimulus delivers spikes to postsynaptic neurons at times specified in the
paramfield. - The synaptic weight matrix can be specified directly or generated based on distribution parameters.
- The
SpikeTimeStimulusIdentityconstructor creates a 1-to-1 connection between presynaptic and postsynaptic neurons.
Poisson Layer
SNNModels.PoissonLayer — Type
PoissonLayer
Poisson stimulus with rate defined for each cell in the layer. Each neuron of the 'N' Poisson population fires with 'rate'.
The connectivity is defined by the parameter 'ϵ'. Thus, the number of presynaptic neuronsconnected to the postsynaptic neuronsis 'N*ϵ'. Each post-synaptic cell receives rate: 'rate * N * ϵ'.
# Fields
- `rate::Vector{R}`: A vector containing the rate of the Poisson stimulus.
- `N::Int32`: The number of neuronsin the layer.
- `ϵ::Float32`: The fraction of presynaptic neuronsconnected to the postsynaptic neurons.
- `active::Vector{Bool}`: A vector of booleans indicating if the stimulus is active.SNNModels.PoissonStimulusLayer — Type
PoissonStimulusLayer{VFT, VBT, VIT, IT}A layer representing a Poisson stimulus applied to a postsynaptic population.
Fields
N::Int: Number of neurons in the stimulus layer.id::String: Unique identifier for the layer.name::String: Name of the layer.param::PoissonLayer: Parameters for the Poisson stimulus.g::VFT: Target conductance for the soma.colptr::VIT: Column pointer for sparse connectivity.rowptr::VIT: Row pointer for sparse connectivity.I::VIT: Row indices for sparse connectivity.J::VIT: Column indices for sparse connectivity.index::VIT: Indices for sparse connectivity.W::VFT: Weights for synaptic connections.fire::VBT: Boolean vector indicating which neurons fired.randcache::VFT: Random cache for Poisson spike generation.records::Dict: Dictionary for storing simulation records.targets::Dict: Dictionary specifying target populations.
This layer implements a Poisson stimulus where each neuron fires independently with a given rate, and the connectivity is defined by sparse matrix representations.
Poisson Stimulus
SNNModels.PoissonFixed — Type
PoissonFixed
Poisson stimulus with fixed rate. The rate arrives to all the neuronstargeted
by the stimulus.
# Fields
- `rate::Vector{R}`: A vector containing the rate of the Poisson stimulus.
- `active::Vector{Bool}`: A vector of booleans indicating if the stimulus is active.SNNModels.PoissonInterval — Type
PoissonInterval
Poisson stimulus with rate defined for each cell in the layer. Each neuron of the 'N' Poisson population fires with 'rate' in the intervals defined by 'intervals'.
# Fields
- `rate::Vector{R}`: A vector containing the rate of the Poisson stimulus.
- `intervals::Vector{Vector{R}}`: A vector of vectors containing the intervals in which the Poisson stimulus is active.
- `active::Vector{Bool}`: A vector of booleans indicating if the stimulus is active.SNNModels.PoissonVariable — Type
PoissonVariable
Poisson stimulus with rate defined with a function.
# Fields
- `variables::Dict{Symbol,Any}`: A dictionary containing the variables for the function.
- `rate::Function`: A function defining the rate of the Poisson stimulus.
- `active::Vector{Bool}`: A vector of booleans indicating if the stimulus is active.Balanced Stimulus
SNNModels.BalancedParameter — Type
BalancedStimulusParameter{VFT} <: AbstractParameterA parameter struct for the BalancedStimulus, containing parameters for the balanced input distribution. The balanced stimulus generates both excitatory and inhibitory inputs to a postsynaptic population, maintaining a balance between excitation and inhibition. The balance is controlled by two parameters that define the characteristics of the input. kIE: Scaling factor for inhibitory rate. wIE: Weight for inhibitory connections.
The parameter β controls the noise in the firing rate, with higher values leading to more variability. The time constant τ determines how quickly the noise decays over time. The baseline firing rate r0 sets the average rate of input spikes.
Fields
kIE::Float32: Scaling factor for inhibitory rate (default: 1.0)β::Float32: Noise parameter (default: 0.0)τ::Float32: Time constant for noise (default: 50.0 ms)r0::Float32: Baseline firing rate (default: 1kHz)wIE::Float32: Weight for inhibitory connections (default: 1.0)same_input::Bool: Whether to use same input for all neurons (default: false)
Stimulus Group
SNNModels.AbstractStimulusGroup — Type
AbstractStimulusGroupAn abstract type representing a group of stimuli. Any struct inheriting from this type must implement:
Methods
stimulate!(p::StimulusGroup, param::StimulusParameter, time::Time, dt::Float32): Applies the stimulus group to the population.
Stimulus Parameter
SNNModels.AbstractStimulus — Type
AbstractStimulusAn abstract type representing a stimulus. Any struct inheriting from this type must implement:
Methods
stimulate!(p::Stimulus, param::StimulusParameter, time::Time, dt::Float32): Applies the stimulus to the population.
SNNModels.BalancedStimulus — Type
BalancedStimulus{
VFT = Vector{Float32},
VBT = Vector{Bool},
VIT = Vector{Int},
IT = Int32,
} <: AbstractStimulusA stimulus that generates balanced excitatory and inhibitory inputs to a postsynaptic population.
Fields
param::BalancedStimulusParameter: Parameters for the balanced stimulus.N::IT: Number of neurons in the stimulus.neurons::VIT: Indices of neurons in the postsynaptic population receiving the stimulus.ge::VFT: Target excitatory conductance for each neuron.gi::VFT: Target inhibitory conductance for each neuron.colptr::VIT: Column pointers for sparse connectivity matrix.rowptr::VIT: Row pointers for sparse connectivity matrix.I::VIT: Row indices for sparse connectivity matrix.J::VIT: Column indices for sparse connectivity matrix.index::VIT: Indices for non-zero entries in sparse connectivity matrix.r::VFT: Firing rates for each neuron.noise::VFT: Noise values for each neuron.randcache::VFT: Cache for random values used in spike generation.randcache_β::VFT: Cache for random values used in noise generation.records::Dict: Dictionary for recording variables during simulation.targets::Dict: Dictionary specifying the target populations and synaptic variables.
SNNModels.BalancedStimulus — Method
BalancedStimulus(post::T, sym::Symbol, r::Union{Function, Float32}, neurons=[]; N_pre::Int=50, p_post::R=0.05f0, μ::R=1.f0, param=BalancedParameter()) where {T <: AbstractPopulation, R <: Number}Constructs a BalancedStimulus object for a spiking neural network.
Arguments
post::T: The target population for the stimulus.sym_e::Symbol: The symbol representing the excitatory synaptic conductance or current.sym_i::Symbol: The symbol representing the inhibitory synaptic conductance or current.param=BalancedParameter(): The parameters for the Balanced distribution.
Returns
A BalancedStimulus object.
SNNModels.CurrentStimulus — Type
CurrentStimulus{
FT = Float32,
VFT = Vector{Float32},
DT = Distribution{Univariate,Continuous},
VIT = Vector{Int},
} <: AbstractStimulusA stimulus that applies current to neurons.
Fields
param::CurrentStimulus: for the stimulus.name::String: Name of the stimulus (default: "Current").id::String: Unique identifier for the stimulus.neurons::VIT: Indices of neurons to stimulate.randcache::VFT: Cache for random values.I::VFT: Target input current.records::Dict: Dictionary for recording data.targets::Dict: Dictionary describing the targets of the stimulus.
SNNModels.CurrentStimulus — Method
CurrentStimulus(post::T, sym::Symbol = :I; neurons = :ALL, param, kwargs...) where {T<:AbstractPopulation}Construct a CurrentStimulus for a postsynaptic population.
Arguments
post: Postsynaptic population.sym: Symbol for the input current field (default: :I).neurons: Indices of neurons to stimulate (default: :ALL).param: Parameters for the stimulus.kwargs: Additional keyword arguments.
SNNModels.AbstractStimulusParameter — Type
AbstractStimulusParameter <: AbstractParameterSNNModels.CurrentNoise — Type
CurrentNoise{VFT = Vector{Float32}} <: CurrentParameterA parameter type for current stimuli that generates noisy current inputs.
Fields
I_base::VFT: Base current values for each neuron.I_dist::Distribution{Univariate,Continuous}: Distribution for generating noise.α::VFT: Decay factors for the current.
SNNModels.CurrentNoise — Method
CurrentNoise(N::Union{Number,AbstractPopulation}; I_base::Number = 0, I_dist::Distribution = Normal(0.0, 0.0), α::Number = 0.0)Construct a CurrentNoise with the given parameters.
Arguments
N: Number of neurons or a population.I_base: Base current value (default: 0).I_dist: Distribution for generating noise (default: Normal(0.0, 0.0)).α: Decay factor (default: 0.0).
SNNModels.CurrentParameter — Type
CurrentParameterAbstract type representing parameters for current stimuli.