jaxley.connect.sparse_connect

Navigation

jaxley.connect.sparse_connect#

sparse_connect(pre_cell_view, post_cell_view, synapse_type, p, random_post_comp=False)[source]#

Sparsely connect cells of a network with synapses.

Connections are from branch 0 location 0 of the pre-synaptic cell to branch 0 location 0 of the post-synaptic cell unless random_post_comp=True.

NOTE: This function does not generate sparse random connectivity with random graph generation methodology. Cells may be connected multiple times and p=1.0 does not fully connect.

Parameters:
  • pre_cell_view (View) – View of the presynaptic cell.

  • post_cell_view (View) – View of the postsynaptic cell.

  • synapse_type (Synapse) – The synapse to append.

  • p (float) – Probability of connection.

  • random_post_comp (bool) – If True, randomly samples the postsynaptic compartments.

Example usage#

The following example insert approximately 6 synapses (3 x 4 = 12 possible synapses, with connection probability 0.5).

from jaxley.connect import sparse_connect
from jaxley.synapses import IonotropicSynapse

net = jx.Network([cell for _ in range(10)])
sparse_connect(
    net.cell([0, 1, 2]),
    net.cell([3, 4, 5, 6]),
    IonotropicSynapse(),
    p=0.5,
)
print(net.edges)