Description of problem

I have simplified my network to 2 neurons, after realising that the conductances of post-synaptic neurons weren’t increasing following spikes of pre-synaptic neurons. The rpoblem persists.
When I plot g_exc for example it is a straight line.

Minimal code to reproduce problem

``````def define_network(parameters):
# Define neuron model
eqs = """
dv/dt = (g_l*(e_l-v) + g_l*slope_f*exp((v-v_t)/slope_f) - g_exc*(v-E_exc) - g_inh*(v-E_inh) + i_stim - w)/c_m : volt
dw/dt = (a*(v - e_l) - w)/tau_w : amp
dg_exc/dt = -g_exc/tau_exc : siemens
dg_inh/dt = -g_inh/tau_inh : siemens
x : 1 (constant)
y : 1 (constant)
"""
ain_params = parameters['general'].copy()
ain_params.update(parameters['ains'])
mn_params = parameters['general'].copy()
mn_params.update(parameters['mns'])

N_A = parameters['ains']['N']

N_M = parameters['mns']['N']

ains_left = NeuronGroup(N_A, model=eqs, method='euler', threshold='v > 0*mV', reset='v = vr\nw = w + b', namespace=ain_params)
mns_left = NeuronGroup(N_M, model=eqs, method='euler', threshold='v > 0*mV', reset='v = vr\nw = w + b', namespace=mn_params)

ains_left.v = parameters['ains']['e_l']

mns_left.v = parameters['mns']['e_l']

ains_left.w = 0
mns_left.w = 0

ains_left.x = 1  # X position
ains_left.y = 'i'  # Y position

mns_left.x = 3  # X position
mns_left.y = 'i'  # Y position

synaptic_model = '''
w_syn : siemens
d : 1
'''

S_mn_ain_l = Synapses(mns_left, ains_left, model=synaptic_model, on_pre='g_exc+=w_syn')
S_mn_ain_l.connect()
S_mn_ain_l.w_syn = parameters['mns']['w_mn_ain']

S_ain_mn_l = Synapses(ains_left, mns_left, model=synaptic_model, on_pre='g_inh+=w_syn')
S_ain_mn_l.connect()
S_ain_mn_l.w_syn = parameters['ains']['w_ain_mn']

return ains_left, mns_left

def run_simulation(parameters, simulation_time):

ains_left, mns_left = define_network(parameters)

N_A = parameters['ains']['N']
N_M = parameters['mns']['N']

spikes_ain_l = SpikeMonitor(ains_left)

spikes_mn_l = SpikeMonitor(mns_left)

mon_ain = StateMonitor(ains_left, 'g_exc', record=0)  # Record the membrane potential of the first aIN

mon_mn = StateMonitor(mns_left, 'g_exc', record=0)    # Record the membrane potential of the first MN

defaultclock.dt = 0.1 * ms
time_secs = simulation_time
run(time_secs)

return mon_ain, mon_mn
``````

(parameters is a dictionary of parameters, I set w_syn for the connections to large values (1000nsiemens) but nothing happened).

What you have already tried

Simplified the network and plotted the conductance. Discovered that the problem was that the conductance wasn’t changing.

Hi @awilson98. The problem is that the synapses objects are not returned from your `define_network` function. In `run_simulation`, the `run` function looks for “Brian objects” that should be included in the network (an alternative would be to create a `Network` object manually) ­– it sees `ains_left, mns_left` and the monitors, but no synapses, so they do not get included in the simulation. Additionally, given that nothing references thes synapses anymore, Python is free to delete the `Synapses` objects. This is probably a situation where we should raise a warning, we’ve recently discussed similar cases in this GitHub issue: Returned value needs to be retrieved for object to work · Issue #1499 · brian-team/brian2 · GitHub

Hope that helps!
Marcel

PS: For nicer display of code blocks, you can use the following markdown syntax (I’ve edited your post accordingly):

`````````
# Here goes the Python code
print("Hello")
```
``````

Thank you, that solves it!

1 Like