jaxley.connect.connect

Navigation

jaxley.connect.connect#

connect(pre, post, synapse_type)[source]#

Connect specific compartments of a network with a synapse.

The pre- and postsynaptic compartments must be compartments of the same network. If pre and post are both just a single compartment, then this function instantiates a single synapse. If pre and post are both N compartments, then this function instatiates N synapses (first-to-first, second-to-second,…).

Parameters:
  • pre (View) – View of the presynaptic compartment.

  • post (View) – View of the postsynaptic compartment.

  • synapse_type (Synapse) – The type of synapse to use.

Example usage#

Example 1: Connect one compartment to another compartment with a single synapse:

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

net = jx.Network([cell for _ in range(10)])
connect(
    net.cell(0).branch(0).comp(0),
    net.cell(1).branch(0).comp(0),
    IonotropicSynapse(),
)
print(net.edges)

Example 2: Connect N compartments to N other compartments with N synapses:

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

net = jx.Network([cell for _ in range(10)])
connect(
    net.cell(0).branch([0, 1]).comp(0),
    net.cell(1).branch([2, 3]).comp(0),
    IonotropicSynapse(),
)
print(net.edges)