# # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. """ Simple network consisting of 10 disconnected neurons and a spike source array. """ import sys import common.setup # Common example code (checks command line parameters) import common.params # Parameters for the models which work with all systems import common.utils # Output functions import pynnless as pynl # Create a new pl instance with the given backend backend = sys.argv[1] sim = pynl.PyNNLess(backend) # Create and run network with two populations: One population consisting of a # spike source arrays and another population consisting of neurons. print("Simulating network...") count = 10 res = sim.run(pynl.Network().add_source( spike_times=[100.0 * i for i in xrange(1, 9)]).add_population( pynl.IfCondExpPopulation( count=count, params=common.params.IF_cond_exp).record_spikes()).add_connections( [((0, 0), (1, i), 0.024, 0.0) for i in xrange(count)])) print("Done!") # Write the spike times for each neuron to disk print("Writing spike times to " + common.setup.outfile)
# Read in neuron weights, some still have to be set manually with open("data/optimised_weights.json", 'r') as outfile: weights = json.load(outfile) # Generate BiNAM mat_in = data.generate(data_params["n_bits_in"], data_params["n_ones_in"], data_params["n_samples"]) mat_out = data.generate(data_params["n_bits_out"], data_params["n_ones_out"], data_params["n_samples"]) print "Data generated!" # set up simulator scm = pyscm.SpikeCounterModel(mat_in, mat_out) sim = pynl.PyNNLess(sys.argv[1]) net, input_indices, _, input_times = scm.build( params=params, weights=weights, delay=delay, terminating_neurons=terminating_neurons, flag=flag) print "Preparations done" # Simulation res = sim.run(net) print "Simulation done" # Plot for pIdx, pop in enumerate(res): if (not "spikes" in pop):