tau_minus=20.0, A_plus=0.01, A_minus=0.012), weight_dependence=AdditiveWeightDependence(w_min=0.01, w_max=10.0)) ''' exc_targets = all_cells[pre_exc] exc_srcs = all_cells[post_exc] inh_srcs = all_cells[pre_inh] # = [] inh_targets = all_cells[post_inh] # = [] exc_cells = all_cells[index_exc] inh_cells = all_cells[index_inh] ''' top_3_hubs = all_cells[top_out[-3:][1]] ext_stim = sim.Population(len(all_cells), sim.SpikeSourcePoisson(rate=7.5, duration=6000.0), label="expoisson") rconn = 0.9 ext_conn = sim.FixedProbabilityConnector(rconn) ext_syn = sim.StaticSynapse(weight=5.925) connections = {} connections['ext'] = sim.Projection(ext_stim, all_cells, ext_conn, ext_syn, receptor_type='excitatory') exc_spike_times = [ 6000 + 250, 6000 + 500, 6000 + 520,
'cm': cm, 'v_rest': v_rest, 'v_thresh': v_thresh, 'tau_syn_E': tau_syn_E, 'tau_syn_I': tau_syn_I, 'e_rev_E': e_rev_E, 'e_rev_I': e_rev_I, 'v_reset': v_reset, 'tau_refrac': tau_refrac, 'i_offset': i_offset } cell_type = sim.IF_cond_exp(**neuronParameters) input = sim.Population(20, sim.SpikeSourcePoisson(rate=50.0)) output = sim.Population(25, cell_type) rand_distr = RandomDistribution('uniform', (v_reset, v_thresh), rng=NumpyRNG(seed=85524)) output.initialize(v=rand_distr) stdp = sim.STDPMechanism(weight_dependence=sim.AdditiveWeightDependence(w_min=0.0, w_max=0.1), timing_dependence=sim.Vogels2011Rule(eta=0.0, rho=1e-3), weight=0.005, delay=0.5)
import pyNN.neuron as sim # can of course replace `neuron` with `nest`, `brian`, etc. import matplotlib.pyplot as plt import numpy as np sim.setup(timestep=0.01) p_in = sim.Population(10, sim.SpikeSourcePoisson(rate=10.0), label="input") p_out = sim.Population(10, sim.EIF_cond_exp_isfa_ista(), label="AdExp neurons") syn = sim.StaticSynapse(weight=0.05) random = sim.FixedProbabilityConnector(p_connect=0.5) connections = sim.Projection(p_in, p_out, random, syn, receptor_type='excitatory') p_in.record('spikes') p_out.record('spikes') # record spikes from all neurons p_out[0:2].record(['v', 'w', 'gsyn_exc']) # record other variables from first two neurons sim.run(500.0) spikes_in = p_in.get_data() data_out = p_out.get_data() fig_settings = { 'lines.linewidth': 0.5, 'axes.linewidth': 0.5, 'axes.labelsize': 'small', 'legend.fontsize': 'small', 'font.size': 8 } plt.rcParams.update(fig_settings) plt.figure(1, figsize=(6, 8))
theta = 20.0 # firing thresholds tau = 20.0 # membrane time constant tau_syn = 0.5 # synapse time constant nu_thresh = theta * v2i / (Je * Ce * tau * exp(1.0) * tau_syn) # threshold rate nu_ext = eta * nu_thresh # external rate per synapse input_rate = 1000.0 * nu_ext # mean input spiking rate v_init = RandomDistribution("uniform", (theta/2, theta), rng=NumpyRNG(seed=79845634)) sim.setup() celltype = sim.IF_curr_alpha(tau_m=tau, v_thresh=theta, tau_refrac=2.0, v_reset=10.0, v_rest=0.0, cm=tau/1.5, tau_syn_E=tau_syn, tau_syn_I=tau_syn) ext_stim = sim.SpikeSourcePoisson(rate=input_rate) exc_cells = sim.Population(Ne, celltype, initial_values={'v': v_init}, label="Exc") inh_cells = sim.Population(Ni, celltype, initial_values={'v': v_init}, label="Inh") external = sim.Population(int(Cext), ext_stim, label="Ext") all_cells = exc_cells + inh_cells all_to_all = sim.AllToAllConnector(callback=ProgressBar()) random_uniform = sim.FixedProbabilityConnector(p_connect=epsilon, callback=ProgressBar()) static_ext = sim.StaticSynapse(delay=delay, weight=Jext) static_exc = sim.StaticSynapse(delay=delay, weight=Je) static_inh = sim.StaticSynapse(delay=delay, weight=Ji) input_prj = sim.Projection(external, all_cells, all_to_all,