Exemplo n.º 1
0
 def setUp(self):
     sim.setup()
     self.p1 = sim.Population(7, sim.IF_cond_exp())
     self.p2 = sim.Population(4, sim.IF_cond_exp())
     self.p3 = sim.Population(5, sim.IF_curr_alpha())
     self.syn1 = sim.StaticSynapse(weight=0.123, delay=0.5)
     self.syn2 = sim.StaticSynapse(weight=0.456, delay=0.4)
     self.random_connect = sim.FixedNumberPostConnector(n=2)
     self.all2all = sim.AllToAllConnector()
from pyNN.utility.plotting import Figure, Panel

t_stop = 100000
dt = 0.1

sim.setup(timestep=dt)

cell_parameters = {
    'v_reset': 10.0,
    'tau_m': 20.0,
    'v_rest': 0.0,
    'tau_refrac': 2.0,
    'v_thresh': 20.0,
    'tau_syn_E': 2.0
}
p = sim.Population(1, sim.IF_curr_alpha(**cell_parameters))
p.initialize(v=0.0)

rate = 20
stim = sim.Population(
    1,
    nineml_cell_type('Poisson',
                     read("../sources/Poisson.xml")['Poisson'], {})(rate=rate))
stim.initialize(t_next=numpy.random.exponential(1000 / rate))

weight = 0.1
delay = 0.5
prj = sim.Projection(stim,
                     p,
                     sim.AllToAllConnector(),
                     sim.StaticSynapse(weight=weight, delay=delay),
eta = 2.0          # nu_ext / nu_thresh
Je = J             # excitatory weights
Ji = -g * Je       # inhibitory weights
Jext = Je          # external weights
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)