Last active
March 25, 2016 22:45
-
-
Save astoeckel/6b252f3ce955f6393586 to your computer and use it in GitHub Desktop.
Spikey Bug: Targeting excitatory and inhibitory synapses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Test script which demonstrates a Bug in Spikey: | |
# If a SpikeSourceArray targets both excitatory and inhibitory synapses (of | |
# different target neurons), only inhibitory connections are made. | |
import numpy as np | |
import pyNN.hardware.spikey as sim | |
sim.setup() | |
n_src = 8 # Neurons in the source population | |
n_tar = 8 # Neurons in the target population | |
w = 4.0 * sim.minExcWeight() # Synaptic weight | |
runtime = 10.0e3 # Runtime of the simulation | |
spikes = np.arange(0, runtime, 1000.0 / 100.0).tolist() # 10 Hz fire rate | |
# Create the source and target populations | |
pop_src = sim.Population(n_src, sim.SpikeSourceArray, {"spike_times": spikes | |
}) | |
pop_tar = sim.Population(n_tar, sim.IF_facets_hardware1) | |
# Excitatory connection from src to even neurons in tar | |
sim.Projection(pop_src, | |
pop_tar, | |
sim.FromListConnector([(i, j, w, 0.1) | |
for i in xrange(0, n_src) for j in | |
xrange(0, n_tar, 2)]), | |
target='excitatory') | |
# Inhibitory connection from src to odd neurons in tar | |
# If present, output fire rate is zero -- although the output rate should not | |
# change at all | |
sim.Projection(pop_src, | |
pop_tar, | |
sim.FromListConnector([(i, j, w, 0.1) | |
for i in xrange(0, n_src) for j in | |
xrange(1, n_tar, 2)]), | |
target='inhibitory') | |
# Record output spikes, run the simulation and calculate the average output spike | |
pop_tar.record() | |
sim.run(runtime) | |
print "Average fire rate: " + str(float(len(pop_tar.getSpikes())) / n_tar / | |
runtime * 1e3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment