Esempio n. 1
0
 def gen_input_to_output_proj(self, params=None):
     pops = self._network['populations']
     proj = sim.Projection(
         pops['input'],
         pops['output'],
         sim.AllToAllConnector(),
         sim.StaticSynapse(
             weight=-5.0,
             delay=0.1,  # ms (equals timestep here)
             #label='input to output',
             #receptor_type='inhibitory'
         ))
     return proj
n_neurons = 100
params = copy.copy(sim.IF_curr_exp.default_parameters)
pre = sim.Population(n_neurons, sim.SpikeSourceArray,
                     {'spike_times': [[1] for _ in range(n_neurons)]},
                     label='pre')
params['tau_syn_E'] = 5.
post = sim.Population(n_neurons, sim.IF_curr_exp, params,
                      label='post')
post.record('spikes')

dist_params = {'low': 0.0, 'high': 10.0}
dist = 'uniform'
rand_dist = RandomDistribution(dist, rng=rng, **dist_params)
var = 'weight'
on_device_init = bool(1)
conn = sim.AllToAllConnector()
syn = sim.StaticSynapse(weight=5./n_neurons, delay=1)#rand_dist)
proj = sim.Projection(pre, post, conn, synapse_type=syn, use_procedural=bool(0))

sim.run(2 * n_neurons)
data = post.get_data()
spikes = np.asarray(data.segments[0].spiketrains)

sim.end()

all_at_appr_time = 0
sum_spikes = 0
for i, times in enumerate(spikes):
    sum_spikes += len(times)
    if int(times[0]) == 9:
        all_at_appr_time += 1
Esempio n. 3
0
                 sim.SpikeSourceArray(**{'spike_times': pre_spike_times}))

        tr2post = sim.Projection(trigger, post,
                    sim.OneToOneConnector(),
                    synapse_type=sim.StaticSynapse(weight=2.0),
                    receptor_type='excitatory', label='trigger connection')


        tdep = __stdp__.MyTemporalDependence(**time_dep_vars)
        wdep = __stdp__.MyWeightDependence(w_min=-max_w, w_max=max_w)
        syn = __stdp__.MySTDPMechanism(
            timing_dependence=tdep, weight_dependence=wdep,
            weight=start_w, delay=delay,
        )
        pre2post = sim.Projection(pre, post,
                    sim.AllToAllConnector(), synapse_type=syn,
                    receptor_type='excitatory', label='plastic connection')

        projs[dt] = pre2post

    pprojs[delay] = projs

sim.run(sim_time)
experiments = {}
for delay in pprojs:
    dt_dw = {}
    for dt in pprojs[delay]:
        dt_dw[dt] = (pprojs[delay][dt].getWeights(format='array')[0,0] - start_w)# / max_w
    experiments[delay] = dt_dw

sim.end()
Esempio n. 4
0
    receptor_type='excitatory',
    label='exc_proj_shunt',
)
eProjBoth = sim.Projection(
    preExc,
    postBoth,
    sim.OneToOneConnector(),
    sim.StaticSynapse(weight=2.),
    receptor_type='excitatory',
    label='exc_proj_both',
)

iProj = sim.Projection(
    postStd,
    postStd,
    sim.AllToAllConnector(),
    sim.StaticSynapse(weight=-5.0, delay=timestep),
    receptor_type='inhibitory',
    label='inh_proj',
)

sProj = sim.Projection(
    postShunt,
    postShunt,
    sim.AllToAllConnector(),
    sim.StaticSynapse(weight=-5.0, delay=timestep),
    receptor_type='inhShunt',
    label='shunt_proj',
)

sProjB = sim.Projection(