我正在尝试为具有784个泊松输入的神经元绘制SpikeMonitor
。但是我得到一个空白。为什么会发生这种情况,我该如何解决?
这是我的代码,带有适当的注释:
start_scope()
#a = spike_freqs_img_120*Hz
# Create group of 784 neurons which spike at
# Poisson probability distributed time instances with given 1Hz frequency:
P = PoissonGroup(784, 1*Hz)
# Weight for connection between neurons:
W = 5*siemens
# Equation followed by neuron behaviour:
eqs1 = '''dv/dt = -(v-El)/tau : volt'''
# Create a single neuron which behaves according to the above equation:
neuron = NeuronGroup(100, eqs1, threshold='v>Vt', reset='v=Vr', method='exact')
# Set initial voltage of the neuron:
neuron.v = Vr
# Define how the connections between neurons should be:
synapses = Synapses(P, neuron, 'w: siemens')
synapses.connect() # Make connections
synapses.w = W # Set weight of connection
M = SpikeMonitor(P) # M stores the spike data of neurons in input
N = SpikeMonitor(neuron) # Similarly N stores for output neuron
run(1*second) # run the simulation for 1 second
brian_plot(M) # plot spikemonitor for input neurons
brian_plot(N) # plot spikemonitor for output neuron
我得到的是brian_plot(M)
的正确图形,但不是brian_plot(N)
的正确图形。 brian_plot
图不应为空白图。
答案 0 :(得分:1)
SpikeMonitor是一个对象,它存储激发的神经元的时间(t)和索引(i)。 如果要绘制,则必须确定时间和索引轴。 您的代码中有一些错误。您尚未定义tau,Er和Vr,因此接收错误是合理的。
brian_plot(M.t/ms, M.i)
brian_plot(N.t/ms, N.i)