""" % This file is licensed under the Allen Institute Terms of Use, which can be found at: %http://www.alleninstitute.org/Media/policies/terms_of_use_content.html -------------------------------------------------------------------------- Script to generate NEST data for Supplement Fig.S3. NOTE: Data files originally generated and used for Fig. have been provided Run as : $ python SuppFig_S3_LIFCond_generate_NEST_data.py where is 'neuron', 'nest', brian, etc """ #import modules from pyNN.utility import get_script_args, Timer from pyNN.random import NumpyRNG, RandomDistribution import numpy from NeuroTools import stgen simulator_name = get_script_args(1)[0] exec("from pyNN.%s import *" % simulator_name) timer = Timer() # single neuron parameters tauMem = 20.0 # neuron membrane time constant [ms] tauSyn = 0.1 # synaptic time constant [ms] tauRef = 0.0 # refractory time [ms] U0 = 0.0 # resting potential [mV] theta = 20.0 # threshold potential [mV] e_rev_E = 100.0 #Reversal potential for excitatory input[mV] e_rev_I = -10.0 #Reversal potential for inhibitory input[mV] firstbinedge = 0.4822620085363334 #With these parameters, the resistance of the cell works out to 40 M-ohms # simulation-related parameters simtime = 205.0 # simulation time [ms] dt = 0.1 # simulation step length [ms] # compute neuron numbers NE = 10000#number of exc neurons #Synaptic Weight and Rate# JE = 0.5 #cond-based synapse's weight in [microS] p_rate = 100 #firing rate in Hz # put cell parameters into a dict cell_params = {'tau_m' : tauMem, 'tau_syn_E' : tauSyn, 'tau_syn_I' : tauSyn, 'tau_refrac' : tauRef, 'e_rev_E' : e_rev_E, 'e_rev_I' : e_rev_I, 'v_rest' : U0, 'v_reset' : U0, 'v_thresh' : theta, 'cm' : 1.0} # (nF) # === Build the population ======================================================== rank = setup(timestep = dt, min_delay = 0.1, spike_precision = 'off_grid') timer.start() #start timer on construction #Create a target population and initialize the potentials E_net = Population(NE, IF_cond_exp, cell_params, label="E_net") vinit_distr = RandomDistribution('uniform', [U0, firstbinedge]) E_net.initialize('v', vinit_distr) #Create a source population ex_spikes = Population(NE, SpikeSourcePoisson, {'rate' : p_rate}, "ex_spikes") #Record spike-times and voltages of the target neuronal population E_net.record() E_net.record_v() #Connect the source to the target using a user-defined connector ext_Connector = OneToOneConnector(weights = JE, delays = None, verbose = True) E_input = Projection(ex_spikes, E_net, ext_Connector, target = "excitatory") # read out time used for building buildCPUTime = timer.elapsedTime() # === Run simulation =========================================================== # run, measure computer time timer.start() # start timer on construction print "%d Running simulation for %g ms." % (rank, simtime) run(simtime) simCPUTime = timer.elapsedTime() E_rate = E_net.meanSpikeCount()*1000.0/simtime #Report run times print("Build time : %g s" % buildCPUTime) print("Simulation time : %g s" % simCPUTime) print("Excitatory rate : %g Hz" % E_rate) print("dt : %g ms" %dt) # write data to file E_net.printSpikes("IFCO_OGUniMoSprProb_5mV_100Hz_st_%s" % (simulator_name)) E_net.print_v("IFCO_OGUniMoSprProb_5mV_100Hz_v_%s" % (simulator_name)) # === Clean up and quit ======================================================== end()