Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import nengo
- import numpy as np
- from random import *
- import csv
- # Constants
- NUM_ORNS = 40
- DELTA = 0.01 # presentation_time
- # Read in list of 40 spike trains (40 lines in csv)
- with open('spike_trains.csv') as f:
- reader = csv.reader(f)
- spike_trains = np.array([[int(element) if element.isdigit() else element for element in sub] for sub in list(reader)])
- # Spike trains to input
- spiked_neurons = [None]*NUM_ORNS
- # Init nengo model
- model = nengo.Network()
- with model:
- # Initialize one PRN that combines ORN inputs
- prn = nengo.Ensemble(n_neurons=2, dimensions=1)
- # Iterate through each ORN and connect with PRN
- for orn in range(NUM_ORNS):
- # Initialize ORN
- spiked_neurons[orn] = nengo.Node(nengo.processes.PresentInput(np.array(spike_trains[orn]), DELTA))
- # Connect ORN_orn to PRN
- nengo.Connection(spiked_neurons[orn], prn)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement