Skip to content

Commit 606042f

Browse files
author
Alexander Ororbia
committedApr 27, 2025
cleaned up alpha/exp syn
1 parent e9c8674 commit 606042f

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed
 

‎ngclearn/components/synapses/alphaSynapse.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ class AlphaSynapse(DenseSynapse): ## dynamic alpha synapse cable
4040
4141
g_syn_bar: maximum conductance elicited by each incoming spike ("synaptic weight")
4242
43-
syn_rest: synaptic reversal potential
43+
syn_rest: synaptic reversal potential; note, if this is set to `None`, then this
44+
synaptic conductance model will no longer be voltage-dependent (and will ignore
45+
the voltage compartment provided by an external spiking cell)
4446
4547
weight_init: a kernel to drive initialization of this synaptic cable's values;
4648
typically a tuple with 1st element as a string calling the name of
@@ -96,7 +98,9 @@ def advance_state(
9698
dgsyn_dt = -g_syn/tau_syn + h_syn # or -g_syn/tau_syn + h_syn/tau_syn
9799
g_syn = g_syn + dgsyn_dt * dt ## run Euler step to move conductance g
98100

99-
i_syn = -g_syn * (v - syn_rest)
101+
i_syn = -g_syn
102+
if syn_rest is not None:
103+
i_syn = -g_syn * (v - syn_rest)
100104
outputs = i_syn #jnp.matmul(inputs, Wdyn * Rscale) + biases
101105
return outputs, i_syn, g_syn, h_syn
102106

‎ngclearn/components/synapses/exponentialSynapse.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ class ExponentialSynapse(DenseSynapse): ## dynamic exponential synapse cable
3939
4040
g_syn_bar: maximum conductance elicited by each incoming spike ("synaptic weight")
4141
42-
syn_rest: synaptic reversal potential
42+
syn_rest: synaptic reversal potential; note, if this is set to `None`, then this
43+
synaptic conductance model will no longer be voltage-dependent (and will ignore
44+
the voltage compartment provided by an external spiking cell)
4345
4446
weight_init: a kernel to drive initialization of this synaptic cable's values;
4547
typically a tuple with 1st element as a string calling the name of
@@ -90,7 +92,9 @@ def advance_state(
9092
_out = jnp.matmul(s, weights) ## sum all pre-syn spikes at t going into post-neuron)
9193
dgsyn_dt = -g_syn/tau_syn + _out * g_syn_bar
9294
g_syn = g_syn + dgsyn_dt * dt ## run Euler step to move conductance
93-
i_syn = -g_syn * (v - syn_rest)
95+
i_syn = -g_syn
96+
if syn_rest is not None:
97+
i_syn = -g_syn * (v - syn_rest)
9498
outputs = i_syn #jnp.matmul(inputs, Wdyn * Rscale) + biases
9599
return outputs, i_syn, g_syn
96100

0 commit comments

Comments
 (0)