I am trying to plot a SpikeMonitor
for a neuron which has 784 Poisson inputs. But I am getting a blank plot. Why is this happening and how can I resolve it?
I have tried varying the frequencies of the input neurons and also tried changing the number of neurons in the output neuron layer (instead of 1). But this didn't help.
Here is my code, with suitable comments:
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
I am getting the correct graph for brian_plot(M)
but not for brian_plot(N)
. The brian_plot
graph should not be a blank graph.
SpikeMonitor is an object that stores time(t) and indices(i) of neurons which fire. If you want to plot you must determine the time and index axis. There are some mistakes in your code. you haven't defined tau, Er, and Vr so receiving error is reasonable.