""" This is 3x3onA (described below ---) but now is done for the full range of neurons. -------------------------------------------------------- This is just a 1ms Izhikevich model that spikes every 10ms. from istanbul. Now use that in the earlier (RetNetI.py) configuration, to get variable behaviour. In this we get 6 different behaviours. It spikes fastest and most with just the centre on. It decreases with 1-5 surround on. With 5 to 8 surround on there is no firing. This is a direct copy of RetNetJ.py, just to get the names right for the other 5 sensors. """ from pyNN.utility import get_script_args, normalized_filename #from neo.io import NeoHdf5IO from neo.io import PyNNTextIO #from neo import io INPUT_NEURONS_HEIGHT = 50 INPUT_NEURONS_WIDTH = 50 #DELAY = 10.0 DELAY = 1.0 SIM_LENGTH = 200.0 #----------setup connections for input to 1 3x3 on centre off surround detector def set3x3Connections(X,Y): excite = 25.0 inhib = -2.0 retinaNumber = INPUT_NEURONS_WIDTH*(X)+ Y inhib1 = (INPUT_NEURONS_WIDTH*(X-1))+Y-1 inhib2 = (INPUT_NEURONS_WIDTH*(X-1))+Y inhib3 = (INPUT_NEURONS_WIDTH*(X-1))+Y+1 inhib4 = (INPUT_NEURONS_WIDTH*(X))+Y-1 inhib6 = (INPUT_NEURONS_WIDTH*(X))+Y+1 inhib7 = (INPUT_NEURONS_WIDTH*(X+1))+Y-1 inhib8 = (INPUT_NEURONS_WIDTH*(X+1))+Y inhib9 = (INPUT_NEURONS_WIDTH*(X+1))+Y+1 connector = [ (retinaNumber, retinaNumber, excite, DELAY), (inhib1, retinaNumber, inhib, DELAY), (inhib2, retinaNumber, inhib, DELAY), (inhib3, retinaNumber, inhib, DELAY), (inhib4, retinaNumber, inhib, DELAY), (inhib6, retinaNumber, inhib, DELAY), (inhib7, retinaNumber, inhib, DELAY), (inhib8, retinaNumber, inhib, DELAY), (inhib9, retinaNumber, inhib, DELAY), ] return connector; #------------Main Body--------------- simulator_name = get_script_args(1)[0] exec("from pyNN.%s import *" % simulator_name) setup(timestep=DELAY,min_delay=DELAY,max_delay=DELAY,debug=0) #input neurons cInputNeurons = INPUT_NEURONS_HEIGHT * INPUT_NEURONS_WIDTH #default a .02, b .2, c -65, d 2.0, i_offset 0 inp_cell_params = {'a' : 0.0, 'b' :0.2, 'c' : -65, 'd' : 0.0} inpPop = Population(cInputNeurons,Izhikevich(**inp_cell_params)) inpPop.initialize(v=-58.0) #output neuron retina_cell_params = {'a' : 0.2, 'b' :0.2, 'c' : -65, 'd' : 2.0} retinaPop = Population(cInputNeurons,Izhikevich(**retina_cell_params)) #set up clamped input pulse = DCSource(amplitude=0.0038, start=0.0, stop=SIM_LENGTH) inputAssembly = Assembly(inpPop[51,52]) pulse.inject_into(inputAssembly) synapseArray = [] #setup connections for row in range (1,49): for col in range (1,49): newSynapses = set3x3Connections(col,row) synapseArray = synapseArray + newSynapses #connectorA = set3x3Connections(1,1) #print connectorA #input_conns = Projection(inpPop, retinaPop, connectorA, StaticSynapse()) #connectorB = set3x3Connections(1,2) #connectorA = connectorA+ connectorB #print connectorA #print synapseArray input_conns = Projection(inpPop, retinaPop, FromListConnector(synapseArray), StaticSynapse()) #setup recording inpPop.record(['spikes','v']) retinaPop.record(['spikes','v']) print inpPop[0].get_parameters() run(SIM_LENGTH) #--------------print results outAss = Assembly(retinaPop[51,52]) outDat = outAss.get_data() for seg in outDat.segments: print(seg.spiketrains) end()