def test_freq(): from nest import SetKernelStatus, Simulate, ResetKernel, raster_plot ResetKernel() SetKernelStatus({ 'total_num_virtual_procs': 2, 'print_time': True, 'resolution': 0.1}) paf = ProkhazkaAfferentFiber() sd = Create('spike_detector', params={'withgid': True, 'withtime': True}) mm = Create('') print(sd) Connect(paf.neurons, sd) Simulate(1000.) raster_plot.from_device(sd, hist=True) raster_plot.show()
print("avg seconds spent per nest.Simulate()"\ " simulation " + str(avg)) ##print("sum " + str(sum)) # get multimeter recordings events = nest.GetStatus(mm)[0]["events"] #t = events["times"] ### for plotting if (myPl): # spike raster plot raster_plot.from_device(sd) # multiply by 10 for actual length of time (1sim/10ms) pylab.xlim(0, len(optLengths) * 10) raster_plot.show() # 1 plot pylab.clf() pylab.subplot(211) pylab.plot(events["times"], events["primary_rate"]) pylab.plot(events["times"], events["secondary_rate"]) #pylab.axis([0, len(optLengths)*10, -200, 200]) # change y bounds z pylab.xlabel("time (ms)") pylab.ylabel("membrane potential (mV) (with electrode "\ "inaccuracy,interfence ? )") pylab.legend(("primary_rate", "secondary_rate")) #pylab.show() # shouldnt work on cluster pylab.savefig(outputDir + "plots/pylabPlots/"\ + names[myV]+currentMuscles[myC]\
nest.SetStatus(proxy_sensory, [{'port_name': 'sensory', 'music_channel': c} for c in range(100)]) nest.SetAcceptableLatency('sensory', 2.0) print("Create devices") sd_sensory = nest.Create("spike_detector", 1) print("Connect") # proxy to sd nest.Connect(proxy_sensory, sd_sensory) print("Simulate") comm.Barrier() nest.Simulate(10000) print("Done") rplt.from_device(sd_sensory) rplt.show()
[e for e in nest.GetStatus([sd_actions[i]], keys="events")[0]["times"] if e > last_action_time] ) # calc the "firerate" of each actor population if rate > max_rate: max_rate = rate # the population with the hightes rate wins chosen_action = i possible_actions = env.actionsAvailable FIRE_RATE_K = 0.5 new_position, outcome, in_end_position = env.move(possible_actions[chosen_action], max_rate * FIRE_RATE_K) nest.SetStatus([sensors["right"]], {"rate": 0.0}) nest.SetStatus([sensors["left"]], {"rate": 0.0}) nest.SetStatus(noise, {"rate": 0.0}) for t in range(5): nest.Simulate(4) time.sleep(0.01) last_action_time += 60 actions_executed += 1 else: state = env.getState().copy() nest.SetStatus([sensors["right"]], {"rate": 0.0}) nest.SetStatus([sensors["left"]], {"rate": 0.0}) nest.SetStatus(noise, {"rate": 0.0}) _, in_end_position = env.init_new_trial() rplt.from_device(sd_all_actions, title="Actions") rplt.from_device(sd_all, title="Difference neurons") rplt.show()