コード例 #1
0
ファイル: neurontests.py プロジェクト: astoeckel/PyNN
 def testFixedProbability(self):
     """For all connections created with "fixedProbability"..."""
     for srcP in [self.source5, self.source22]:
         for tgtP in [self.target1, self.target6, self.target33]:
             prj1 = neuron.Projection(srcP, tgtP, neuron.FixedProbabilityConnector(0.5), rng=random.NumpyRNG(12345))
             prj2 = neuron.Projection(srcP, tgtP, neuron.FixedProbabilityConnector(0.5), rng=random.NativeRNG(12345))
             for prj in prj1, prj2:
                 assert (0 < len(prj) < len(srcP)*len(tgtP)), 'len(prj) = %d, len(srcP)*len(tgtP) = %d' % (len(prj), len(srcP)*len(tgtP))
コード例 #2
0
    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,
    6000 + 540,
    6000 + 1250,
]
コード例 #3
0
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))
コード例 #4
0
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)





fpc 	= sim.FixedProbabilityConnector(0.02, rng=NumpyRNG(seed=854))



connections = sim.Projection(input, output, fpc,
                             synapse_type=stdp,
                             receptor_type='excitatory')


connections.set(eta=0.0003)


output.record(['spikes', 'v'])

sim.run(simTimeFin - simTimeIni)
コード例 #5
0
        return gen()


assert generate_spike_times(0).max() > simtime

spike_source = sim.Population(
    n, sim.SpikeSourceArray(spike_times=generate_spike_times))

spike_source.record('spikes')
cells.record('spikes')
cells[0:2].record('m')

syn = sim.StaticSynapse(weight=w, delay=syn_delay)
input_conns = sim.Projection(spike_source,
                             cells,
                             sim.FixedProbabilityConnector(0.5),
                             syn,
                             receptor_type="default")

# === Run simulation ===========================================================

sim.run(simtime)

filename = normalized_filename("Results", "nrn_artificial_cell", "pkl",
                               "neuron", sim.num_processes())
cells.write_data(filename, annotations={'script_name': __file__})

print("Mean firing rate: ", cells.mean_spike_count() * 1000.0 / simtime, "Hz")

plot_figure = True
if plot_figure:
コード例 #6
0
ファイル: test_neuron.py プロジェクト: agravier/pynn
    "e_e": 0.0,
    "e_i": -75.0,
}

sim.setup()

p0 = sim.Population(1, sim.SpikeSourcePoisson, {'rate': 100.0})
p1 = sim.Population(10, TestCell, cell_params)
p2 = sim.Population(10, sim.IF_cond_exp)

p1.record_v(1)
p1.record()
p2.record_v(1)

#curr = sim.DCSource()
#curr.inject_into(p1)

prj01 = sim.Projection(p0, p1, sim.AllToAllConnector())
prj12 = sim.Projection(p1, p2, sim.FixedProbabilityConnector(0.5))

prj01.setWeights(0.1)
prj12.setWeights(0.1)

sim.run(1000.0)

t,v = p1.get_v()[:, 1:3].T
#print p2.get_v()
import pylab
pylab.rcParams['interactive'] = True

pylab.plot(t, v)
コード例 #7
0
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,
                           synapse_type=static_ext, receptor_type="excitatory",
                           label="External")
exc_prj = sim.Projection(exc_cells, all_cells, random_uniform,
                         synapse_type=static_exc, receptor_type="excitatory",
                         label="Excitation")
inh_prj = sim.Projection(inh_cells, all_cells, random_uniform,
                         synapse_type=static_inh, receptor_type="inhibitory",
                         label="Inhibition")