jaxley.synapses.ConductanceSynapse#

class ConductanceSynapse(nonlinearity=<PjitFunction of <function sigmoid>>, name=None)[source]#

Bases: Synapse

A conductance based synapse.

Unlike the CurrentSynapse, the current of this synapse is conductance-based and thus also depends on the post-synaptic voltage. However, unlike the DynamicSynapse, this synapse does not have a state.

This synapse implements the following equations:

\[I = \overline{g}\, \cdot \sigma\!\left( \frac{V_{\text{pre}} - V_{\text{thr}}}{\Delta} \right) \cdot (E - V_{\text{post}})\]

where \(\mathrm{\sigma}(\cdot)\) is a nonlinearity such as a ReLU, Sigmoid, or TanH. By default, it is a sigmoid, but it can be modified by the user.

More informally: This synaptic conductance nonlinearly depends on the pre-synaptic voltage. The current is conductance-based, i.e., it depends on a reversal potential.

The synaptic parameters are:
  • gS: the maximal conductance \(\overline{g}\) (uS).

  • v_th: the threshold at which the synapse becomes active \(V_{\text{thr}}\) (mV).

  • delta: The inverse of the slope of the activation \(\Delta\) (mV).

The inserted cellular parameters are:
  • e_syn: The synaptic reversal potential \(E\) (mV). This synapse uses the pre-synaptic reveral potential to compute the current, thereby directly enforcing Dale’s law.

The synaptic state is:
  • s: the activity level of the synapse \(\in [0, 1]\).

Example usage

Insert a synapse with a sigmoid nonlinearity (the default) and change parameters and initial state.

import jaxley as jx
from jaxley.connect import connect
from jaxley.synapses import ConductanceSynapse

cell = jx.Cell()
net = jx.Network([cell for _ in range(2)])

# Connect neurons with the `ConductanceSynapse`.
connect(net.cell(0), net.cell(1), ConductanceSynapse())

# Set parameters.
net.set("ConductanceSynapse_gS", 0.0001)  # Maximal conductance.
net.set("ConductanceSynapse_e_syn", 10.0)  # Reversal potential.
net.set("ConductanceSynapse_v_th", -40.0)  # Threshold.
net.set("ConductanceSynapse_delta", 10.0)  # 1 / slope of activation.

Insert a synapse with a ReLU nonlinearity.

import jaxley as jx
from jaxley.connect import connect
from jaxley.synapses import ConductanceSynapse
from jax.nn import relu

cell = jx.Cell()
net = jx.Network([cell for _ in range(2)])

# Connect neurons with the `ConductanceSynapse`.
connect(net.cell(0), net.cell(1), ConductanceSynapse(relu))

Insert a synapse with a custom nonlinearity.

import jaxley as jx
from jaxley.connect import connect
from jaxley.synapses import ConductanceSynapse

cell = jx.Cell()
net = jx.Network([cell for _ in range(2)])

def nonlinearity(x):
    return x ** 2

# Connect neurons with the `ConductanceSynapse`.
connect(net.cell(0), net.cell(1), ConductanceSynapse(nonlinearity))
Parameters:
synapse_params = None#
synapse_states = None#
update_states(synapse_states, synapse_params, pre_voltage, post_voltage, pre_states, post_states, pre_params, post_params, delta_t)[source]#

Return updated synapse state and current.

Parameters:
Return type:

Dict

compute_current(synapse_states, synapse_params, pre_voltage, post_voltage, pre_states, post_states, pre_params, post_params, delta_t)[source]#

Return current through one synapse in nA.

Internally, we use jax.vmap to vectorize this function across many synapses.

Parameters:
  • states – States of the synapse.

  • pre_voltage (Array) – Voltage of the presynaptic compartment, shape ().

  • post_voltage (Array) – Voltage of the postsynaptic compartment, shape ().

  • params – Parameters of the synapse. Conductances in uS.

  • synapse_states (dict[str, Array])

  • synapse_params (dict[str, Array])

  • pre_states (dict[str, Array])

  • post_states (dict[str, Array])

  • pre_params (dict[str, Array])

  • post_params (dict[str, Array])

  • delta_t (float)

Returns:

Current through the synapse in nA, shape ().

Return type:

float

change_name(new_name)#

Change the synapse name.

Parameters:

new_name (str) – The new name of the channel.

Returns:

Renamed channel, such that this function is chainable.

property name: str | None#