""" A 5 5 oscillator from the 1ms Izhikevich model. The only parameter modified in the I model is a from .02 -> .05. Once turned on the oscillator has a couple of quick spikes, then each set takes 10ms to fire. This is twice as fast than the FLIF ones. Fires for four primitives """ #from pyNN.utility import get_script_args, normalized_filename #from neo.io import NeoHdf5IO from neo.io import PyNNTextIO #from neo import io #import matplotlib.pyplot as plt #import numpy as np from pyNN.utility import get_script_args, init_logging, normalized_filename #DELAY = 10.0 DELAY = 1.0 output_filename='maes2_out.dat' SIM_LENGTH = 500.0 simulator_name = get_script_args(1)[0] exec("from pyNN.%s import *" % simulator_name) setup(timestep=DELAY,min_delay=DELAY,max_delay=DELAY,debug=True) def con(A, B, X, d): return connect(A, B, weight=X, delay=d) def print_spikes(of, label, pop): print "\n\n%s\n" % label of.write("\n%s\n" % label) outDat = pop.get_data() for seg in outDat.segments: print(seg.spiketrains) of.write("\n%s\n" % str(seg.spiketrains)) #stimulus def report_time(t): if (t==0): pulse =DCSource(amplitude=0.0055,start=0.0,stop=10.0) TR_Assembly = Assembly(goalTR_1[0,1,2,3,4]) pulse.inject_into(TR_Assembly) elif (t == 100): pulse =DCSource(amplitude=0.0055,start=100.0,stop=110.0) TL_Assembly = Assembly(goalTL_1[0,1,2,3,4]) pulse.inject_into(TL_Assembly) elif (t == 200): pulse =DCSource(amplitude=0.0055,start=200.0,stop=210.0) forward_Assembly = Assembly(goalForward_1[0,1,2,3,4]) pulse.inject_into(forward_Assembly) elif (t == 300): pulse =DCSource(amplitude=0.0055,start=300.0,stop=310.0) back_Assembly = Assembly(goalBack_1[0,1,2,3,4]) pulse.inject_into(back_Assembly) return t + DELAY #return t + 10 #setup connections synWeight = 6.0 inhibitW = -5.25 #goals #default a .02, b .2, c -65, d 2.0, i_offset 0 cell_params = {'a' : 0.05} goalTL_1 = Population(5,Izhikevich(**cell_params)) goalTL_2 = Population(5,Izhikevich(**cell_params)) goalTR_1 = Population(5, Izhikevich(**cell_params)) goalTR_2 = Population(5, Izhikevich(**cell_params)) goalBack_1 = Population(5,Izhikevich(**cell_params)) goalBack_2 = Population(5,Izhikevich(**cell_params)) goalForward_1 = Population(5, Izhikevich(**cell_params)) goalForward_2 = Population(5, Izhikevich(**cell_params)) #connections for goals con_goalTL_12 = con(goalTL_1,goalTL_2,synWeight,DELAY) con_goalTL_21 = con(goalTL_2,goalTL_1,synWeight,DELAY) con_goalTR_12 = con(goalTR_1,goalTR_2,synWeight,DELAY) con_goalTR_21 = con(goalTR_2,goalTR_1,synWeight,DELAY) con_goalBACK_12 = con(goalBack_1,goalBack_2, synWeight, DELAY) con_goalBACK_21 = con(goalBack_2,goalBack_1, synWeight, DELAY) con_goalFORWARD_12 = con(goalForward_1,goalForward_2,synWeight,DELAY) con_goalFORWARD_21 = con(goalForward_2,goalForward_1,synWeight,DELAY) #modules moduleTL_1 = Population(5,Izhikevich(**cell_params)) moduleTL_2 = Population(5,Izhikevich(**cell_params)) moduleTR_1 = Population(5, Izhikevich(**cell_params)) moduleTR_2 = Population(5, Izhikevich(**cell_params)) moduleBack_1 = Population(5,Izhikevich(**cell_params)) moduleBack_2 = Population(5,Izhikevich(**cell_params)) moduleForward_1 = Population(5, Izhikevich(**cell_params)) moduleForward_2 = Population(5, Izhikevich(**cell_params)) #connections for modules con_moduleTL_12 = con(moduleTL_1,moduleTL_2,synWeight,DELAY) con_moduleTL_21 = con(moduleTL_2,moduleTL_1,synWeight,DELAY) con_moduleTR_12 = con(moduleTR_1,moduleTR_2,synWeight,DELAY) con_moduleTR_21 = con(moduleTR_2,moduleTR_1,synWeight,DELAY) con_moduleBACK_12 = con(moduleBack_1,moduleBack_2, synWeight, DELAY) con_moduleBACK_21 = con(moduleBack_2,moduleBack_1, synWeight, DELAY) con_moduleFORWARD_12 = con(moduleForward_1,moduleForward_2,synWeight,DELAY) con_moduleFORWARD_21 = con(moduleForward_2,moduleForward_1,synWeight,DELAY) #connections between modules and goals TL_12 = con(goalTL_1, moduleTL_2, synWeight, DELAY) TL_21 = con(goalTL_2, moduleTL_1, synWeight, DELAY) TL_11 = con(goalTL_1, moduleTL_1, synWeight, DELAY) TL_22 = con(goalTL_2, moduleTL_2, synWeight, DELAY) TR_12 = con(goalTR_1, moduleTR_2, synWeight, DELAY) TR_21 = con(goalTR_2, moduleTR_1, synWeight, DELAY) TR_11 = con(goalTR_1, moduleTR_1, synWeight, DELAY) TR_22 = con(goalTR_2, moduleTR_2, synWeight, DELAY) Back_12 = con(goalBack_1, moduleBack_2, synWeight, DELAY) Back_21 = con(goalBack_2, moduleBack_1, synWeight, DELAY) Back_11 = con(goalBack_1, moduleBack_1, synWeight, DELAY) Back_22 = con(goalBack_2, moduleBack_2, synWeight, DELAY) Forward_12 = con(goalForward_1, moduleForward_2, synWeight, DELAY) Forward_21 = con(goalForward_2, moduleForward_1, synWeight, DELAY) Forward_11 = con(goalForward_1, moduleForward_1, synWeight, DELAY) Forward_22 = con(goalForward_2, moduleForward_2, synWeight, DELAY) #output/actions TL = Population(1, Izhikevich(**cell_params)) TR = Population(1, Izhikevich(**cell_params)) back = Population(1, Izhikevich(**cell_params)) forward = Population(1, Izhikevich(**cell_params)) #connections for output/actions #excitatory &inhibitory excite_outTL_1 = con(moduleTL_1, TL, synWeight, DELAY) excite_outTL_2 = con(moduleTL_2, TL, synWeight, DELAY) inhibit_outTL_1 = con(TL,moduleTL_1,inhibitW,DELAY) inhibit_outTL_2 = con(TL,moduleTL_2,inhibitW,DELAY) inhibit_outgoalTL_1 = con(TL,goalTL_1,inhibitW,DELAY) inhibit_outgoalTL_2 = con(TL,goalTL_2,inhibitW,DELAY) excite_outTR_1 = con(moduleTR_1, TR, synWeight, DELAY) excite_outTR_2 = con(moduleTR_2, TR, synWeight, DELAY) inhibit_outTR_1 = con(TR,moduleTR_1,inhibitW,DELAY) inhibit_outTR_2 = con(TR,moduleTR_2,inhibitW,DELAY) inhibit_outgoalTR_1 = con(TR,goalTR_1,inhibitW,DELAY) inhibit_outgoalTR_2 = con(TR,goalTR_2,inhibitW,DELAY) excite_outBack_1 = con(moduleBack_1, back, synWeight, DELAY) excite_outBack_2 = con(moduleBack_2, back, synWeight, DELAY) inhibit_outBack_1 = con(back,moduleBack_1,inhibitW,DELAY) inhibit_outBack_2 = con(back,moduleBack_2,inhibitW,DELAY) inhibit_outgoalBack_1 = con(back,goalBack_1,inhibitW,DELAY) inhibit_outgoalBack_2 = con(back,goalBack_2,inhibitW,DELAY) excite_outmoduleforward_1 = con(moduleForward_1, forward, synWeight, DELAY) excite_outmoduleforward_2 = con(moduleForward_2, forward, synWeight, DELAY) inhibit_outmoduleforward_1 = con(forward,moduleForward_1,inhibitW,DELAY) inhibit_outmoduleforward_2 = con(forward,moduleForward_2,inhibitW,DELAY) inhibit_outgoalforward_1 = con(forward,goalForward_1,inhibitW,DELAY) inhibit_outgoalforward_2 = con(forward,goalForward_2,inhibitW,DELAY) #new line for 4 and 6 inhibit the output of AB and shut down the firing #various weight settings can see the gradual inactivity #conninhibit = connect(out_ab_pop, bPop, weight=inhibitW, delay=DELAY) #conninhibit = connect(out_ab_pop, aPop, weight=inhibitW, delay=DELAY) #second goal formed of populations CD #connEC = connect(cPop, dPop, weight=synWeight, delay=DELAY) #connED = connect(dPop, cPop, weight=synWeight, delay=DELAY) #connOC = connect(cPop, out_cd_pop, weight=synWeight, delay=DELAY) #connOD = connect(dPop, out_cd_pop, weight=synWeight, delay=DELAY) #setup recording back.record('spikes') forward.record('spikes') TR.record('spikes') TL.record('spikes') #aPop.write_data('test.v') #print .get_parameters() #print .get_parameters() #comment - open file of = open(output_filename, 'w') run(SIM_LENGTH, callbacks=[report_time]) print "A" print_spikes(of,"Pop Back", back) print_spikes(of,"Pop Forward", forward) print_spikes(of,"Pop TR", TR) print_spikes(of,"Pop TL", TL) end()