API References
Populations
SNNModels.AbstractPopulation
— TypeAbstractPopulation
An abstract type representing a population. Any struct inheriting from this type must implement:
Methods
integrate!(p::NeuronModel, param::NeuronModelParam, dt::Float32)
: Integrates the neuron model over a time stepdt
using the given parameters.
SNNModels.BallAndStick
— TypeThis is a struct representing a spiking neural network model that include two dendrites and a soma based on the adaptive exponential integrate-and-fire model (AdEx)
Fields
t::VIT
: tracker of simulation index [0]param::AdExSoma
: Parameters for the AdEx model.N::Int32
: The number of neurons in the network.d::VDT
: Dendritic compartment parameters.v_s::VFT
: Somatic membrane potential.w_s::VFT
: Adaptation variables for each soma.v_d::VFT
: Dendritic membrane potential for dendrite.g_s::MFT
,g_d::MFT
: Conductance of somatic and dendritic synapses.h_s::MFT
,h_d::MFT
: Synaptic gating variables.fire::VBT
: Boolean array indicating which neurons have fired.after_spike::VFT
: Post-spike timing.postspike::PST
: Model for post-spike behavior.θ::VFT
: Individual neuron firing thresholds.records::Dict
: A dictionary to store simulation results.Δv::VFT
,Δv_temp::VFT
: Variables to hold temporary voltage changes.cs::VFT
,is::VFT
: Temporary variables for currents.
SNNModels.HH
— TypeSNNModels.IF
— Type[Integrate-And-Fire Neuron](https://neuronaldynamics.epfl.ch/online/Ch1.S3.html)
SNNModels.IF_CANAHP
— Type[CAN-AHP Intergrate-and-Fire Neuron](https://www.biorxiv.org/content/10.1101/2022.07.26.501548v1)
IF neuron with non-specific cationic (CAN) and after-hyperpolarization potassium (AHP) currents.
SNNModels.IZ
— TypeSNNModels.MorrisLecar
— TypeSNNModels.Poisson
— TypeSNNModels.Rate
— TypeSNNModels.Tripod
— TypeThis is a struct representing a spiking neural network model that include two dendrites and a soma based on the adaptive exponential integrate-and-fire model (DendNeuronParameter)
Fields
t::VIT
: tracker of simulation index [0]param::AdExSoma
: Parameters for the AdEx model.N::Int32
: The number of neurons in the network.soma_syn::ST
: Synapses connected to the soma.dend_syn::ST
: Synapses connected to the dendrites.d1::VDT
,d2::VDT
: Dendrite structures.NMDA::NMDAT
: Specifies the properties of NMDA (N-methyl-D-aspartate) receptors.gax1::VFT
,gax2::VFT
: Axial conductance (reciprocal of axial resistance) for dendrite 1 and 2 respectively.cd1::VFT
,cd2::VFT
: Capacitance for dendrite 1 and 2.gm1::VFT
,gm2::VFT
: Membrane conductance for dendrite 1 and 2.v_s::VFT
: Somatic membrane potential.w_s::VFT
: Adaptation variables for each soma.v_d1::VFT
,v_d2::VFT
: Dendritic membrane potential for dendrite 1 and 2.g_s::MFT
,g_d1::MFT
,g_d2::MFT
: Conductance of somatic and dendritic synapses.h_s::MFT
,h_d1::MFT
,h_d2::MFT
: Synaptic gating variables.fire::VBT
: Boolean array indicating which neurons have fired.after_spike::VFT
: Post-spike timing.postspike::PST
: Model for post-spike behavior.θ::VFT
: Individual neuron firing thresholds.records::Dict
: A dictionary to store simulation results.Δv::VFT
,Δv_temp::VFT
: Variables to hold temporary voltage changes.cs::VFT
,is::VFT
: Temporary variables for currents.
Synapses
SNNModels.AbstractConnection
— TypeAbstractConnection
An abstract type representing a connection. Any struct inheriting from this type must implement:
Methods
forward!(c::Synapse, param::SynapseParameter)
: Propagates the signal through the synapse.plasticity!(c::Synapse, param::SynapseParameter, dt::Float32, T::Time)
: Updates the synapse parameters based on plasticity rules.
SNNModels.AbstractNormalization
— TypeAbstractNormalization <: AbstractConnection
An abstract type representing a normalization connection.
SNNModels.AbstractSparseSynapse
— TypeAbstractSparseSynapse <: AbstractConnection
An abstract type representing a sparse synapse connection.
SNNModels.AggregateScaling
— MethodSynapseNormalization(N; param, kwargs...)
Constructor function for the SynapseNormalization struct.
- N: The number of synapses.
- param: Normalization parameter, can be either MultiplicativeNorm or AdditiveNorm.
- kwargs: Other optional parameters.
Returns a SynapseNormalization object with the specified parameters.
SNNModels.FLSparseSynapse
— TypeSNNModels.FLSynapse
— TypeSNNModels.PINningSparseSynapse
— TypeSNNModels.PINningSynapse
— TypeSNNModels.RateSynapse
— TypeSNNModels.SpikeRateSynapse
— TypeSNNModels.SpikingSynapse
— TypeSpikingSynapse to connect neuronal populations
SNNModels.SynapseNormalization
— TypeSynapseNormalization{VFT = Vector{Float32}, VIT = Vector{Int32}, MFT = Matrix{Float32}}
A struct that holds parameters for synapse normalization, including:
- param: Normalization parameter, can be either MultiplicativeNorm or AdditiveNorm.
- t: A vector of integer values representing time points.
- W0: A vector of initial weights before simulation.
- W1: A vector of weights during the simulation.
- μ: A vector of mean synaptic weights.
- records: A dictionary for storing additional data.
SNNModels.SynapseNormalization
— MethodSynapseNormalization(N; param, kwargs...)
Constructor function for the SynapseNormalization struct.
- N: The number of synapses.
- param: Normalization parameter, can be either MultiplicativeNorm or AdditiveNorm.
- kwargs: Other optional parameters.
Returns a SynapseNormalization object with the specified parameters.
Stimuli
SNNModels.AbstractStimulus
— TypeAbstractStimulus
An 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
— MethodBalancedStimulus(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::Symbol
: The symbol representing the synaptic conductance or current.r::Union{Function, Float32}
: The firing rate of the stimulus. Can be a constant value or a function of time.neurons=[]
: The indices of the neuronsin the target population that receive the stimulus. If empty, neuronsare randomly selected based on the probabilityp_post
.N::Int=200
: The number of Balanced neurons neurons.N_pre::Int=5
: The number of presynaptic connected.p_post::R=0.05f0
: The probability of connection between presynaptic and postsynaptic neurons.μ::R=1.f0
: The scaling factor for the synaptic weights.param=BalancedParameter()
: The parameters for the Balanced distribution.
Returns
A BalancedStimulus
object.
Plasticity
SNNModels.STDPGerstner
— TypeGerstner, W., Kempter, R., van Hemmen, J. L., & Wagner, H. (1996). A neuronal learning rule for sub-millisecond temporal coding. Nature, 383(6595), 76–78. https://doi.org/10.1038/383076a0
SNNModels.STDPMexicanHat
— TypeSTDPMexicanHat{FT = Float32}
The STDP is defined such that integral of the kernel is zero. The STDP kernel is defined as:
`` A x * exp(-x/sqrt(2)) ``
where ``A`` is the learning rate for post and pre-synaptic spikes, respectively, and ``x`` is the difference between the post and pre-synaptic traces.
SNNModels.STDPSymmetric
— TypeSTDPSymmetric{FT = Float32}
Symmetric STDP rules described in:
`Structured stabilization in recurrent neural circuits through inhibitory synaptic plasticity`
by Festa, D., Cusseddu, C, and Gjorgjieva, J. (2024).
The STDP is defined such that integral of the kernel is zero. The STDP kernel is defined as:
`` (rac{A_{post}}{1/ au_{post}} * exp(-t/ au_{post} - rac{A_{pre}}{ au_pre} * exp(-t/ au_{pre}) ``
where ``A_{post}`` and ``A_{pre}`` are the learning rates for post and pre-synaptic spikes, respectively, and `` au_{post}`` and `` au_{pre}`` are the time constants for post and pre-synaptic traces, respectively.
SNNModels.vSTDPParameter
— TypevSTDPParameter{FT = Float32} <: SpikingSynapseParameter
Contains parameters for the voltage-dependent Spike-Timing Dependent Plasticity (vSTDP) model.
Fields
A_LTD::FT
: Long Term Depression learning rate.A_LTP::FT
: Long Term Potentiation learning rate.θ_LTD::FT
: LTD threshold.θ_LTP::FT
: LTP threshold.τu::FT
: Time constant for the pre-synaptic spike trace.τv::FT
: Time constant for the post-synaptic membrane trace.τx::FT
: Time constant for the variablex
.Wmax::FT
: Maximum synaptic weight.Wmin::FT
: Minimum synaptic weight.active::Vector{Bool}
: Flag to activate or deactivate the plasticity rule.
Functions
SNNModels.CV_isi2
— MethodCV_isi2(intervals::Vector{Float32})
Return the local coefficient of variation of the interspike intervals
Holt, G. R., Softky, W. R., Koch, C., & Douglas, R. J. (1996). Comparison of discharge variability in vitro and in vivo in cat visual cortex neurons. Journal of Neurophysiology, 75(5), 1806–1814. https://doi.org/10.1152/jn.1996.75.5.1806
SNNModels.C_mem
— MethodC_mem(;Cd=Cd,d=d,l=l)
Capacitance of a cylinder of length l and diameter d
return Capacitance in pF
SNNModels.G_axial
— MethodG_axial(;Ri=Ri,d=d,l=l)
Axial conductance of a cylinder of length l and diameter d
return Conductance in nS
SNNModels.G_mem
— MethodG_mem(;Rd=Rd,d=d,l=l)
Membrane conductance of a cylinder of length l and diameter d
return Conductance in nS
SNNModels.alpha_function
— Methodalpha_function(t::T; t0::T, τ::T) where T <: AbstractFloat
Alpha function for convolution of spiketimes. Evaluate the alpha function at time t, with time of peak t0 and time constant τ.
SNNModels.asynchronous_state
— Functioninter_spike_interval(spiketimes::Vector{Float32})
Calculate the inter-spike intervals (ISIs) for a given set of spike times.
Arguments
spiketimes
: A vector of spike times for a single neuron.
Returns
isis
: A vector of inter-spike intervals.
SNNModels.bin_spiketimes
— Methodbin_spiketimes(spiketimes, interval, sr)
Given a list of spike times spiketimes
, an interval [start, end]
, and a sampling rate sr
, this function counts the number of spikes that fall within each time bin of width 1/sr
within the interval. The function returns a sparse matrix count
containing the spike counts for each bin, and an array r
containing the time points corresponding to the center of each bin.
Arguments
spiketimes
: A 1-dimensional array of spike times.interval
: A 2-element array specifying the start and end times of the interval.sr
: The sampling rate, i.e., the number of time bins per second.
Returns
count
: A sparse matrix containing the spike counts for each time bin.r
: An array of time points corresponding to the center of each time bin.
SNNModels.clear_monitor!
— Methodclear_monitor!(obj)
Clears all the records of a given object.
SNNModels.clear_records!
— Methodclear_records!(objs::AbstractArray)
Clears the records of multiple objects.
SNNModels.clear_records!
— Methodclear_records!(obj, sym::Symbol)
Clears the records of a given object for a specific symbol.
SNNModels.clear_records!
— Methodclear_records!(obj)
Clears all the records of a given object.
SNNModels.compose
— Methodcompose(kwargs...; syn=nothing, pop=nothing)
Merge multiple models into a single model.
Arguments
kwargs...
: List ofkwarg
elements, i.e., dictionary or named tuples, containing the models to be merged.- if
kwarg
has elements with:pop
and:syn
entries, the function copies them into the merged model. - if
kwarg
has no:pop
and:syn
entries, the function iterates over all the elements contained inkwarg
and merge them into the model.
- if
syn
: Optional dictionary of synapses to be merged.pop
: Optional dictionary of populations to be merged.stim
: Optional dictionary of stimuli to be merged.
Returns
A tuple (pop, syn)
representing the merged populations and synapses.
Details
This function takes in multiple models represented as keyword arguments and merges them into a single model. The models can be specified using the pop
and syn
fields in the keyword arguments. If the pop
and syn
fields are not present, the function expects the keyword arguments to have elements with :pop
or :syn
fields.
The merged populations and synapses are stored in dictionaries populations
and synapses
, respectively. The function performs type assertions to ensure that the elements being merged are of the correct types (AbstractPopulation
for populations and AbstractConnection
for synapses).
If syn
and/or pop
and/or stim
arguments are provided, they are merged into the respective dictionaries.
Example
SNNModels.compute_connections
— Methodcompute_long_short_connections(pre::Symbol, post::Symbol, points; dc, pl, ϵ, grid_size, conn)
Compute the connections between two populations of neurons based on their spatial distance. This function will assign connections with probability p_short
for short-range connections and p_long
for long-range connections. The weights of the connections are determined by the μ
parameter in the conn
named tuple. The function uses a periodic boundary condition to calculate distances in a 2D grid. The total number of connections per the post-synaptic neuron is: ϵ * Npre * pshort + (1 - ϵ) * Npre * plong.
Arguments
pre::Symbol
: The symbol representing the pre-synaptic population.post::Symbol
: The symbol representing the post-synaptic population.points::NamedTuple
: A named tuple containing the spatial points for each population.dc::Float64
: The critical distance for short-range connections.pl::Float64
: The probability of long-range connections.ϵ::Float64
: The scaling factor for connection probabilities.grid_size::Float64
: The size of the grid.conn::NamedTuple
: A named tuple containing connection parameters, includingp
andμ
.
Returns
P::Matrix{Bool}
: A matrix indicating the presence of connections.W::Matrix{Float32}
: A matrix containing the weights of the connections.
SNNModels.compute_covariance_density
— Methodcompute_covariance_density(t_post, t_pre, T; τ=200ms, sr=50Hz)
Compute the covariance density of spike trains t_post
and t_pre
over a time interval T
. The function returns the covariance density vectors for positive and negative time lags.
Arguments
spike_times1
:: Vector{Float32}: A vector of spike times for the first neuron.spike_times2
:: Vector{Float32}: A vector of spike times for the second neuron.bin_width
:: Float32: The width of the time bins in milliseconds.max_lag
:: Float32: The maximum time lag in milliseconds.
Returns
lags
:: Vector{Float32}: The time lags in milliseconds.covariance_density
:: Vector{Float32}: The covariance density for each time lag.
SNNModels.compute_cross_correlogram
— Functionautocor(spiketimes::Spiketimes; interval = 0:1:1000)
Calculate the cross-correlation of two spike trains.
Arguments
spike_times1
: A vector of spike times for the first neuron.spike_times2
: A vector of spike times for the second neuron.bin_width
: The width of the time bins in milliseconds.max_lag
: The maximum time lag in milliseconds.
Returns
lags
: The time lags in milliseconds.auto_corr
: The auto-correlation for each time lag.
SNNModels.extract_items
— Methodextract_items(root::Symbol, container; pop::Dict{Symbol,Any}, syn::Dict{Symbol, Any}, stim::Dict{Symbol,Any})
Extracts items from a container and adds them to the corresponding dictionaries based on their type.
Arguments
root::Symbol
: The root symbol for the items being extracted.container
: The container from which to extract items.pop::Dict{Symbol,Any}
: The dictionary to store population items.syn::Dict{Symbol, Any}
: The dictionary to store synapse items.stim::Dict{Symbol,Any}
: The dictionary to store stimulus items.
Returns
true
: Always returns true.
Details
- If the type of the item in the container is
AbstractPopulation
, it is added to thepop
dictionary. - If the type of the item in the container is
AbstractConnection
, it is added to thesyn
dictionary. - If the type of the item in the container is
AbstractStimulus
, it is added to thestim
dictionary. - If the type of the item in the container is none of the above, the function is recursively called to extract items from the nested container.
SNNModels.firing_rate
— Methodfiring_rate(
spiketimes::Spiketimes,
interval::AbstractVector = [],
sampling = 20,
τ = 25,
ttf = -1,
tt0 = -1,
cache = true,
pop::Union{Symbol,Vector{Int}}= :ALL,
)
Calculate the firing rates for a population or an individual neuron.
Arguments
spiketimes
: Spiketimes object.interval
: Time interval vector (default is an empty vector).sampling
: Sampling rate (default is 20ms).τ
: Time constant for convolution (default is 25ms).ttf
: Final time point (default is -1, which means until the end of the simulation time).tt0
: Initial time point (default is -1, which means from the start of the simulation time based on the sampling rate).cache
: If true, uses cached data (default is true).pop
: Either :ALL for all populations or a Vector of Integers specifying specific neuron indices. Default is :ALL.
Returns
A tuple containing:
rates
: A vector of firing rates for each neuron in the chosen population.interval
: The time interval over which the firing rates were calculated.
Examples
SNNModels.firing_rate_average
— Methodfiring_rate_average(P; dt=0.1ms)
Calculates and returns the average firing rates of neurons in a network.
Arguments:
P
: A structure containing neural data, with a key:fire
in itsrecords
field which stores spike information for each neuron.dt
: An optional parameter specifying the time interval (default is 0.1ms).
Returns:
An array of floating point values representing the average firing rate for each neuron.
Usage:# Notes:
Each row of P.records[:fire]
represents a neuron, and each column represents a time point. The value in a cell indicates whether that neuron has fired at that time point (non-zero value means it has fired). The firing rate of a neuron is calculated as the total number of spikes divided by the total time span.
SNNModels.gaussian_kernel
— Methodgaussian_kernel(σ::Float64, length::Int)
Create a Gaussian kernel with standard deviation σ
and specified length
.
Arguments
σ
: Standard deviation of the Gaussian kernel.length
: Length of the kernel.
Returns
kernel
: A vector representing the Gaussian kernel.
SNNModels.gaussian_kernel_estimate
— Methodgaussian_kernel_estimate(support_vector::Vector{Float64}, σ::Float64, length::Int)
Apply a Gaussian kernel estimate to a support vector with closed boundary conditions.
Arguments
support_vector
: The input support vector.σ
: Standard deviation of the Gaussian kernel.length
: Length of the kernel.
Returns
estimated_vector
: The estimated vector after applying the Gaussian kernel.
SNNModels.get_dt
— Methodget_dt(T::Time)
Get the time step size.
Arguments
T::Time
: The Time object.
Returns
Float32
: The time step size.
SNNModels.get_interval
— Methodget_interval(T::Time)
Get the time interval from 0 to the current time.
Arguments
T::Time
: The Time object.
Returns
StepRange{Float32}
: The time interval.
SNNModels.get_step
— Methodget_step(T::Time)
Get the current time step.
Arguments
T::Time
: The Time object.
Returns
Float32
: The current time step.
SNNModels.get_time
— Methodget_time(T::Time)
Get the current time.
Arguments
T::Time
: The Time object.
Returns
Float32
: The current time.
SNNModels.getrecord
— Methodgetrecord(p, sym)
Returns the recorded values for a given object and symbol. If the symbol is not found in the object's records, it checks the records of the object's plasticity and returns the values for the matching symbol.
SNNModels.getvariable
— Functiongetvariable(obj, key, id=nothing)
Returns the recorded values for a given object and key. If an id is provided, returns the recorded values for that specific id.
SNNModels.graph
— Methodgraph(model)
Generate a graph representation of the model.
Arguments
model
: The model to generate the graph from.
Returns
A MetaGraphs.MetaDiGraph
object representing the graph.
Details
Each vertex represents either a population ('pop'), a normalization synapse ('norm'), or a stimulus pre-target ('pre'). Its metadata includes:
name
: Actual name of the population, 'norm' for a SynapseNormalization, or the pre-target's name for a stimulus.id
: Identifier of the population, SynapseNormalization, or stimulus.key
: Key from the original 'pop', 'syn', or 'stim' dictionary in the model.
Each edge represents a synaptic connection or a stimulus. Its metadata includes:
type
: Type of the edge, ':firetog' for SpikingSynapse, ':norm' for SynapseNormalization, or ':stim' for a stimulus.name
: Name of the edge, formatted as "fromvertexname to tovertexname".key
: Key from the original 'syn' or 'stim' dictionary in the model.id
: Identifier of the synapse or stimulus.
The function iterates over the populations, synapses, and stimuli in the model.
AbstractPopulation
items are added as vertices.
For each connection it checks the type of the synapse and adds an edge between the pre-synaptic population and the post-synaptic population. - SpikingSynapse
: the edge represents a connection from the firing population to the receiving population. - SynapseNormalization
: the edge represents a normalization of synapses between populations. - PoissonStimulus
: the edge represents a stimulus from the pre-synaptic population to the post-synaptic population.
For each stimulus, it adds a vertex to the graph representing an implicit pre-synaptic population [:fire] an edge between it and the post-synaptic population [:post].
Returns a MetaGraphs.MetaDiGraph where:
Errors
Throws ArgumentError when the synapse type is neither SpikingSynapse nor SynapseNormalization.
SNNModels.interpolated_record
— Methodinterpolated_record(p, sym)
Returns the recording with interpolated time values and the extrema of the recorded time points.
N.B.
----
The element can be accessed at whichever time point by using the index of the array. The time point must be within the range of the recorded time points, in r_v.
SNNModels.interval_standard_spikes
— Methodinterval_standard_spikes(spiketimes, interval)
Standardize the spiketimes to the interval [0, interval_duration]. Return a copy of the 'Spiketimes' vector.
SNNModels.is_attractor_state
— Methodis_attractor_state(spiketimes::Spiketimes, interval::AbstractVector, N::Int)
Check if the network is in an attractor state by verifying that the average firing rate over the last N seconds of the simulation is a unimodal distribution.
Arguments
spiketimes
: A vector of vectors containing the spike times of each neuron.interval
: The time interval over which to compute the firing rate.N
: The number of seconds over which to check the unimodality of the firing rate distribution.
Returns
is_attractor
: A boolean indicating whether the network is in an attractor state.
SNNModels.linear_network
— Methodlinear_network(N, σ_w=0.38, w_max=2.0)
Create a linear network with Gaussian-shaped connections.
Arguments
N::Int
: The number of neurons.σ_w::Float64
: The standard deviation of the Gaussian distribution.w_max::Float64
: The maximum weight.
Returns
W::Matrix{Float32}
: A matrix containing the weights of the connections.
SNNModels.merge_spiketimes
— Methodmerge_spiketimes(spikes::Vector{Spiketimes}; )
Merge spiketimes from different simulations.
This function is not thread safe, it is not recommended to use it in parallel.
Parameters
----------
spikes: Vector{Spiketimes}
Vector of spiketimes from different simulations
Return
------
neurons: Spiketimes
Single vector of spiketimes
SNNModels.monitor!
— Methodmonitor!(objs::Array, keys)
Function called when more than one object is given, which then calls the above monitor function for each object
SNNModels.monitor!
— MethodInitialize dictionary records for the given object, by assigning empty vectors to the given keys
Arguments
obj
: An object whose variables will be monitoredkeys
: The variables to be monitored
SNNModels.neurons_outside_area
— Methodneurons_outside_area(points, center, distance, grid_size)
Find the indices of neurons outside a specified area around a center point.
Arguments
points::Vector{Vector{Float64}}
: The coordinates of the neurons.center::Vector{Float64}
: The coordinates of the center point.distance::Float64
: The minimum distance from the center point.grid_size::Float64
: The size of the grid.
Returns
indices::Vector{Int}
: The indices of neurons outside the specified area.
SNNModels.neurons_within_circle
— Methodneurons_within_circle(points, center, distance, grid_size)
Find the indices of neurons within a specified area around a center point.
Arguments
points::Vector{Vector{Float64}}
: The coordinates of the neurons.center::Vector{Float64}
: The coordinates of the center point.distance::Float64
: The maximum distance from the center point.grid_size::Float64
: The size of the grid.
Returns
indices::Vector{Int}
: The indices of neurons within the specified area.
SNNModels.norm_synapse
— MethodCalculate the normalization factor for a synapse given rise and decay time constants.
Arguments
τr
: Rise time constantτd
: Decay time constant
Returns
Float32
: The normalization factor
SNNModels.norm_synapse
— MethodCalculate the normalization factor for a synapse.
Arguments
synapse::Receptor
: The receptor for which to calculate the normalization factor
Returns
Float32
: The normalization factor
SNNModels.periodic_distance
— Methodperiodic_distance(point1, point2, grid_size)
Calculate the periodic distance between two points in a 2D grid.
Arguments
point1::Vector{Float64}
: The coordinates of the first point.point2::Vector{Float64}
: The coordinates of the second point.grid_size::Float64
: The size of the grid.
Returns
distance::Float64
: The periodic distance between the two points.
SNNModels.place_populations
— Methodplace_populations(config)
Create a 2D spatial structure and dispose N points for each population.
Arguments
config::NamedTuple
: A NamedTuple containing configuration parameters, includingprojections
andNpop
.
Returns
Pops::NamedTuple
: A named tuple containing the spatial points for each population.
SNNModels.plasticity!
— Methodplasticity!(c::AbstractSparseSynapse, param::iSTDPRate, dt::Float32)
Performs the synaptic plasticity calculation based on the inihibitory spike-timing dependent plasticity (iSTDP) model from Vogels (2011) adapted to control the membrane potential. The function updates synaptic weights W
of each synapse in the network according to the firing status of pre and post-synaptic neurons. This is an in-place operation that modifies the input AbstractSparseSynapse
object c
.
Arguments
c::AbstractSparseSynapse
: The current spiking synapse object which contains data structures to represent the synapse network.param::iSTDPParameterVoltage
: Parameters needed for the iSTDP model, including learning rateη
, target membrane potenitalv0
, STDP time constantτy
, maximal and minimal synaptic weight (Wmax
andWmin
).dt::Float32
: The time step for the numerical integration.
Algorithm
- For each pre-synaptic neuron, if it fires, it reduces the synaptic weight by an amount proportional to the difference between the target membrane potential and the actual one.
- For each pre-synaptic neuron, if it fires, increases the inhibitory term, otherwise the inhibitory term decays exponentially over time with a time constant
τy
. - For each post-synaptic neuron, if it fires, it increases the synaptic weight by an amount proportional to the pre-synaptic trace and increases the excitatory term, otherwise the excitatory term decays exponentially over time with a time constant
τy
. - The synaptic weights are bounded by
Wmin
andWmax
.
SNNModels.plasticity!
— Methodplasticity!(c::AbstractSparseSynapse, param::iSTDPRate, dt::Float32)
Performs the synaptic plasticity calculation based on the inihibitory spike-timing dependent plasticity (iSTDP) model from Vogels (2011). The function updates synaptic weights W
of each synapse in the network according to the firing status of pre and post-synaptic neurons. This is an in-place operation that modifies the input AbstractSparseSynapse
object c
.
Arguments
c::AbstractSparseSynapse
: The current spiking synapse object which contains data structures to represent the synapse network.param::iSTDPRate
: Parameters needed for the iSTDP model, including learning rateη
, target rater
, STDP time constantτy
, maximal and minimal synaptic weight (Wmax
andWmin
).dt::Float32
: The time step for the numerical integration.
Algorithm
- For each pre-synaptic neuron, if it fires, it reduces the synaptic weight by an amount proportional to the difference between the target rate and the actual rate and increases the inhibitory term, otherwise the inhibitory term decays exponentially over time with a time constant
τy
. - For each post-synaptic neuron, if it fires, it increases the synaptic weight by an amount proportional to the pre-synaptic trace and increases the excitatory term, otherwise the excitatory term decays exponentially over time with a time constant
τy
. - The synaptic weights are bounded by
Wmin
andWmax
.
SNNModels.plasticity!
— Methodplasticity!(c::SynapseNormalization, param::AdditiveNorm, dt::Float32)
Updates the synaptic weights using additive or multiplicative normalization (operator). This function calculates the rate of change μ
as the difference between initial weight W0
and the current weight W1
, normalized by W1
. The weights are updated at intervals specified by time constant τ
.
Arguments
c
: An instance of SynapseNormalization.param
: An instance of AdditiveNorm.dt
: Simulation time step.
SNNModels.plasticity!
— Methodplasticity!(c::SynapseNormalization, param::AdditiveNorm, dt::Float32)
Updates the synaptic weights using additive or multiplicative normalization (operator). This function calculates the rate of change μ
as the difference between initial weight W0
and the current weight W1
, normalized by W1
. The weights are updated at intervals specified by time constant τ
.
Arguments
c
: An instance of SynapseNormalization.param
: An instance of AdditiveNorm.dt
: Simulation time step.
SNNModels.population_indices
— Methodpopulation_indices(P, type = "ˆ")
Given a dictionary P
containing population names as keys and population objects as values, this function returns a named tuple indices
that maps each population name to a range of indices. The range represents the indices of the neurons belonging to that population.
Arguments
P
: A dictionary containing population names as keys and population objects as values.type
: A string specifying the type of population to consider. Only population names that contain the specified type will be included in the output. Defaults to "ˆ".
Returns
A named tuple indices
where each population name is mapped to a range of indices.
SNNModels.print_model
— Functionprint_model(model)
Prints the details of the given model. The model is expected to have three components: pop
(populations), syn
(synapses), and stim
(stimuli).
The function displays a graph representation of the model, followed by detailed information about each component.
Arguments
model
: The model containing populations, synapses, and stimuli to be printed.
Outputs
Prints the graph of the model, along with the name, key, type, and parameters of each component in the populations, synapses, and stimuli.
Exception
Raises an assertion error if any component in the populations is not a subtype of AbstractPopulation
, if any component in the synapses is not a subtype of AbstractConnection
, or if any component in the stimuli is not a subtype of AbstractStimulus
.
SNNModels.print_summary
— Methodprint_summary(p)
Prints a summary of the given element.
SNNModels.record_fire!
— Methodrecord_fire!(obj::PT, T::Time, indices::Dict{Symbol,Vector{Int}}) where {PT <: Union{AbstractPopulation, AbstractStimulus}}
Record the firing activity of the obj
object into the obj.records[:fire]
array.
Arguments
obj::PT
: The object to record the firing activity from.T::Time
: The time at which the recording is happening.indices::Dict{Symbol,Vector{Int}}
: A dictionary containing indices for each variable to record.
SNNModels.record_sym!
— Methodrecord_sym!(obj, key::Symbol, T::Time, indices::Dict{Symbol,Vector{Int}})
Record the variable key
of the obj
object into the obj.records[key]
array.
Arguments
obj
: The object to record the variable from.key::Symbol
: The key of the variable to record.T::Time
: The time at which the recording is happening.indices::Dict{Symbol,Vector{Int}}
: A dictionary containing indices for each variable to record.
SNNModels.relative_time!
— Methodrelative_time(spiketimes::Spiketimes, start_time)
Return the spiketimes relative to the start_time of the interval
SNNModels.sample_spikes
— Methodsample_spikes(N, rate::Vector, interval::R; dt=0.125f0) where {R <: AbstractRange}
Generate sample spike times for N neurons from a rate vector. The function generates spike times for each neuron based on the rate vector and the time interval. The spike times are generated such that during the interval of the rate, the number of spikes is Poisson distributed with the rate.
Arguments
N
: The number of neurons.rate::Vector
: The vector with the rate to be sampled.interval::R
: The time interval over which the rate is recorded.dt=0.125f0
: The time step size.
Returns
An array of spike times for each neuron.
SNNModels.sim!
— Methodsim!(
P::Vector{TN},
C::Vector{TS};
dt = 0.1f0,
duration = 10.0f0,
pbar = false,
) where {TN <: AbstractPopulation, TS<:AbstractConnection }
Simulates the spiking neural network for a specified duration by repeatedly calling sim!
function.
Arguments
P::Vector{TN}
: Vector of neurons in the network.C::Vector{TS}
: Vector of synapses in the network.dt::Float32
: Time step for the simulation. Default value is0.1f0
.duration::Float32
: Duration of the simulation. Default value is10.0f0
.pbar::Bool
: Flag indicating whether to display a progress bar during the simulation. Default value isfalse
.
Details
- The function creates a range of time steps from
0.0f0
toduration-dt
with a step size ofdt
. - If
pbar
istrue
, the function creates a progress bar using theProgressBar
function with the time step range. Otherwise, it uses the time step range directly. - The function iterates over the time steps and calls the
sim!
function withP
,C
, anddt
.
SNNModels.spatial_activity
— Methodspatial_activity(points, activity; N, L, grid_size=(x=0.1, y=0.1))
Compute the spatial average of activity data over a grid.
Arguments
points::Tuple{Vector{Float64}, Vector{Float64}}
: A tuple containing two vectorsxs
andys
, which represent the x and y coordinates of the points.activity::Matrix{Float64}
: A matrix where rows correspond to points and columns correspond to activity values over time.N::Int
: The number of time steps to group together for averaging.L::Float64
: The size of each grid cell in both x and y directions.grid_size::NamedTuple{(:x, :y), Tuple{Float64, Float64}}
(optional): The total size of the grid in the x and y directions. Defaults to(x=0.1, y=0.1)
.
Returns
spatial_avg::Array{Float64, 3}
: A 3D array where the first two dimensions correspond to the grid cells in the x and y directions, and the third dimension corresponds to the time groups. Each element contains the average activity for the points within the corresponding grid cell and time group.x_range::Vector{Float64}
: A vector representing the range of x coordinates for the grid cells.y_range::Vector{Float64}
: A vector representing the range of y coordinates for the grid cells.
Details
The function divides the spatial domain into a grid based on the grid_size
and L
parameters. For each grid cell, it computes the average activity of the points that fall within the cell over time groups defined by N
. If no points are found in a grid cell, the average for that cell is skipped.
Example
xs = [0.05, 0.15, 0.25, 0.35]
ys = [0.05, 0.15, 0.25, 0.35]
points = (xs, ys)
activity = rand(4, 100) # Random activity data for 4 points over 100 time steps
N = 10
L = 0.1
grid_size = (x=0.4, y=0.4)
spatial_avg, x_range, y_range = spatial_activity(points, activity; N, L, grid_size)
SNNModels.spikecount
— Methodspikecount(model, Trange, neurons)
Return the total number of spikes of the neurons in the selected interval
SNNModels.spikes_in_interval
— Functionspikesininterval(spiketimes::Spiketimes, interval::AbstractRange)
Return the spiketimes in the selected interval
Arguments
spiketimes::Spiketimes: Vector with each neuron spiketime interval: 2 dimensional array with the start and end of the interval
SNNModels.spiketimes
— Methodspiketimes(Ps; kwargs...)
Return the spiketimes of each population in single vector of Spiketimes.
SNNModels.spiketimes
— Methodspiketimes(p, interval = nothing, indices = nothing)
Compute the spike times of a population.
Arguments:
p
: The network parameters.interval
: The time interval within which to compute the spike times. Ifnothing
, the interval is set to (0, firing_time[end]).
Returns:
spiketimes
: A vector of vectors containing the spike times of each neuron.
SNNModels.spiketimes_from_bool
— Methodspiketimes_from_bool(P, τ; dt = 0.1ms)
This function takes in the records of a neural population P
and time constant τ
to calculate spike times for each neuron.
Arguments
P
: A data structure containing the recorded data of a neuronal population.τ
: A time constant parameter.
Keyword Arguments
dt
: The time step used for the simulation, defaults to 0.1 milliseconds.
Returns
spiketimes
: An object of typeSpiketimes
which contains the calculated spike times of each neuron.
Examples
julia
spiketimes = spike_times(population_records, time_constant)
SNNModels.spiketimes_split
— Methodspiketimes_split(Ps; kwargs...)
Return the spiketimes of each population in a vector of Spiketimes.
SNNModels.st_order
— Methodst_order(spiketimes::Spiketimes)
SNNModels.stimulate!
— Methodstimulate!(p::BalancedStimulus, param::BalancedParameter, time::Time, dt::Float32)
Generate a Balanced stimulus for a postsynaptic population.
SNNModels.subpopulations
— Functionsubpopulations(stim)
Extracts the names and the neuron ids projected from a given set of stimuli.
Arguments
stim
: A dictionary containing stimulus information.
Returns
names
: A vector of strings representing the names of the subpopulations.pops
: A vector of arrays representing the populations of the subpopulations.
Example
SNNModels.synapsearray
— FunctionConvert a Synapse to a SynapseArray.
Arguments
syn::Synapse
: The Synapse objectindices::Vector
: Optional vector of indices to include in the SynapseArray
Returns
SynapseArray
: The SynapseArray object
SNNModels.synapsearray
— MethodReturn the SynapseArray as is.
Arguments
syn::SynapseArray
: The SynapseArray object
Returns
SynapseArray
: The SynapseArray object
SNNModels.train!
— Methodtrain!(
P::Vector{TN},
C::Vector{TS};
dt = 0.1ms,
duration = 10ms,
) where {TN <: AbstractPopulation, TS<:AbstractConnection }
Trains the spiking neural network for a specified duration by repeatedly calling train!
function.
Arguments
P::Vector{TN}
: Vector of neurons in the network.C::Vector{TS}
: Vector of synapses in the network.dt::Float32
: Time step for the training. Default value is0.1ms
.duration::Float32
: Duration of the training. Default value is10ms
.
Details
- The function converts
dt
toFloat32
if it is not already. - The function creates a progress bar using the
ProgressBar
function with a range of time steps from0.0f0
toduration-dt
with a step size ofdt
. - The function iterates over the time steps and calls the
train!
function withP
,C
, anddt
.
SNNModels.update_time!
— Methodupdate_time!(T::Time, dt::Float32)
Update the current time and time step.
Arguments
T::Time
: The Time object.dt::Float32
: The time step size.
SNNModels.α_synapse
— MethodCalculate the alpha factor for a synapse given rise and decay time constants.
Arguments
τr
: Rise time constantτd
: Decay time constant
Returns
Float32
: The alpha factor
Plots
SNNPlots.dendrite_gplot
— Methoddendrite_gplot(population, target; sym_id=1, r, dt, param=:dend_syn, nmda=true, kwargs...)
Plot the synaptic current in the dendrite of a population of neurons.
The function uses the synaptic conductance and the membrane potential to calculate the synaptic current.
Parameters
----------
population : AbstractPopulation
The population of neurons to plot
target : Symbol
The target of the plot, either `:d` for single dendrite or `:d1/:d2`
neuron : Int
The neuron to plot
r : Array{Int}
The time range to plot
nmda : Bool
If true, the NMDA conductance is used to calculate the synaptic current
kwargs... : Any
SNNPlots.mutual_EI_connections
— Functionmutual_EI_connections(synapses, pre, post)
This function calculates the mutual and unidirectional connections between two populations of neurons, where one population inhibits the other. The function takes a synapses
object as input, which contains the synaptic weights between the two populations.
Arguments
synapses
: A struct containing the synaptic weights between the two populations of neurons.
Output
mutual
: An array containing the weights of the mutual connections.
SNNPlots.plot_activity
— Methodplot_activity(network, Trange)
Plot the activity of a spiking neural network with one dendritic excitatory population and two inhibitory populations. The function plots the firing rate of the populations, the membrane potential of the neurons, the synaptic conductance in the dendrite, the synaptic current in the dendrite, and the raster plot of the excitatory population.
Arguments:
network
: The spiking neural network object.Trange
: The time range for plotting.
Returns:
- Nothing.
Example:
SNNPlots.plot_average_word_activity
— Methodplot_average_word_activity(sym, word, model, seq; target=:d, before=100ms, after=300ms, zscore=true)
Plot the value of the `sym` variable for the neurons associated to the `word` stimulus.
`neurons = getneurons(model.stim, seq.symbols.words[w], target)`
Arguments:
- `sym`: The variable to plot.
- `word`: The word stimulus.
- `model`: The spiking neural network model.
- `seq`: The sequence of stimuli.
- `target`: The target compartment (default=:d).
- `before`: The time before the stimulus (default=100ms).
- `after`: The time after the stimulus (default=300ms).
- `zscore`: Whether to z-score the activity (default=true).
SNNPlots.plot_network_plasticity
— Methodplot_network_plasticity(model, simtime; interval = nothing, ΔT=1s, every=1)
Plot the network activity with (raster plot and average firing rate_ and the synaptic weight dynamics
Arguments:
- `model`: the model to plot
- `simtime`: the simulation time object
- `interval`: the interval to plot the firing rate and synaptic weight dynamics
- `ΔT`: the time window to plot the raster plot
- `every`: plot 1 out of `every` spikes in the raster plot
If `interval` is not provided, the function will plot the last 10 seconds of the simulation time
SNNPlots.plot_weights
— Methodplot_weights(network)
Plot the synaptic weights of: - inhibitory to excitatory neurons - correlation of synaptic weights between inhibitory and excitatory neurons - distribution of firing rates of the network
Arguments
network
: The spiking neural network object.
Returns
plot
: The plot object.
SNNPlots.soma_gplot
— Methodsoma_gplot( population, target; neuron=1, r, dt, param=:soma_syn, nmda=true, ax=plot(), kwargs...)
Plot the synaptic current in the soma of a population of neurons.
The function uses the synaptic conductance and the membrane potential to calculate the synaptic current.
Parameters
----------
population : AbstractPopulation
The population of neurons to plot
neuron : Int
The neuron to plot
r : Array{Int}:
The time range to plot
param : Symbol
The parameter to use for the synaptic conductance
ax : Plots.Plot
Plot over the current axis
SNNPlots.stdp_kernel
— Methodstdp_kernel(stdp_param; ΔT= -97.5:5:100ms)
Plot the STDP kernel for the given STDP parameters.
# Arguments
- `stdp_param::STDPParameter`: STDP parameters
- `ΔT::Array{Float32}`: Arrays of time differences between pre and post-synaptic spikes
# Return
- `Plots.Plot`: Plot of the STDP kernel
SNNPlots.stp_plot
— Functionstp_plot(model, interval, assemblies)
Plot the activity of a spiking neural network with short-term plasticity. The function plots the membrane potential, the firing rate, the synaptic weights, and the raster plot of the excitatory population.
Other types
SNNModels.AbstractConnectionParameter
— TypeAbstractConnectionParameter <: AbstractParameter
An abstract type representing a connection parameter.
SNNModels.AbstractParameter
— TypeAbstractParameter
An abstract type representing a parameter.
SNNModels.AbstractPopulationParameter
— TypeAbstractPopulationParameter <: AbstractParameter
An abstract type representing a population parameter.
SNNModels.AbstractStimulusParameter
— TypeAbstractStimulusParameter <: AbstractParameter
An abstract type representing a stimulus parameter.
SNNModels.AdditiveNorm
— TypeAdditiveNorm{FT = Float32} <: NormParam
This struct holds the parameters for additive normalization. It includes a timescale τ (default 0.0) and an operator (default addition).
SNNModels.DendNeuronParameter
— TypeDendNeuronParameter{FT, IT, DT, ST, NMDAT, PST, PT}
A parameter struct for the Tripod neuron model, implementing an Adaptive Exponential Integrate-and-Fire (AdEx) model with dendritic compartments.
Fields
C::FT
: Membrane capacitance (default: 281pF)gl::FT
: Leak conductance (default: 40nS)R::FT
: Total membrane resistance (default: nS/gl * GΩ)τm::FT
: Membrane time constant (default: C/gl)Er::FT
: Resting potential (default: -70.6mV)Vr::FT
: Reset potential (default: -55.6mV)Vt::FT
: Rheobase threshold (default: -50.4mV)ΔT::FT
: Slope factor (default: 2mV)τw::FT
: Adaptation current time constant (default: 144ms)a::FT
: Subthreshold adaptation conductance (default: 4nS)b::FT
: Spike-triggered adaptation increment (default: 80.5pA)AP_membrane::FT
: After-potential membrane parameter (default: 10.0f0mV)BAP::FT
: Backpropagating action potential parameter (default: 1.0f0mV)up::FT
: Spike upstroke duration (default: 1ms)τabs::FT
: Absolute refractory period (default: 2ms)postspike::PST
: Post-spike dynamics (default: PostSpike(A=10, τA=30ms))ds::DT
: Dendritic segment lengths (default: [200um, (200um, 400um)])physiology::PT
: Dendritic physiology (default: human_dend)soma_syn::ST
: Soma synapse type (default: TripodSomaSynapse)dend_syn::ST
: Dendritic synapse type (default: TripodDendSynapse)NMDA::NMDAT
: NMDA voltage dependency parameters (default: NMDAVoltageDependency(mg=MgmM, b=nmdab, k=nmda_k))
Type Parameters
FT
: Floating-point type for membrane parameters (default: Float32)IT
: Integer type for time-related parameters (default: Int64)DT
: Type for dendritic segment lengths (default: Vector{DendLength})ST
: Synapse type (default: Synapse)NMDAT
: NMDA voltage dependency type (default: NMDAVoltageDependency{Float32})PST
: Post-spike dynamics type (default: PostSpike{Float32})PT
: Physiology type (default: Physiology)
Examples
julia> TripodParameter = DendNeuronParameter(ds = [200um, (200um, 400um)])
DendNeuronParameter{Float32, Int64, Vector{DendLength}, Synapse, NMDAVoltageDependency{Float32}, PostSpike{Float32}, Physiology}(281.0, 40.0, 25.0, 7.03125, -70.6, -55.6, -50.4, 2.0, 144.0, 4.0, 80.5, 10.0, 1.0, 1, 2, PostSpike{Float32}(10, 30.0), [200.0, (200.0, 400.0)], human_dend, TripodSomaSynapse, TripodDendSynapse, NMDAVoltageDependency{Float32}(0.001, 0.062, 3.57))
julia> BallAndStickParameter = DendNeuronParameter(ds = [(150um, 400um)])
DendNeuronParameter{Float32, Int64, Vector{DendLength}, Synapse, NMDAVoltageDependency{Float32}, PostSpike{Float32}, Physiology}(281.0, 40.0, 25.0, 7.03125, -70.6, -55.6, -50.4, 2.0, 144.0, 4.0, 80.5, 10.0, 1.0, 1, 2, PostSpike{Float32}(10, 30.0), [(150.0, 400.0)], human_dend, TripodSomaSynapse, TripodDendSynapse, NMDAVoltageDependency{Float32}(0.001, 0.062, 3.57))
SNNModels.Dendrite
— TypeDendrite
A structure representing a dendritic compartment within a neuron model.
Fields
Er::FT = -70.6mV
: Resting potential.C::FT = 10pF
: Membrane capacitance.gax::FT = 10nS
: Axial conductance.gm::FT = 1nS
: Membrane conductance.l::FT = 150um
: Length of the dendritic compartment.d::FT = 4um
: Diameter of the dendrite.
The type FT
represents Float32.
SNNModels.EmptyParam
— TypeEmptyParam
A struct representing an empty parameter.
Fields
type::Symbol
: The type of the parameter, default is:empty
.
SNNModels.GABAergic
— TypeGABAergic struct represents a group of GABAergic receptors.
Fields
GABAa::T
: GABAa receptorGABAb::T
: GABAb receptor
SNNModels.Glutamatergic
— TypeGlutamatergic struct represents a group of glutamatergic receptors.
Fields
AMPA::T
: AMPA receptorNMDA::T
: NMDA receptor
SNNModels.MultiplicativeNorm
— TypeMultiplicativeNorm{FT = Int32} <: NormParam
This struct holds the parameters for multiplicative normalization. It includes a timescale τ (default 0.0) and an operator (default multiplication).
SNNModels.NMDAVoltageDependency
— TypeNMDAVoltageDependency struct represents the voltage dependence of NMDA receptors.
Fields
b::T
: Voltage dependence factor (default: 3.36)k::T
: Voltage dependence factor (default: -0.077)mg::T
: Magnesium concentration (default: 1.0)
SNNModels.NormParam
— TypeAbstract type for normalization parameters.
SNNModels.PlasticityVariables
— TypePlasticityVariables
An abstract type representing plasticity variables.
SNNModels.PoissonStimulusFixed
— TypePoissonStimulusFixed
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.PoissonStimulusInterval
— TypePoissonStimulusInterval
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.PoissonStimulusLayer
— TypePoissonStimulusLayer
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.PoissonStimulusVariable
— TypePoissonStimulusVariable
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.
SNNModels.PostSpike
— TypePostSpike
A structure defining the parameters of a post-synaptic spike event.
Fields
A::FT
: Amplitude of the Post-Synaptic Potential (PSP).τA::FT
: Time constant of the PSP.
The type FT
represents Float32.
SNNModels.Receptor
— TypeReceptor struct represents a synaptic receptor with parameters for reversal potential, rise time, decay time, and conductance.
Fields
E_rev::T
: Reversal potential (default: 0.0)τr::T
: Rise time constant (default: -1.0)τd::T
: Decay time constant (default: -1.0)g0::T
: Maximum conductance (default: 0.0)gsyn::T
: Synaptic conductance (default: calculated based ong0
,τr
, andτd
)α::T
: Alpha factor for the differential equation (default: calculated based onτr
andτd
)τr⁻::T
: Inverse of rise time constant (default: calculated based onτr
)τd⁻::T
: Inverse of decay time constant (default: calculated based onτd
)nmda::T
: NMDA factor (default: 0.0)
SNNModels.Spiketimes
— TypeSpiketimes
A type alias for a vector of vectors of Float32, representing spike times.
SNNModels.Synapse
— TypeSynapse struct represents a synaptic connection with different types of receptors.
Fields
AMPA::T
: AMPA receptorNMDA::T
: NMDA receptor (with voltage dependency)GABAa::T
: GABAa receptorGABAb::T
: GABAb receptor
SNNModels.Synapse
— MethodConstruct a Synapse from Glutamatergic and GABAergic receptors.
Arguments
glu::Glutamatergic
: Glutamatergic receptorsgaba::GABAergic
: GABAergic receptors
Returns
Synapse
: A Synapse object
SNNModels.Time
— Typestruct Time
Time
A mutable struct representing time. A mutable struct representing time.
Fields
t::Vector{Float32}
: A vector containing the current time.tt::Vector{Int}
: A vector containing the current time step.dt::Float32
: The time step size.
Helper macros
SNNModels.@load_units
— Macro@load_units
Load all the units defined in the module into the current scope.
This macro generates a block of expressions that assign the unit constants
The base units in the module are:
- cm : centimeters
- ms : milliseconds
- kHz : kilohertz
- mV : millivolts
- pA : picoamperes
- pF : picofarads
- nS : nanosiemens
- GΩ : gigaohms
- uM : micromolar
The derived units in the module are obtained as multiple or division of the base units.
The standard integration time step is 0.125ms, which is used in the simulation.
SNNModels.@snn_kw
— MacroA minimal implementation of Base.@kwdef
with default type parameter support