superneuromat.SNN.create_synapse#

SNN.create_synapse(pre_id: int | Neuron, post_id: int | Neuron, weight: float = 1.0, delay: int = 1, stdp_enabled: bool | Any = False, exist: str = 'error', **kwargs) Synapse[source]#

Creates a synapse in the SNN

Creates synapse connecting a pre-synaptic neuron to a post-synaptic neuron with a given set of synaptic parameters (weight, delay and stdp_enabled)

Parameters:
  • pre_id (int | Neuron) – ID of the pre-synaptic neuron (spike sender).

  • post_id (int | Neuron) – ID of the post-synaptic neuron (spike destination).

  • weight (float, default=1.0) – Synaptic weight; weight is multiplied to the incoming spike.

  • delay (int, default=1) – Synaptic delay; number of time steps by which the outgoing signal of the synapse is delayed by.

  • stdp_enabled (bool | Any, default=False) – If True, stdp will be enabled on the synapse, allowing the weight of this synapse to be updated.

  • exist (str, default='error') – Action if synapse already exists with the exact pre- and post-synaptic neurons. Should be one of [‘error’, ‘overwrite’, ‘dontadd’].

If a delay is specified, a chain of neurons and synapses will automatically be added to the model to represent the delay, and this function will return the last synapse of the chain. The other neurons and synapses in the chain can be accessed via the delay_chain and delay_chain_synapses properties of the synapse, respectively.

While only positive delay values are supported due to temporal consistency and causality requirements, The delay will be stored as delay * -1 in the model to represent that it is a chained delay. This does not affect the effective delay value, as the delay will still be applied via the delay chain.

Note that delays of delay chains cannot be modified after creation.

Raises:
  • TypeError

    • pre_id or post_id is not neuron or neuron ID (int).

    • weight is not a float.

    • delay cannot be cast to int.

    • exist is not a str.

  • ValueError

    • pre_id or post_id is not a valid neuron or neuron ID.

    • delay is less than or equal to 0

    • exist is not one of 'error', 'overwrite', 'dontadd'.

    • Synapse with the given pre- and post-synaptic neurons already exists, exist='overwrite', and delay != 1.

  • RuntimeError

    • Synapse with the given pre- and post-synaptic neurons already exists and exist='error'.

Return type:

Synapse