""" 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 Fig.1 (used in panels a) and d)). NOTE: Data files originally generated and used for Fig. have been provided Run as : $ python Fig1ad_LIFCurr_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 as np 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] U0 = 0.0 # resting potential [mV] theta = 20.0 # threshold potential [mV] firstbinedge = 0.099333396456875708 # for dt = 0.1 ms #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] tauRef = dt # Neuron numbers in population NE = 10000 #number of exc neurons #Synaptic Weight and Rate# JE1 = 50.0 #current-based synapse's weight in [nA] p_rate = 100 #input firing in Hz # put cell parameters into a dict cell_params = {'tau_m' : tauMem, 'tau_syn_E' : tauSyn, 'tau_syn_I' : tauSyn, 'tau_refrac' : tauRef, 'v_rest' : U0, 'v_reset' : U0, 'v_thresh' : theta, 'cm' : 1.0} # (nF) # === Build the population ======================================================== rank = setup(timestep = dt, min_delay = dt, spike_precision = 'off_grid') timer.start() #start timer on construction print "%d Setting up random number generator" %rank rng = NumpyRNG(kernelseed, parallel_safe=True) #Create a target population and initialize the potentials E_net = Population(NE, IF_curr_exp, cell_params, label="E_net") vinit_distr = RandomDistribution('uniform', [U0,firstbinedge],rng) E_net.initialize('v', vinit_distr) #Create a source population ex_spikes = Population(NE, SpikeSourcePoisson, {'rate': p_rate,'start' : 0.0}, "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_Connector1 = OneToOneConnector(weights = JE1, delays = None, verbose = True) E_input1= Projection(ex_spikes, E_net, ext_Connector1, 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("IFCE_OGUniMoSprProb_5mV_100Hz_st_%s" %(simulator_name)) #E_net.print_v("IFCE_OGUniMoSprProb_5mV_100Hz_v_%s" %(simulator_name)) print nest.version() # === Clean up and quit ======================================================== end()