我试着用Brian2在Python中测试一个尖峰神经网络。我收到了这个错误:
File "C:\ProgramData\Anaconda3\envs\snn\lib\site-packages\brian2\groups\group.py", line 393, in __getattr__
raise AttributeError('No attribute with name ' + name)AttributeError:没有带有名称子群的属性
我的主要问题是创建一个G子群(NeuronGroup)。第一组为兴奋性神经元,第二组为抑制性神经元。
G = NeuronGroup(4000, model=eqs, threshold=Vt, reset=Vr)
Ge = G.subgroup(3200) # Excitatory neurons
Gi = G.subgroup(800) # Inhibitory neurons有人能帮我解决这个错误吗?谢谢。这个SNN (尖刺神经网络)的代码是:
import brian2
from brian2 import *
from brian2 import start_scope
taum = 20 * ms # membrane time constant
taue = 5 * ms # excitatory synaptic time constant
taui = 10 * ms # inhibitory synaptic time constant
Vt = -50 * mV # spike threshold
Vr = -60 * mV # reset value
El = -49 * mV # resting potential
we = (60 * 0.27 / 10) * mV # excitatory synaptic weight
wi = (20 * 4.5 / 10) * mV # inhibitory synaptic weight
eqs = Equations('''
dV/dt = (ge-gi-(V-El))/taum : volt
dge/dt = -ge/taue : volt
dgi/dt = -gi/taui : volt
''')
G = NeuronGroup(4000, model=eqs, threshold=Vt, reset=Vr)
Ge = G.subgroup(3200) # Excitatory neurons
Gi = G.subgroup(800) # Inhibitory neurons
Ce = Connection(Ge, G, 'ge', sparseness=0.02, weight=we)
Ci = Connection(Gi, G, 'gi', sparseness=0.02, weight=wi)
M = SpikeMonitor(G)
MV = StateMonitor(G, 'V', record=0)
Mge = StateMonitor(G, 'ge', record=0)
Mgi = StateMonitor(G, 'gi', record=0)
G.V = Vr + (Vt - Vr) * rand(len(G))
run(500 * ms)
subplot(211)
raster_plot(M, title='The CUBA network', newfigure=False)
subplot(223)
plot(MV.times / ms, MV[0] / mV)
xlabel('Time (ms)')
ylabel('V (mV)')
show()
subplot(224)
plot(Mge.times / ms, Mge[0] / mV)
plot(Mgi.times / ms, Mgi[0] / mV)
xlabel('Time (ms)')
ylabel('ge and gi (mV)')
legend(('ge', 'gi'), 'upper right')
show()发布于 2018-12-10 06:25:26
在Brian2中定义子组的依据如下:
例如,我们有p(神经元群),我们想要有它的两个子群。
P = NeuronGroup(4000, model=eqs, threshold='v>-20*mV', refractory=3*ms, method='exponential_euler')
Pe = P[:3200]
Pi = P[3200:]在我的问题中,我使用的是布莱恩的指令,而不是Brian2!所以我收到了错误。小心使用Brian2和Brian的指令!
https://stackoverflow.com/questions/53692787
复制相似问题