def simulate():
<EOL>nest.ResetKernel()<EOL>'''<STR_LIT>'''<EOL>nest.SetKernelStatus({"<STR_LIT>": dt, "<STR_LIT>": True,<EOL>"<STR_LIT>": True})<EOL>print("<STR_LIT>")<EOL>'''<STR_LIT>'''<EOL>nest.SetDefaults("<STR_LIT>", neuron_params)<EOL>nest.SetDefaults("<STR_LIT>",{"<STR_LIT>": p_rate})<EOL>'''<STR_LIT>'''<EOL>nodes_ex = nest.Create("<STR_LIT>",NE)<EOL>nodes_in = nest.Create("<STR_LIT>",NI)<EOL>noise    = nest.Create("<STR_LIT>")<EOL>espikes  = nest.Create("<STR_LIT>")<EOL>ispikes  = nest.Create("<STR_LIT>")<EOL>print("<STR_LIT>".format(nodes_ex[<NUM_LIT:0>]))<EOL>print("<STR_LIT>".format(nodes_in[<NUM_LIT:0>]))<EOL>'''<STR_LIT>'''<EOL>nest.SetStatus(nodes_ex, "<STR_LIT>",<EOL>random.rand(len(nodes_ex))*neuron_params["<STR_LIT>"])<EOL>nest.SetStatus(nodes_in, "<STR_LIT>",<EOL>random.rand(len(nodes_in))*neuron_params["<STR_LIT>"])<EOL>'''<STR_LIT>'''<EOL>nest.SetStatus(espikes,[{<EOL>"<STR_LIT:label>": os.path.join(spike_output_path, label + "<STR_LIT>"),<EOL>"<STR_LIT>": True,<EOL>"<STR_LIT>": True,<EOL>"<STR_LIT>": True,<EOL>}])<EOL>nest.SetStatus(ispikes,[{<EOL>"<STR_LIT:label>": os.path.join(spike_output_path, label + "<STR_LIT>"),<EOL>"<STR_LIT>": True,<EOL>"<STR_LIT>": True,<EOL>"<STR_LIT>": True,}])<EOL>print("<STR_LIT>")<EOL>'''<STR_LIT>'''<EOL>nest.CopyModel("<STR_LIT>","<STR_LIT>",{"<STR_LIT>":J_ex, "<STR_LIT>":delay})<EOL>nest.CopyModel("<STR_LIT>","<STR_LIT>",{"<STR_LIT>":J_in, "<STR_LIT>":delay})<EOL>'''<STR_LIT>'''<EOL>if Poisson:<EOL><INDENT>nest.Connect(noise,nodes_ex, '<STR_LIT>', "<STR_LIT>")<EOL>nest.Connect(noise,nodes_in,'<STR_LIT>', "<STR_LIT>")<EOL><DEDENT>'''<STR_LIT>'''<EOL>nest.Connect(nodes_ex,espikes, '<STR_LIT>', "<STR_LIT>")<EOL>nest.Connect(nodes_in,ispikes, '<STR_LIT>', "<STR_LIT>")<EOL>print("<STR_LIT>")<EOL>print("<STR_LIT>")<EOL>'''<STR_LIT>'''<EOL>conn_params_ex = {'<STR_LIT>': '<STR_LIT>', '<STR_LIT>': CE}<EOL>nest.Connect(nodes_ex, nodes_ex+nodes_in, conn_params_ex, "<STR_LIT>")<EOL>print("<STR_LIT>")<EOL>'''<STR_LIT>'''<EOL>conn_params_in = {'<STR_LIT>': '<STR_LIT>', '<STR_LIT>': CI}<EOL>nest.Connect(nodes_in, nodes_ex+nodes_in, conn_params_in, "<STR_LIT>")<EOL>'''<STR_LIT>'''<EOL>endbuild=time.time()<EOL>'''<STR_LIT>'''<EOL>print("<STR_LIT>")<EOL>nest.Simulate(simtime)<EOL>'''<STR_LIT>'''<EOL>endsimulate= time.time()<EOL>'''<STR_LIT>'''<EOL>events_ex = nest.GetStatus(espikes,"<STR_LIT>")[<NUM_LIT:0>]<EOL>events_in = nest.GetStatus(ispikes,"<STR_LIT>")[<NUM_LIT:0>]<EOL>'''<STR_LIT>'''<EOL>rate_ex   = events_ex/simtime*<NUM_LIT>/N_neurons<EOL>rate_in   = events_in/simtime*<NUM_LIT>/N_neurons<EOL>'''<STR_LIT>'''<EOL>num_synapses = nest.GetDefaults("<STR_LIT>")["<STR_LIT>"]+nest.GetDefaults("<STR_LIT>")["<STR_LIT>"]<EOL>'''<STR_LIT>'''<EOL>build_time = endbuild-startbuild<EOL>sim_time   = endsimulate-endbuild<EOL>'''<STR_LIT>'''<EOL>print("<STR_LIT>")<EOL>print("<STR_LIT>".format(N_neurons))<EOL>print("<STR_LIT>".format(num_synapses))<EOL>print("<STR_LIT>".format(int(CE * N_neurons) + N_neurons))<EOL>print("<STR_LIT>".format(int(CI * N_neurons)))<EOL>print("<STR_LIT>" % rate_ex)<EOL>print("<STR_LIT>" % rate_in)<EOL>print("<STR_LIT>" % build_time)<EOL>print("<STR_LIT>" % sim_time)<EOL>'''<STR_LIT>'''<EOL>if False:<EOL><INDENT>nest.raster_plot.from_device(espikes, hist=True)<EOL>nest.raster_plot.from_device(ispikes, hist=True)<EOL>nest.raster_plot.show()<EOL><DEDENT>
instantiate and execute network simulation