コード例 #1
0
# Stimulating populations
pre_stim = sim.Population(pop_size, sim.SpikeSourceArray, {'spike_times': [[i for i in range(0, sim_time, time_between_pairs)],]})
post_stim = sim.Population(pop_size, sim.SpikeSourceArray, {'spike_times': [[i for i in range(pairing_start_time, pairing_end_time, time_between_pairs)],]})

# +-------------------------------------------------------------------+
# | Creation of connections                                           |
# +-------------------------------------------------------------------+
# Connection type between noise poisson generator and excitatory populations
ee_connector = sim.OneToOneConnector(weights=2)

sim.Projection(pre_stim, pre_pop, ee_connector, target='excitatory')
sim.Projection(post_stim, post_pop, ee_connector, target='excitatory')

# Plastic Connections between pre_pop and post_pop
stdp_model = sim.STDPMechanism(
  timing_dependence = sim.SpikePairRule(tau_plus = 20.0, tau_minus = 50.0),
  weight_dependence = sim.AdditiveWeightDependence(w_min = 0.1, w_max = 1, A_plus=0.02, A_minus = 0.02)
)

prepostpro = sim.Projection(pre_pop, post_pop, sim.OneToOneConnector(weights=1.0), 
  synapse_dynamics = sim.SynapseDynamics(slow= stdp_model)
)

# Record spikes
pre_pop.record()
post_pop.record()

# Run simulation
sim.run(sim_time)

# Dump data
コード例 #2
0
ee_connector = sim.OneToOneConnector(weights=JEE * 0.05)

# Noise projections
sim.Projection(INoisePre, pre_pop, ee_connector, target='excitatory')
sim.Projection(INoisePost, post_pop, ee_connector, target='excitatory')

# Additional Inputs projections
for i in range(len(IAddPre)):
    sim.Projection(IAddPre[i], pre_pop, ee_connector, target='excitatory')
for i in range(len(IAddPost)):
    sim.Projection(IAddPost[i], post_pop, ee_connector, target='excitatory')

# Plastic Connections between pre_pop and post_pop
stdp_model = sim.STDPMechanism(
    timing_dependence=sim.SpikePairRule(tau_plus=20.,
                                        tau_minus=50.0,
                                        nearest=True),
    weight_dependence=sim.AdditiveWeightDependence(w_min=0,
                                                   w_max=0.9,
                                                   A_plus=0.02,
                                                   A_minus=0.02))

plastic_projection = \
    sim.Projection(pre_pop, post_pop, sim.FixedProbabilityConnector(p_connect=0.5),
                     synapse_dynamics = sim.SynapseDynamics(slow= stdp_model)
                     )

# +-------------------------------------------------------------------+
# | Simulation and results                                            |
# +-------------------------------------------------------------------+