# Populations

A population of neurons is a collection of a single type of neuron connected by a single type of synapse. A learning mechanism is associated with the synapses of a population.

`SpikingNN.Population`

— Type```
Population{T<:Soma,
NT<:AbstractArray{T, 1},
WT<:AbstractMatrix{<:Real},
ST<:AbstractArray{<:AbstractSynapse, 2},
LT<:AbstractLearner} <: AbstractArray{T, 1}
```

A population of neurons is an array of `Soma`

s, a weighted matrix of synapses, and a learner.

Fields:

`somas::AbstractArray{<:Soma, 1}`

: a vector of somas`weights::AbstractMatrix{<:Real}`

: a weight matrix`synapses::AbstractArray{<:AbstractSynapse, 2}`

: a matrix of synapses`learner::AbstractLearner`

: a learning mechanism

`Base.size`

— Method`size(pop::Population)`

Return the number of neurons in a population.

`SpikingNN.neurons`

— Function`neurons(pop::Population)`

Return an array of neurons within the population.

`SpikingNN.synapses`

— Function`synapses(pop::Population)`

Return an array of edges representing the synapses within the population.

`SpikingNN.evaluate!`

— Method```
evaluate!(pop::Population, t::Integer; dt::Real = 1.0, dense = false, inputs = nothing)
(::Population)(t::Integer; dt::Real = 1.0, dense = false)
```

Evaluate a population of neurons at time step `t`

. Return a vector of time stamps (`t`

if the neuron spiked and zero otherwise).

Missing docstring for `update!(::Population, ::Integer; ::Real)`

. Check Documenter's build log for details.

`SpikingNN.reset!`

— Method`reset!(pop::Population)`

Reset `pop.synapses`

and `pop.somas`

.

`SpikingNN.simulate!`

— Method`simulate!(pop::Population, dt::Real = 1.0)`

Simulate a population of neurons. Optionally specify a learner. The `prespike`

and `postspike`

functions will be called immediately after either event occurs.

Fields:

`pop::Population`

: the population to simulate`T::Integer`

: number of time steps to simulate`dt::Real`

: the simulation time step`cb::Function`

: a callback function that is called after event evaluation (expects`(neuron_id, t)`

as input)`dense::Bool`

: set to`true`

to evaluate every time step even in the absence of events