我是第一次使用Brian2库。我已经编写了一个简单的网络,其中包含25个突触前神经元和1个突触后神经元,并由alpha突触连接。我也是python的新手。这段代码抛出了ZeroDivisionError:float除法运算符,我不确定是否有足够的指针指向错误?
此外,如果您发现代码有任何其他问题,请告知。
from brian2 import *
import numpy as np
if __name__ == '__main__':
tau = 10 * ms #membrane time constant
tau_syn = 10 * ms #synaptic time constant
El = 0 * mV #reset potential
# Leaky IF neuron with alpha synapses
eqs = Equations('''dvm/dt = ((El - vm) + I)/tau : volt
dI/dt = (ge-I)/tau_syn : volt
dge/dt = -ge/tau_syn : volt''')
lif_pre = PoissonGroup(25, rates=40*Hz)
lif_post= NeuronGroup(1, eqs, threshold='vm > 15 * mV',reset='vm =0 * mV', method= 'exact')
C = Synapses(lif_pre, lif_post, 'w : volt', on_pre = 'ge
+= w')
C.connect()
W_12 = 1.80 * mV + 0.5*randn(25,1) * mV
C.w = W_12.flatten()
spikes_pre = SpikeMonitor(lif_pre)
spikes_post= SpikeMonitor(lif_post)
v_trace = StateMonitor(lif_post, 'vm', record=True)
I_trace = StateMonitor(lif_post, 'ge', record=True)
run(0.1 *ms)
运行命令后立即发生错误! Click to see the error message