Esempio n. 1
0
#     'i_offset': i_offsets,
# }

sim_time = 100.0
timestep = 1.0

sim.setup(timestep=timestep, min_delay=timestep, backend='SingleThreadedCPU')

post = sim.Population(n_neurons, neuron_class(**base_params))
post.record('spikes')
post.record('v_thresh_adapt')
post.record('v')

pre = sim.Population(
    n_neurons,
    sim.SpikeSourceArray(spike_times=[[10] for _ in range(n_neurons)]),
)
proj = sim.Projection(pre, post, sim.OneToOneConnector(),
                      sim.StaticSynapse(weight=3.2))

sim.run(sim_time)

data = post.get_data()

sim.end()

vthresh = data.segments[0].filter(name='v_thresh_adapt')
v = data.segments[0].filter(name='v')

np.savez_compressed("genn_spiking_behaviour.npz", spikes=data.segments[0])
Esempio n. 2
0
for ssa_id in range(n_ssa):
    sources[ssa_id] = {}

    spike_times = []
    for nid in range(n_neurons[ssa_id]):
        n_spikes = int(np.random.choice(spikes_per_neuron))
        spikes = np.round(np.random.choice(max_t, size=n_spikes,
                                           replace=False)).tolist()
        spikes[:] = sorted(spikes)
        spike_times.append(sorted(spikes))

    sources[ssa_id]['times'] = spike_times

    ssa = sim.Population(n_neurons[ssa_id],
                         sim.SpikeSourceArray(spike_times=spike_times),
                         label='ssa %d' % ssa_id)
    ssa.record(['spikes'])

    sources[ssa_id]['pop'] = ssa

sim.run(int(1.5 * max_t))

for ssa_id in range(n_ssa):
    data = sources[ssa_id]['pop'].get_data()
    sources[ssa_id]['spikes'] = spikes_from_data(data)
    sources[ssa_id]['data'] = data

sim.end()

for ssa_id in range(n_ssa):
Esempio n. 3
0
num_neurons = num_dt

sim.setup(timestep=timestep, min_delay=timestep, backend='SingleThreadedCPU')

pprojs = {}
for delay in delays:

    projs = {}
    for dt in range(start_dt, start_dt + num_dt, 1):  # dt <- (-max_dt, max_dt)
        pre_spike_times = [[trigger_t + dt]]  # pre = (post + dt)
        trigger_spike_times = [[trigger_t]]  # post spike time
        # print(trigger_t, pre_spike_times[0][0], dt)
        # print("post - pre ", trigger_t - pre_spike_times[0][0])
        # makes post population spike
        trigger = sim.Population(
            1, sim.SpikeSourceArray(**{'spike_times': trigger_spike_times}))

        post = sim.Population(1, neuron_class(**base_params))
        post.record('spikes')

        pre = sim.Population(
            1, 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)