When running with synapse of 0-connections loaded from a file, I encounter the error the following error in runtime mode:
"synapses' does not do anything ...."
This error, however, doesn’t show up in cpp_standalone mode. Is it possible to avoid this error in runtime mode?
Here is the code to demonstrate the issue:
from brian2 import *
import numpy as np
#set_device('cpp_standalone')
eqs = '''
dv/dt = (I-v)/tau : 1
I : 1
tau : second
'''
G = NeuronGroup(3, eqs, threshold='v>1', reset='v = 0', method='exact')
G.I = [2, 0, 0]
G.tau = [10, 100, 100]*ms
t = np.load('test.npz')
S = Synapses(G, G, 'w : 1', on_pre='v_post += w')
if len(t['i'])>0:
S.connect(i=t['i'], j=t['j'])
S.w = t['w']
S.delay = t['delay']*ms
net = Network()
net.add(G)
net.add(S)
run(50*ms)
After removing the comment on “set_device(‘cpp_standalone’)”, the run will be successful. I also noticed that without “Network()”, the code can run in both mode, but I will need the Network() in the actual application.
The code to produce the input file “test.npz” is the following:
from brian2 import *
import numpy as np
eqs = '''
dv/dt = (I-v)/tau : 1
I : 1
tau : second
'''
G = NeuronGroup(3, eqs, threshold='v>1', reset='v = 0', method='exact')
G.I = [2, 0, 0]
G.tau = [10, 100, 100]*ms
S = Synapses(G, G, 'w : 1', on_pre='v_post += w')
S.connect(p=0.0)
S.w = 'j*0.2'
S.delay = 'j*2*ms'
# save the file, load it and run
np.savez('test', i=S.i[:], j=S.j[:], w=S.w[:], delay=S.delay[:])
run(50*ms)
Thanks