Synapse

class fugu.simulators.SpikingNeuralNetwork.synapse.Synapse(pre_neuron: Neuron | None = None, post_neuron: Neuron | None = None, weight: float = 0.0)

Bases: ABC

Abstract base class for Synapses. This defines the interface for synapses with a minimum set of properties

Parameters:
  • pre_neuron (Neuron) – Pre-synaptic neuron that provides input to the synapse

  • post_neuron (Neuron) – Post-synaptic neuron

  • weight (double) – Synaptic weight

abstract update_state()

Update the state of the synapse

abstract get_key()

Get the key which is the pre and post synaptic neuron for the given synapse

abstract property pre_neuron

Getter for pre_neuron.

class fugu.simulators.SpikingNeuralNetwork.synapse.LearningSynapse(pre_neuron: Neuron, post_neuron: Neuron, learning_rule: str | None = None, delay: int = 1, weight: float = 1.0, mod_neuron: Neuron | None = None, learning_params=None)

Bases: Synapse

Synapses connect neurons in a neural network. The synapse class in a spiking objects models a simple synapse type that scales the input by a weight (double) and relays the information with a delay (non-negative int) of n time-steps.

Parameters:
  • Pre_neuron (Neuron) – Pre-synaptic neuron that provides input to the synapse

  • Post_neuron (Neuron) – Post-synaptic neuron that receives the signals from the synapse

  • learning_rule (str) – optional. The learning rule to be applied to the synapse. Currently provides options among ([“STDP”, “three-factor”, “None”]). The default is None.

  • Delay (int) – non-negative Int, optional. Number of time steps needed to relay the scaled spike. The default is 1.

  • Weight (double) – optional. Scaling value for incoming spike. The default is 1.0.

  • Mod_neuron (Neuron) – optional. Modulatory neuron for transmitting either errors or other modulatory signals

  • pre_neuron (Neuron) – Pre-synaptic neuron that provides input to the synapse

  • post_neuron (Neuron) – Post-synaptic neuron

  • weight (double) – Synaptic weight

get_key()
Returns:

Pre neuron of the synapse self._post (tuple) post neuron of synapse

Return type:

self._pre (tuple)

property pre_neuron

Getter for pre_neuron. :returns: Pre-synaptic neuron that provides input to the synapse :rtype: self._pre (Neuron)

property post_neuron

Getter for post_neuron. :returns: Post-synaptic neuron that receives the signals from the synapse :rtype: self._post (Neuron)

property weight

Getter for synaptic weight

Returns:

scaling weight of the synapse.

Return type:

self._w (double)

property delay

Getter for synaptic delay (in time steps)

Returns:

delay in time steps

Return type:

self._d (int)

set_params(new_delay=1, new_weight=1.0)

Sets delay and weight of a synapse

Parameters:
  • new_delay (int) – optional Set delay to new value. The default is 1.0.

  • new_weight (Double) – optional. Set weight to new value. The default is 1.0.

Returns:

None

show_params()

Display the information of the synapse (pre-synaptic neuron, post-synaptic neuron, delay, weight and the learning rule).

Returns:

None

get_learning_params()

Get the learning parameters for the synapse

Returns:

Learning parameters for the synapse as a dictionary

Return type:

self._learning_params (LearningParams.__dict__)

update_state()

Updates the time evolution of the states for one time step. The spike information is sent through a queue of length given by the delay and scaled by the weight value.

Returns:

None

static calculate_spike_timing(spike_hist: list) int

Calculate the timing between the reference and either pre or post synaptic spike

Parameters:

spike_hist (deque) – Spike history of the post or pre synaptic neuron

Returns:

time difference between the pre and post synaptic spikes

Return type:

int

apply_learning() None

Modify the weight of the synapse with STDP learning rule. The STDP learning rule is implemented as follows:

When a post synaptic spike occurs after a pre synaptic spike, the weight is increased according to w += A_p * exp(-delta_t/tau), where delta_t is the difference in spike time of the post and pre synaptic neuron respectively

When a post synaptic spike occurs before a pre synaptic spike, the weight is decreased according to w += A_n * exp(delta_t/tau), where delta_t is the difference in spike time of the post and pre synaptic neuron respectively

Returns:

None

class fugu.simulators.SpikingNeuralNetwork.synapse.Synapse(pre_neuron: Neuron | None = None, post_neuron: Neuron | None = None, weight: float = 0.0)

Bases: ABC

Abstract base class for Synapses. This defines the interface for synapses with a minimum set of properties

Parameters:
  • pre_neuron (Neuron) – Pre-synaptic neuron that provides input to the synapse

  • post_neuron (Neuron) – Post-synaptic neuron

  • weight (double) – Synaptic weight

abstract update_state()

Update the state of the synapse

abstract get_key()

Get the key which is the pre and post synaptic neuron for the given synapse

abstract property pre_neuron

Getter for pre_neuron.