spiking.py

SRM 0 model

class neurons.spiking.SRM(neurons, threshold, t_current, t_membrane, eta_reset, simulation_window_size=100, verbose=False)

SRM_0 (Spike Response Model)

Neurons can have different threshold, t_current, t_membrane and eta_resets: Set those variables to 1D np.arrays of all the same size.

Parameters:
  • neurons – Number of neurons
  • threshold – Spiking threshold
  • t_current (Float or Numpy Float Array) – Current-time-constant (\(t_s\))
  • t_membrane – Membrane-time-constant (t_m)
  • eta_reset – Reset constant
  • simulation_window_size – Only look at the n last spikes
  • verbose – Print verbose output to the console
Returns:

None

check_spikes(spiketrain, weights, t)

Simulate one time step at time t. Changes the spiketrain in place at time t! Return the total membrane potential of all neurons.

Parameters:
  • spiketrain – Spiketrain (Time indexing begins with 0)
  • weights – Weights
  • t – Evaluation time
Returns:

total membrane potential of all neurons at time step t (vector), spikes at time t

eps(s)

Evaluate the Epsilon function:

(1)\[\epsilon (s) = \frac{1}{1 - \frac{\tau_c}{\tau_m}} (\exp(\frac{-s}{\tau_m}) - \exp(\frac{-s}{\tau_c}))\]

Returns a single Float Value if the time constants (current, membrane) are the same for each neuron. Returns a Float Vector with eps(s) for each neuron, if the time constants are different for each neuron.

Parameters:s – Time s
Returns:Function eps(s) at time s
Return type:Float or Vector of Floats
eps_matrix(k, size)

Returns the epsilon helpermatrix.

Example:
>>> eps_matrix(3, 5)
[[eps_0(3), eps_0(2), eps_0(1), eps_0(0), eps_0(0)],
 [eps_1(3), eps_1(2), eps_1(1), eps_1(0), eps_1(0)]]

Where eps_0(3) means the epsilon function of neuron 0 at time 3.

Parameters:
  • k – Leftmost epsilon time
  • size – Width of the return matrix
Returns:

Epsilon helper matrix

Return type:

Numpy Float Array, dimensions: (neurons x size)

eta(s)

Evaluate the Eta function:

(2)\[\eta (s) = - \eta_{reset} * \exp(\frac{- s}{\tau_m})\]
Parameters:s – Time s
Returns:Function eta(s) at time s
Return type:Float or Vector of Floats

Izhikevich model

class neurons.spiking.Izhikevich(neurons, a, b, c, d, v0=-65, threshold=30, verbose=False)

Izhikevich model

http://www.izhikevich.org/publications/spikes.htm

Parameters:
  • neurons – total number of neurons
  • a – decay rate
  • b – sensitivity
  • c – reset
  • d – reset
  • v0 – Initial voltage
  • threshold
  • verbose (Boolean) – Verbose output to console. Default: False.
Returns: