def simulate(): """ this test duplicates Brette et al 2007 COBA network Only 100 ms are simulated to save time The results below are taken from running ModelDB code """ #make the net h('random_stream_offset_ = 500' ) # to match the statement in Brette /commmon/init.hoc # set as 1000 in Brette /common/ranstream.hoc net = BretteNet() #instumentation recording = nu.SpikeRecorder(net.cell_list()) sc = nu.SimulationController() #run the simulation sc.set_fixed_dt(0.1) #sc.set_nthread(2) sc.set_v_init(-60) sc.set_celsius(36) sc.stdrun(100) #output the results net.print_stim() recording.print_spikes() print("all done") nur.draw_raster_plot(recording, display=True)
def simulate_net(stim_percentage=5): net = COBANet(500, inhibitory=20, ex_con=20, inh_con=50, ampa_gmax=0.008) # instumentation recording = nu.SpikeRecorder(net.cell_list()) sc = nu.SimulationController() # for cell in net.cell_list(): # cell.set_bias(0.1) # net.cell_list()[0].set_bias(0.1001) # net.cell_list()[-1].set_bias(0.100003) # net.cell_list()[5].set_bias(0.100001) # net.cell_list()[-5].set_bias(0.1000002) stims = list() ncstims = list() num_stim = int(net.NCELL * stim_percentage / 100) for i in range(num_stim): stim = h.NetStim(0.5) stim.interval = 50000 / (num_stim - i) stim.noise = 0.5 stims.append(stim) stim.number = 10e12 ncstim = h.NetCon( stim, net.cell_list()[int(net.NCELL * i / num_stim)].synlist.object(0)) ncstim.weight[0] = 0.02 ncstim.delay = 0 ncstims.append(ncstim) tvec = h.Vector() tvec.record(h._ref_t) vvec = h.Vector() vvec.record(net.cell_list()[0].soma(0.5)._ref_v) # run the simulation sc.set_fixed_dt(0.1) sc.set_v_init(-60) sc.set_celsius(36) sc.stdrun(60000) # output the results # recording.print_spikes() print("all done") # plt.plot(tvec, vvec) # plt.figure() # recording.save_spikes('baseline.csv') nur.draw_raster_plot(recording) nur.draw_raster_plot(read_baseline(), color='r', display=True)
def run(end_time): sc = nu.SimulationController() sc.set_fixed_dt(0.1) sc.set_v_init(-60) sc.set_celsius(36) sc.stdrun(end_time)
cell1 = self.cellList[i] cell1.rs.uniform(0, 1) for j in range(self.NCELL): if not (i == j): nc = cell1.connect2target(self.cellList[j].synlist[1]) nc.delay = 0 nc.weight[0] = self.GABA_GMAX*cell1.rs.repick() self.ncList.append(nc) def make_stim(self): ''' get rid of stim on cell 0 ''' pass if __name__ == '__main__': h.load_file("stdrun.hoc") net = IzhNet(ampa_gmax=0.0000125, gaba_gmax=0.0005, noise=0.02) recording = nu.SpikeRecorder(net.cell_list()) sc = nu.SimulationController() tvec = h.Vector() tvec.record(h._ref_t) vvec = h.Vector() vvec.record(net.cell_list()[300].soma(0.5)._ref_v) sc.set_fixed_dt(0.1) sc.set_v_init(-70) sc.stdrun(10000) plt.plot(tvec, vvec) plt.figure() nur.draw_raster_plot(recording, display=True)